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
@@ -14,7 +14,8 @@ module ContextDev
14
14
  sig { returns(String) }
15
15
  attr_accessor :id
16
16
 
17
- # Discriminated union describing how changes are detected.
17
+ # How changes are judged. Defaults to `semantic` for extract targets and page
18
+ # targets with `instructions`, otherwise `exact`.
18
19
  sig do
19
20
  returns(
20
21
  ContextDev::Models::MonitorRetrieveResponse::ChangeDetection::Variants
@@ -25,8 +26,7 @@ module ContextDev
25
26
  sig { returns(Time) }
26
27
  attr_accessor :created_at
27
28
 
28
- # Top-level monitor category. Always `web` today; the concrete behavior is
29
- # described by `target` and `change_detection`.
29
+ # Always `web`. Optional.
30
30
  sig do
31
31
  returns(ContextDev::Models::MonitorRetrieveResponse::Mode::TaggedSymbol)
32
32
  end
@@ -35,25 +35,13 @@ module ContextDev
35
35
  sig { returns(String) }
36
36
  attr_accessor :name
37
37
 
38
- # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
39
- # every 6 hours or every 2 days. The total interval (frequency × unit) must be
40
- # between 10 minutes and 1 year.
41
- sig { returns(ContextDev::Models::MonitorRetrieveResponse::Schedule) }
42
- attr_reader :schedule
43
-
44
- sig do
45
- params(
46
- schedule:
47
- ContextDev::Models::MonitorRetrieveResponse::Schedule::OrHash
48
- ).void
49
- end
50
- attr_writer :schedule
38
+ # Unique ID of this request, also in `X-Request-Id`. Include it when contacting
39
+ # support.
40
+ sig { returns(String) }
41
+ attr_accessor :request_id
51
42
 
52
- # Monitor lifecycle status. `failed` means the most recent run failed (see the
53
- # monitor's `last_error`); failed monitors keep running on schedule and flip back
54
- # to `active` on the next successful run. Monitors are auto-`paused` after
55
- # repeated consecutive failures or insufficient-credit skips; resume by PATCHing
56
- # status to `active`.
43
+ # Current state. Failed monitors keep running; paused monitors must be resumed
44
+ # with `status: "active"`.
57
45
  sig do
58
46
  returns(
59
47
  ContextDev::Models::MonitorRetrieveResponse::Status::TaggedSymbol
@@ -61,7 +49,7 @@ module ContextDev
61
49
  end
62
50
  attr_accessor :status
63
51
 
64
- # Discriminated union describing what the monitor watches.
52
+ # What to watch: a page, a sitemap, or data extracted from a site.
65
53
  sig do
66
54
  returns(ContextDev::Models::MonitorRetrieveResponse::Target::Variants)
67
55
  end
@@ -70,10 +58,8 @@ module ContextDev
70
58
  sig { returns(Time) }
71
59
  attr_accessor :updated_at
72
60
 
73
- # Current baseline: the last observed value the monitor compares new snapshots
74
- # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
75
- # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
76
- # after a target or change_detection update, which resets the baseline).
61
+ # Comparison baseline, included on Retrieve. Null until capture completes or after
62
+ # target changes.
77
63
  sig do
78
64
  returns(
79
65
  T.nilable(
@@ -83,6 +69,22 @@ module ContextDev
83
69
  end
84
70
  attr_accessor :baseline
85
71
 
72
+ # Credits this request used and your remaining balance.
73
+ sig do
74
+ returns(
75
+ T.nilable(ContextDev::Models::MonitorRetrieveResponse::KeyMetadata)
76
+ )
77
+ end
78
+ attr_reader :key_metadata
79
+
80
+ sig do
81
+ params(
82
+ key_metadata:
83
+ ContextDev::Models::MonitorRetrieveResponse::KeyMetadata::OrHash
84
+ ).void
85
+ end
86
+ attr_writer :key_metadata
87
+
86
88
  sig { returns(T.nilable(Time)) }
87
89
  attr_accessor :last_change_at
88
90
 
@@ -107,18 +109,36 @@ module ContextDev
107
109
  sig { returns(T.nilable(Time)) }
108
110
  attr_accessor :last_run_at
109
111
 
110
- # When the next scheduled run is due.
112
+ # When the next scheduled run is due; null while paused.
111
113
  sig { returns(T.nilable(Time)) }
112
114
  attr_accessor :next_run_at
113
115
 
114
- # User-defined tags for grouping and filtering monitors and their changes.
115
- # Duplicates are removed.
116
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
117
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
118
+ # between 10 minutes and 1 year.
119
+ sig do
120
+ returns(
121
+ T.nilable(ContextDev::Models::MonitorRetrieveResponse::Schedule)
122
+ )
123
+ end
124
+ attr_reader :schedule
125
+
126
+ sig do
127
+ params(
128
+ schedule:
129
+ ContextDev::Models::MonitorRetrieveResponse::Schedule::OrHash
130
+ ).void
131
+ end
132
+ attr_writer :schedule
133
+
134
+ # Labels for filtering monitors, their changes, and their usage.
116
135
  sig { returns(T.nilable(T::Array[String])) }
117
136
  attr_reader :tags
118
137
 
119
138
  sig { params(tags: T::Array[String]).void }
120
139
  attr_writer :tags
121
140
 
141
+ # Webhook destination and delivery settings. Null means no webhook is configured.
122
142
  sig do
123
143
  returns(T.nilable(ContextDev::Models::MonitorRetrieveResponse::Webhook))
124
144
  end
@@ -154,8 +174,6 @@ module ContextDev
154
174
  end
155
175
  attr_writer :webhook_failure
156
176
 
157
- # A web monitor. `mode` is the constant `web`; behavior is described by `target`
158
- # (page/sitemap/extract) and `change_detection` (exact/semantic).
159
177
  sig do
160
178
  params(
161
179
  id: String,
@@ -167,8 +185,7 @@ module ContextDev
167
185
  created_at: Time,
168
186
  mode: ContextDev::Models::MonitorRetrieveResponse::Mode::OrSymbol,
169
187
  name: String,
170
- schedule:
171
- ContextDev::Models::MonitorRetrieveResponse::Schedule::OrHash,
188
+ request_id: String,
172
189
  status: ContextDev::Models::MonitorRetrieveResponse::Status::OrSymbol,
173
190
  target:
174
191
  T.any(
@@ -185,6 +202,8 @@ module ContextDev
185
202
  ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsExtractBaseline::OrHash
186
203
  )
187
204
  ),
205
+ key_metadata:
206
+ ContextDev::Models::MonitorRetrieveResponse::KeyMetadata::OrHash,
188
207
  last_change_at: T.nilable(Time),
189
208
  last_error:
190
209
  T.nilable(
@@ -192,6 +211,8 @@ module ContextDev
192
211
  ),
193
212
  last_run_at: T.nilable(Time),
194
213
  next_run_at: T.nilable(Time),
214
+ schedule:
215
+ ContextDev::Models::MonitorRetrieveResponse::Schedule::OrHash,
195
216
  tags: T::Array[String],
196
217
  webhook:
197
218
  T.nilable(
@@ -205,40 +226,40 @@ module ContextDev
205
226
  end
206
227
  def self.new(
207
228
  id:,
208
- # Discriminated union describing how changes are detected.
229
+ # How changes are judged. Defaults to `semantic` for extract targets and page
230
+ # targets with `instructions`, otherwise `exact`.
209
231
  change_detection:,
210
232
  created_at:,
211
- # Top-level monitor category. Always `web` today; the concrete behavior is
212
- # described by `target` and `change_detection`.
233
+ # Always `web`. Optional.
213
234
  mode:,
214
235
  name:,
215
- # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
216
- # every 6 hours or every 2 days. The total interval (frequency × unit) must be
217
- # between 10 minutes and 1 year.
218
- schedule:,
219
- # Monitor lifecycle status. `failed` means the most recent run failed (see the
220
- # monitor's `last_error`); failed monitors keep running on schedule and flip back
221
- # to `active` on the next successful run. Monitors are auto-`paused` after
222
- # repeated consecutive failures or insufficient-credit skips; resume by PATCHing
223
- # status to `active`.
236
+ # Unique ID of this request, also in `X-Request-Id`. Include it when contacting
237
+ # support.
238
+ request_id:,
239
+ # Current state. Failed monitors keep running; paused monitors must be resumed
240
+ # with `status: "active"`.
224
241
  status:,
225
- # Discriminated union describing what the monitor watches.
242
+ # What to watch: a page, a sitemap, or data extracted from a site.
226
243
  target:,
227
244
  updated_at:,
228
- # Current baseline: the last observed value the monitor compares new snapshots
229
- # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
230
- # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
231
- # after a target or change_detection update, which resets the baseline).
245
+ # Comparison baseline, included on Retrieve. Null until capture completes or after
246
+ # target changes.
232
247
  baseline: nil,
248
+ # Credits this request used and your remaining balance.
249
+ key_metadata: nil,
233
250
  last_change_at: nil,
234
251
  # Error from the most recent failed run; null when the last run succeeded.
235
252
  last_error: nil,
236
253
  last_run_at: nil,
237
- # When the next scheduled run is due.
254
+ # When the next scheduled run is due; null while paused.
238
255
  next_run_at: nil,
239
- # User-defined tags for grouping and filtering monitors and their changes.
240
- # Duplicates are removed.
256
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
257
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
258
+ # between 10 minutes and 1 year.
259
+ schedule: nil,
260
+ # Labels for filtering monitors, their changes, and their usage.
241
261
  tags: nil,
262
+ # Webhook destination and delivery settings. Null means no webhook is configured.
242
263
  webhook: nil,
243
264
  # Present while webhook deliveries are failing consecutively; null when deliveries
244
265
  # are healthy or no webhook is configured. Cleared on the next successful delivery
@@ -257,7 +278,7 @@ module ContextDev
257
278
  mode:
258
279
  ContextDev::Models::MonitorRetrieveResponse::Mode::TaggedSymbol,
259
280
  name: String,
260
- schedule: ContextDev::Models::MonitorRetrieveResponse::Schedule,
281
+ request_id: String,
261
282
  status:
262
283
  ContextDev::Models::MonitorRetrieveResponse::Status::TaggedSymbol,
263
284
  target:
@@ -267,11 +288,14 @@ module ContextDev
267
288
  T.nilable(
268
289
  ContextDev::Models::MonitorRetrieveResponse::Baseline::Variants
269
290
  ),
291
+ key_metadata:
292
+ ContextDev::Models::MonitorRetrieveResponse::KeyMetadata,
270
293
  last_change_at: T.nilable(Time),
271
294
  last_error:
272
295
  T.nilable(ContextDev::Models::MonitorRetrieveResponse::LastError),
273
296
  last_run_at: T.nilable(Time),
274
297
  next_run_at: T.nilable(Time),
298
+ schedule: ContextDev::Models::MonitorRetrieveResponse::Schedule,
275
299
  tags: T::Array[String],
276
300
  webhook:
277
301
  T.nilable(ContextDev::Models::MonitorRetrieveResponse::Webhook),
@@ -285,7 +309,8 @@ module ContextDev
285
309
  def to_hash
286
310
  end
287
311
 
288
- # Discriminated union describing how changes are detected.
312
+ # How changes are judged. Defaults to `semantic` for extract targets and page
313
+ # targets with `instructions`, otherwise `exact`.
289
314
  module ChangeDetection
290
315
  extend ContextDev::Internal::Type::Union
291
316
 
@@ -306,13 +331,17 @@ module ContextDev
306
331
  )
307
332
  end
308
333
 
334
+ # Use `exact` to compare visible text or sitemap URLs.
309
335
  sig { returns(Symbol) }
310
336
  attr_accessor :type
311
337
 
312
338
  # Detect exact changes. For page targets, this means visible text diffs. For
313
339
  # sitemap targets, this means URL additions and removals.
314
340
  sig { params(type: Symbol).returns(T.attached_class) }
315
- def self.new(type: :exact)
341
+ def self.new(
342
+ # Use `exact` to compare visible text or sitemap URLs.
343
+ type: :exact
344
+ )
316
345
  end
317
346
 
318
347
  sig { override.returns({ type: Symbol }) }
@@ -329,25 +358,30 @@ module ContextDev
329
358
  )
330
359
  end
331
360
 
361
+ # Use `semantic` to judge changes against the target instructions.
332
362
  sig { returns(Symbol) }
333
363
  attr_accessor :type
334
364
 
365
+ # Minimum confidence required to report a meaningful change, from 0 to 1.
335
366
  sig { returns(T.nilable(Float)) }
336
367
  attr_reader :confidence_threshold
337
368
 
338
369
  sig { params(confidence_threshold: Float).void }
339
370
  attr_writer :confidence_threshold
340
371
 
341
- # Detect meaning-level changes to page content, ignoring cosmetic or
342
- # instruction-irrelevant differences. Which changes are meaningful is judged
343
- # against the page or extract target's `instructions` (and an extract target's
344
- # `schema`, when provided).
372
+ # Detect meaningful content changes using the target’s instructions and optional
373
+ # schema.
345
374
  sig do
346
375
  params(confidence_threshold: Float, type: Symbol).returns(
347
376
  T.attached_class
348
377
  )
349
378
  end
350
- def self.new(confidence_threshold: nil, type: :semantic)
379
+ def self.new(
380
+ # Minimum confidence required to report a meaningful change, from 0 to 1.
381
+ confidence_threshold: nil,
382
+ # Use `semantic` to judge changes against the target instructions.
383
+ type: :semantic
384
+ )
351
385
  end
352
386
 
353
387
  sig do
@@ -368,8 +402,7 @@ module ContextDev
368
402
  end
369
403
  end
370
404
 
371
- # Top-level monitor category. Always `web` today; the concrete behavior is
372
- # described by `target` and `change_detection`.
405
+ # Always `web`. Optional.
373
406
  module Mode
374
407
  extend ContextDev::Internal::Type::Enum
375
408
 
@@ -396,145 +429,8 @@ module ContextDev
396
429
  end
397
430
  end
398
431
 
399
- class Schedule < ContextDev::Internal::Type::BaseModel
400
- OrHash =
401
- T.type_alias do
402
- T.any(
403
- ContextDev::Models::MonitorRetrieveResponse::Schedule,
404
- ContextDev::Internal::AnyHash
405
- )
406
- end
407
-
408
- # Number of units between runs. The resulting interval (frequency × unit) must be
409
- # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
410
- # maximum 365 when unit is days).
411
- sig { returns(Integer) }
412
- attr_accessor :frequency
413
-
414
- sig do
415
- returns(
416
- ContextDev::Models::MonitorRetrieveResponse::Schedule::Type::TaggedSymbol
417
- )
418
- end
419
- attr_accessor :type
420
-
421
- sig do
422
- returns(
423
- ContextDev::Models::MonitorRetrieveResponse::Schedule::Unit::TaggedSymbol
424
- )
425
- end
426
- attr_accessor :unit
427
-
428
- # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
429
- # every 6 hours or every 2 days. The total interval (frequency × unit) must be
430
- # between 10 minutes and 1 year.
431
- sig do
432
- params(
433
- frequency: Integer,
434
- type:
435
- ContextDev::Models::MonitorRetrieveResponse::Schedule::Type::OrSymbol,
436
- unit:
437
- ContextDev::Models::MonitorRetrieveResponse::Schedule::Unit::OrSymbol
438
- ).returns(T.attached_class)
439
- end
440
- def self.new(
441
- # Number of units between runs. The resulting interval (frequency × unit) must be
442
- # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
443
- # maximum 365 when unit is days).
444
- frequency:,
445
- type:,
446
- unit:
447
- )
448
- end
449
-
450
- sig do
451
- override.returns(
452
- {
453
- frequency: Integer,
454
- type:
455
- ContextDev::Models::MonitorRetrieveResponse::Schedule::Type::TaggedSymbol,
456
- unit:
457
- ContextDev::Models::MonitorRetrieveResponse::Schedule::Unit::TaggedSymbol
458
- }
459
- )
460
- end
461
- def to_hash
462
- end
463
-
464
- module Type
465
- extend ContextDev::Internal::Type::Enum
466
-
467
- TaggedSymbol =
468
- T.type_alias do
469
- T.all(
470
- Symbol,
471
- ContextDev::Models::MonitorRetrieveResponse::Schedule::Type
472
- )
473
- end
474
- OrSymbol = T.type_alias { T.any(Symbol, String) }
475
-
476
- INTERVAL =
477
- T.let(
478
- :interval,
479
- ContextDev::Models::MonitorRetrieveResponse::Schedule::Type::TaggedSymbol
480
- )
481
-
482
- sig do
483
- override.returns(
484
- T::Array[
485
- ContextDev::Models::MonitorRetrieveResponse::Schedule::Type::TaggedSymbol
486
- ]
487
- )
488
- end
489
- def self.values
490
- end
491
- end
492
-
493
- module Unit
494
- extend ContextDev::Internal::Type::Enum
495
-
496
- TaggedSymbol =
497
- T.type_alias do
498
- T.all(
499
- Symbol,
500
- ContextDev::Models::MonitorRetrieveResponse::Schedule::Unit
501
- )
502
- end
503
- OrSymbol = T.type_alias { T.any(Symbol, String) }
504
-
505
- MINUTES =
506
- T.let(
507
- :minutes,
508
- ContextDev::Models::MonitorRetrieveResponse::Schedule::Unit::TaggedSymbol
509
- )
510
- HOURS =
511
- T.let(
512
- :hours,
513
- ContextDev::Models::MonitorRetrieveResponse::Schedule::Unit::TaggedSymbol
514
- )
515
- DAYS =
516
- T.let(
517
- :days,
518
- ContextDev::Models::MonitorRetrieveResponse::Schedule::Unit::TaggedSymbol
519
- )
520
-
521
- sig do
522
- override.returns(
523
- T::Array[
524
- ContextDev::Models::MonitorRetrieveResponse::Schedule::Unit::TaggedSymbol
525
- ]
526
- )
527
- end
528
- def self.values
529
- end
530
- end
531
- end
532
-
533
- # Monitor lifecycle status. `failed` means the most recent run failed (see the
534
- # monitor's `last_error`); failed monitors keep running on schedule and flip back
535
- # to `active` on the next successful run. Monitors are auto-`paused` after
536
- # repeated consecutive failures or insufficient-credit skips; resume by PATCHing
537
- # status to `active`.
432
+ # Current state. Failed monitors keep running; paused monitors must be resumed
433
+ # with `status: "active"`.
538
434
  module Status
539
435
  extend ContextDev::Internal::Type::Enum
540
436
 
@@ -571,7 +467,7 @@ module ContextDev
571
467
  end
572
468
  end
573
469
 
574
- # Discriminated union describing what the monitor watches.
470
+ # What to watch: a page, a sitemap, or data extracted from a site.
575
471
  module Target
576
472
  extend ContextDev::Internal::Type::Union
577
473
 
@@ -593,27 +489,37 @@ module ContextDev
593
489
  )
594
490
  end
595
491
 
492
+ # Use `page` to watch one web page.
596
493
  sig { returns(Symbol) }
597
494
  attr_accessor :type
598
495
 
496
+ # Public HTTP(S) page URL to monitor.
599
497
  sig { returns(String) }
600
498
  attr_accessor :url
601
499
 
602
- # CSS selectors for HTML regions to remove before text extraction. Applied after
603
- # include_selectors; exclusion takes precedence when an element matches both. Omit
604
- # or pass an empty array to apply no explicit exclusions. Changing these selectors
605
- # creates a new baseline.
500
+ # Optional browser actions executed in array order after the page loads, before
501
+ # content is captured, on every run. Requires a paid plan. Maximum: 5 actions.
502
+ # Changes create a new baseline.
503
+ sig do
504
+ returns(
505
+ T.nilable(
506
+ T::Array[
507
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Variants
508
+ ]
509
+ )
510
+ )
511
+ end
512
+ attr_accessor :actions
513
+
514
+ # Remove matching regions after inclusions. Changes create a new baseline.
606
515
  sig { returns(T.nilable(T::Array[String])) }
607
516
  attr_reader :exclude_selectors
608
517
 
609
518
  sig { params(exclude_selectors: T::Array[String]).void }
610
519
  attr_writer :exclude_selectors
611
520
 
612
- # CSS selectors defining the HTML regions to monitor. Matching subtrees are
613
- # combined in document order before text extraction, instead of automatic
614
- # main-content selection. Omit or pass an empty array to use automatic
615
- # main-content extraction. If the filtered page has no usable text, the run fails
616
- # without replacing the baseline. Changing these selectors creates a new baseline.
521
+ # Monitor these CSS-selected regions. Empty or omitted uses main content. Changes
522
+ # create a new baseline.
617
523
  sig { returns(T.nilable(T::Array[String])) }
618
524
  attr_reader :include_selectors
619
525
 
@@ -640,6 +546,16 @@ module ContextDev
640
546
  sig do
641
547
  params(
642
548
  url: String,
549
+ actions:
550
+ T.nilable(
551
+ T::Array[
552
+ T.any(
553
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Wait::OrHash,
554
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Perform::OrHash,
555
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::OrHash
556
+ )
557
+ ]
558
+ ),
643
559
  exclude_selectors: T::Array[String],
644
560
  include_selectors: T::Array[String],
645
561
  instructions: String,
@@ -648,23 +564,23 @@ module ContextDev
648
564
  ).returns(T.attached_class)
649
565
  end
650
566
  def self.new(
567
+ # Public HTTP(S) page URL to monitor.
651
568
  url:,
652
- # CSS selectors for HTML regions to remove before text extraction. Applied after
653
- # include_selectors; exclusion takes precedence when an element matches both. Omit
654
- # or pass an empty array to apply no explicit exclusions. Changing these selectors
655
- # creates a new baseline.
569
+ # Optional browser actions executed in array order after the page loads, before
570
+ # content is captured, on every run. Requires a paid plan. Maximum: 5 actions.
571
+ # Changes create a new baseline.
572
+ actions: nil,
573
+ # Remove matching regions after inclusions. Changes create a new baseline.
656
574
  exclude_selectors: nil,
657
- # CSS selectors defining the HTML regions to monitor. Matching subtrees are
658
- # combined in document order before text extraction, instead of automatic
659
- # main-content selection. Omit or pass an empty array to use automatic
660
- # main-content extraction. If the filtered page has no usable text, the run fails
661
- # without replacing the baseline. Changing these selectors creates a new baseline.
575
+ # Monitor these CSS-selected regions. Empty or omitted uses main content. Changes
576
+ # create a new baseline.
662
577
  include_selectors: nil,
663
578
  # Plain-language goal describing which page changes matter. When provided without
664
579
  # change_detection, semantic detection is inferred.
665
580
  instructions: nil,
666
581
  # Normalize whitespace before comparing or analyzing text.
667
582
  normalize_whitespace: nil,
583
+ # Use `page` to watch one web page.
668
584
  type: :page
669
585
  )
670
586
  end
@@ -674,6 +590,12 @@ module ContextDev
674
590
  {
675
591
  type: Symbol,
676
592
  url: String,
593
+ actions:
594
+ T.nilable(
595
+ T::Array[
596
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Variants
597
+ ]
598
+ ),
677
599
  exclude_selectors: T::Array[String],
678
600
  include_selectors: T::Array[String],
679
601
  instructions: String,
@@ -683,6 +605,305 @@ module ContextDev
683
605
  end
684
606
  def to_hash
685
607
  end
608
+
609
+ # Browser action discriminated by `do`. Each variant exposes only its applicable
610
+ # fields.
611
+ module Action
612
+ extend ContextDev::Internal::Type::Union
613
+
614
+ Variants =
615
+ T.type_alias do
616
+ T.any(
617
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Wait,
618
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Perform,
619
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll
620
+ )
621
+ end
622
+
623
+ class Wait < ContextDev::Internal::Type::BaseModel
624
+ OrHash =
625
+ T.type_alias do
626
+ T.any(
627
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Wait,
628
+ ContextDev::Internal::AnyHash
629
+ )
630
+ end
631
+
632
+ # Use `wait` to pause for a fixed duration.
633
+ sig { returns(Symbol) }
634
+ attr_accessor :do_
635
+
636
+ # Time to pause in milliseconds before the next action.
637
+ sig { returns(Integer) }
638
+ attr_accessor :time_ms
639
+
640
+ # Pause for a fixed number of milliseconds before continuing to the next action.
641
+ sig do
642
+ params(time_ms: Integer, do_: Symbol).returns(T.attached_class)
643
+ end
644
+ def self.new(
645
+ # Time to pause in milliseconds before the next action.
646
+ time_ms:,
647
+ # Use `wait` to pause for a fixed duration.
648
+ do_: :wait
649
+ )
650
+ end
651
+
652
+ sig { override.returns({ do_: Symbol, time_ms: Integer }) }
653
+ def to_hash
654
+ end
655
+ end
656
+
657
+ class Perform < ContextDev::Internal::Type::BaseModel
658
+ OrHash =
659
+ T.type_alias do
660
+ T.any(
661
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Perform,
662
+ ContextDev::Internal::AnyHash
663
+ )
664
+ end
665
+
666
+ # One browser instruction, such as clicking a button or entering text.
667
+ sig { returns(String) }
668
+ attr_accessor :action
669
+
670
+ # Use `perform` for a plain-language browser instruction.
671
+ sig { returns(Symbol) }
672
+ attr_accessor :do_
673
+
674
+ # Resolve and perform one natural-language browser action.
675
+ sig do
676
+ params(action: String, do_: Symbol).returns(T.attached_class)
677
+ end
678
+ def self.new(
679
+ # One browser instruction, such as clicking a button or entering text.
680
+ action:,
681
+ # Use `perform` for a plain-language browser instruction.
682
+ do_: :perform
683
+ )
684
+ end
685
+
686
+ sig { override.returns({ action: String, do_: Symbol }) }
687
+ def to_hash
688
+ end
689
+ end
690
+
691
+ class Scroll < ContextDev::Internal::Type::BaseModel
692
+ OrHash =
693
+ T.type_alias do
694
+ T.any(
695
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll,
696
+ ContextDev::Internal::AnyHash
697
+ )
698
+ end
699
+
700
+ # Use `scroll` to move through the page or a container.
701
+ sig { returns(Symbol) }
702
+ attr_accessor :do_
703
+
704
+ # Pixels per scroll, one visible viewport, or the current scroll boundary.
705
+ # Defaults to viewport.
706
+ sig do
707
+ returns(
708
+ T.nilable(
709
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Amount::Variants
710
+ )
711
+ )
712
+ end
713
+ attr_reader :amount
714
+
715
+ sig do
716
+ params(
717
+ amount:
718
+ T.any(
719
+ Integer,
720
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Amount::OrSymbol
721
+ )
722
+ ).void
723
+ end
724
+ attr_writer :amount
725
+
726
+ # CSS selector for the first matching scroll container. Defaults to the page.
727
+ sig { returns(T.nilable(String)) }
728
+ attr_reader :container
729
+
730
+ sig { params(container: String).void }
731
+ attr_writer :container
732
+
733
+ # Direction to scroll. Defaults to down.
734
+ sig do
735
+ returns(
736
+ T.nilable(
737
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Direction::TaggedSymbol
738
+ )
739
+ )
740
+ end
741
+ attr_reader :direction
742
+
743
+ sig do
744
+ params(
745
+ direction:
746
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Direction::OrSymbol
747
+ ).void
748
+ end
749
+ attr_writer :direction
750
+
751
+ # Maximum scroll iterations. Stops early when scrolling and scrollable extent stop
752
+ # changing. Defaults to 1.
753
+ sig { returns(T.nilable(Integer)) }
754
+ attr_reader :max_scrolls
755
+
756
+ sig { params(max_scrolls: Integer).void }
757
+ attr_writer :max_scrolls
758
+
759
+ # Scroll the page or a selected scrollable container, waiting adaptively for
760
+ # content and dimensions to settle after each iteration.
761
+ sig do
762
+ params(
763
+ amount:
764
+ T.any(
765
+ Integer,
766
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Amount::OrSymbol
767
+ ),
768
+ container: String,
769
+ direction:
770
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Direction::OrSymbol,
771
+ max_scrolls: Integer,
772
+ do_: Symbol
773
+ ).returns(T.attached_class)
774
+ end
775
+ def self.new(
776
+ # Pixels per scroll, one visible viewport, or the current scroll boundary.
777
+ # Defaults to viewport.
778
+ amount: nil,
779
+ # CSS selector for the first matching scroll container. Defaults to the page.
780
+ container: nil,
781
+ # Direction to scroll. Defaults to down.
782
+ direction: nil,
783
+ # Maximum scroll iterations. Stops early when scrolling and scrollable extent stop
784
+ # changing. Defaults to 1.
785
+ max_scrolls: nil,
786
+ # Use `scroll` to move through the page or a container.
787
+ do_: :scroll
788
+ )
789
+ end
790
+
791
+ sig do
792
+ override.returns(
793
+ {
794
+ do_: Symbol,
795
+ amount:
796
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Amount::Variants,
797
+ container: String,
798
+ direction:
799
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Direction::TaggedSymbol,
800
+ max_scrolls: Integer
801
+ }
802
+ )
803
+ end
804
+ def to_hash
805
+ end
806
+
807
+ # Pixels per scroll, one visible viewport, or the current scroll boundary.
808
+ # Defaults to viewport.
809
+ module Amount
810
+ extend ContextDev::Internal::Type::Union
811
+
812
+ Variants =
813
+ T.type_alias do
814
+ T.any(
815
+ Integer,
816
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Amount::TaggedSymbol
817
+ )
818
+ end
819
+
820
+ sig do
821
+ override.returns(
822
+ T::Array[
823
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Amount::Variants
824
+ ]
825
+ )
826
+ end
827
+ def self.variants
828
+ end
829
+
830
+ TaggedSymbol =
831
+ T.type_alias do
832
+ T.all(
833
+ Symbol,
834
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Amount
835
+ )
836
+ end
837
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
838
+
839
+ VIEWPORT =
840
+ T.let(
841
+ :viewport,
842
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Amount::TaggedSymbol
843
+ )
844
+ MAX =
845
+ T.let(
846
+ :max,
847
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Amount::TaggedSymbol
848
+ )
849
+ end
850
+
851
+ # Direction to scroll. Defaults to down.
852
+ module Direction
853
+ extend ContextDev::Internal::Type::Enum
854
+
855
+ TaggedSymbol =
856
+ T.type_alias do
857
+ T.all(
858
+ Symbol,
859
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Direction
860
+ )
861
+ end
862
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
863
+
864
+ UP =
865
+ T.let(
866
+ :up,
867
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Direction::TaggedSymbol
868
+ )
869
+ DOWN =
870
+ T.let(
871
+ :down,
872
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Direction::TaggedSymbol
873
+ )
874
+ LEFT =
875
+ T.let(
876
+ :left,
877
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Direction::TaggedSymbol
878
+ )
879
+ RIGHT =
880
+ T.let(
881
+ :right,
882
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Direction::TaggedSymbol
883
+ )
884
+
885
+ sig do
886
+ override.returns(
887
+ T::Array[
888
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Scroll::Direction::TaggedSymbol
889
+ ]
890
+ )
891
+ end
892
+ def self.values
893
+ end
894
+ end
895
+ end
896
+
897
+ sig do
898
+ override.returns(
899
+ T::Array[
900
+ ContextDev::Models::MonitorRetrieveResponse::Target::Page::Action::Variants
901
+ ]
902
+ )
903
+ end
904
+ def self.variants
905
+ end
906
+ end
686
907
  end
687
908
 
688
909
  class Sitemap < ContextDev::Internal::Type::BaseModel
@@ -694,6 +915,7 @@ module ContextDev
694
915
  )
695
916
  end
696
917
 
918
+ # Use `sitemap` to watch a site for added or removed URLs.
697
919
  sig { returns(Symbol) }
698
920
  attr_accessor :type
699
921
 
@@ -722,11 +944,7 @@ module ContextDev
722
944
  sig { params(max_urls: Integer).void }
723
945
  attr_writer :max_urls
724
946
 
725
- # Watch a sitemap for URL additions and removals. Crawled URLs are normalized
726
- # (lowercased host, no trailing slash/fragment) and scoped to the monitored site
727
- # and its subdomains before comparison. On a detected difference the sitemap is
728
- # re-fetched within the same run and only URLs both observations agree on are
729
- # reported, suppressing transient crawl flaps.
947
+ # Watch a site’s URL inventory for confirmed additions and removals.
730
948
  sig do
731
949
  params(
732
950
  url: String,
@@ -745,6 +963,7 @@ module ContextDev
745
963
  include: nil,
746
964
  # Maximum number of sitemap URLs to track (capped at 10,000).
747
965
  max_urls: nil,
966
+ # Use `sitemap` to watch a site for added or removed URLs.
748
967
  type: :sitemap
749
968
  )
750
969
  end
@@ -778,6 +997,7 @@ module ContextDev
778
997
  sig { returns(String) }
779
998
  attr_accessor :instructions
780
999
 
1000
+ # Use `extract` to watch structured data across selected pages.
781
1001
  sig { returns(Symbol) }
782
1002
  attr_accessor :type
783
1003
 
@@ -785,6 +1005,7 @@ module ContextDev
785
1005
  sig { returns(String) }
786
1006
  attr_accessor :url
787
1007
 
1008
+ # Allow page discovery on subdomains of the target site.
788
1009
  sig { returns(T.nilable(T::Boolean)) }
789
1010
  attr_reader :follow_subdomains
790
1011
 
@@ -805,25 +1026,16 @@ module ContextDev
805
1026
  sig { params(max_pages: Integer).void }
806
1027
  attr_writer :max_pages
807
1028
 
808
- # JSON Schema describing the data you care about. It is used three ways: it guides
809
- # which pages are selected for tracking, it gives the change judge extra context
810
- # on which changes matter (alongside `instructions`), and it defines the shape of
811
- # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
812
- # about once a day). It is not a response format for changes: change events and
813
- # webhook payloads always contain diffs, summaries, and evidence excerpts — never
814
- # data in this schema's shape. If omitted, a default summary + key-points schema
815
- # is used.
1029
+ # JSON Schema for page selection and the baseline snapshot. Changes return diffs
1030
+ # and evidence.
816
1031
  sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
817
1032
  attr_reader :schema
818
1033
 
819
1034
  sig { params(schema: T::Hash[Symbol, T.anything]).void }
820
1035
  attr_writer :schema
821
1036
 
822
- # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
823
- # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
824
- # track; each run re-checks exactly those pages, and confirmed content changes are
825
- # judged for relevance against the monitor's `instructions` (and `schema`, when
826
- # provided). The tracked page set is refreshed by a periodic re-discovery crawl.
1037
+ # Track relevant pages selected by `schema` and `instructions`; refresh the page
1038
+ # set periodically.
827
1039
  sig do
828
1040
  params(
829
1041
  instructions: String,
@@ -841,20 +1053,16 @@ module ContextDev
841
1053
  instructions:,
842
1054
  # Root URL to extract structured data from.
843
1055
  url:,
1056
+ # Allow page discovery on subdomains of the target site.
844
1057
  follow_subdomains: nil,
845
1058
  # Optional maximum link depth from the starting URL (0 = only the starting page).
846
1059
  max_depth: nil,
847
1060
  # Maximum number of pages to track.
848
1061
  max_pages: nil,
849
- # JSON Schema describing the data you care about. It is used three ways: it guides
850
- # which pages are selected for tracking, it gives the change judge extra context
851
- # on which changes matter (alongside `instructions`), and it defines the shape of
852
- # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
853
- # about once a day). It is not a response format for changes: change events and
854
- # webhook payloads always contain diffs, summaries, and evidence excerpts — never
855
- # data in this schema's shape. If omitted, a default summary + key-points schema
856
- # is used.
1062
+ # JSON Schema for page selection and the baseline snapshot. Changes return diffs
1063
+ # and evidence.
857
1064
  schema: nil,
1065
+ # Use `extract` to watch structured data across selected pages.
858
1066
  type: :extract
859
1067
  )
860
1068
  end
@@ -887,10 +1095,8 @@ module ContextDev
887
1095
  end
888
1096
  end
889
1097
 
890
- # Current baseline: the last observed value the monitor compares new snapshots
891
- # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
892
- # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
893
- # after a target or change_detection update, which resets the baseline).
1098
+ # Comparison baseline, included on Retrieve. Null until capture completes or after
1099
+ # target changes.
894
1100
  module Baseline
895
1101
  extend ContextDev::Internal::Type::Union
896
1102
 
@@ -999,10 +1205,8 @@ module ContextDev
999
1205
  sig { returns(Time) }
1000
1206
  attr_accessor :captured_at
1001
1207
 
1002
- # The extracted structured data, matching the monitor's extraction schema (same
1003
- # shape as the /web/extract endpoint's `data`). Refreshed when the monitor
1004
- # re-discovers its page set (at most about once a day); `null` when no extraction
1005
- # has been captured yet.
1208
+ # Latest structured snapshot matching the extraction schema, refreshed at most
1209
+ # daily; `null` before capture.
1006
1210
  sig { returns(T.anything) }
1007
1211
  attr_accessor :data
1008
1212
 
@@ -1022,10 +1226,8 @@ module ContextDev
1022
1226
  def self.new(
1023
1227
  # When this baseline was last captured or replaced.
1024
1228
  captured_at:,
1025
- # The extracted structured data, matching the monitor's extraction schema (same
1026
- # shape as the /web/extract endpoint's `data`). Refreshed when the monitor
1027
- # re-discovers its page set (at most about once a day); `null` when no extraction
1028
- # has been captured yet.
1229
+ # Latest structured snapshot matching the extraction schema, refreshed at most
1230
+ # daily; `null` before capture.
1029
1231
  data:,
1030
1232
  # The page URLs the monitor tracks and analyzes for changes.
1031
1233
  urls_analyzed:
@@ -1056,6 +1258,46 @@ module ContextDev
1056
1258
  end
1057
1259
  end
1058
1260
 
1261
+ class KeyMetadata < ContextDev::Internal::Type::BaseModel
1262
+ OrHash =
1263
+ T.type_alias do
1264
+ T.any(
1265
+ ContextDev::Models::MonitorRetrieveResponse::KeyMetadata,
1266
+ ContextDev::Internal::AnyHash
1267
+ )
1268
+ end
1269
+
1270
+ # Credits charged for this request.
1271
+ sig { returns(Integer) }
1272
+ attr_accessor :credits_consumed
1273
+
1274
+ # Credits remaining for your organization.
1275
+ sig { returns(Integer) }
1276
+ attr_accessor :credits_remaining
1277
+
1278
+ # Credits this request used and your remaining balance.
1279
+ sig do
1280
+ params(credits_consumed: Integer, credits_remaining: Integer).returns(
1281
+ T.attached_class
1282
+ )
1283
+ end
1284
+ def self.new(
1285
+ # Credits charged for this request.
1286
+ credits_consumed:,
1287
+ # Credits remaining for your organization.
1288
+ credits_remaining:
1289
+ )
1290
+ end
1291
+
1292
+ sig do
1293
+ override.returns(
1294
+ { credits_consumed: Integer, credits_remaining: Integer }
1295
+ )
1296
+ end
1297
+ def to_hash
1298
+ end
1299
+ end
1300
+
1059
1301
  class LastError < ContextDev::Internal::Type::BaseModel
1060
1302
  OrHash =
1061
1303
  T.type_alias do
@@ -1081,6 +1323,146 @@ module ContextDev
1081
1323
  end
1082
1324
  end
1083
1325
 
1326
+ class Schedule < ContextDev::Internal::Type::BaseModel
1327
+ OrHash =
1328
+ T.type_alias do
1329
+ T.any(
1330
+ ContextDev::Models::MonitorRetrieveResponse::Schedule,
1331
+ ContextDev::Internal::AnyHash
1332
+ )
1333
+ end
1334
+
1335
+ # Number of units between runs. The resulting interval (frequency × unit) must be
1336
+ # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
1337
+ # maximum 365 when unit is days).
1338
+ sig { returns(Integer) }
1339
+ attr_accessor :frequency
1340
+
1341
+ # Use `interval` to run on a repeating schedule.
1342
+ sig do
1343
+ returns(
1344
+ ContextDev::Models::MonitorRetrieveResponse::Schedule::Type::TaggedSymbol
1345
+ )
1346
+ end
1347
+ attr_accessor :type
1348
+
1349
+ # Time unit used with `frequency` to set the run interval.
1350
+ sig do
1351
+ returns(
1352
+ ContextDev::Models::MonitorRetrieveResponse::Schedule::Unit::TaggedSymbol
1353
+ )
1354
+ end
1355
+ attr_accessor :unit
1356
+
1357
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
1358
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
1359
+ # between 10 minutes and 1 year.
1360
+ sig do
1361
+ params(
1362
+ frequency: Integer,
1363
+ type:
1364
+ ContextDev::Models::MonitorRetrieveResponse::Schedule::Type::OrSymbol,
1365
+ unit:
1366
+ ContextDev::Models::MonitorRetrieveResponse::Schedule::Unit::OrSymbol
1367
+ ).returns(T.attached_class)
1368
+ end
1369
+ def self.new(
1370
+ # Number of units between runs. The resulting interval (frequency × unit) must be
1371
+ # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
1372
+ # maximum 365 when unit is days).
1373
+ frequency:,
1374
+ # Use `interval` to run on a repeating schedule.
1375
+ type:,
1376
+ # Time unit used with `frequency` to set the run interval.
1377
+ unit:
1378
+ )
1379
+ end
1380
+
1381
+ sig do
1382
+ override.returns(
1383
+ {
1384
+ frequency: Integer,
1385
+ type:
1386
+ ContextDev::Models::MonitorRetrieveResponse::Schedule::Type::TaggedSymbol,
1387
+ unit:
1388
+ ContextDev::Models::MonitorRetrieveResponse::Schedule::Unit::TaggedSymbol
1389
+ }
1390
+ )
1391
+ end
1392
+ def to_hash
1393
+ end
1394
+
1395
+ # Use `interval` to run on a repeating schedule.
1396
+ module Type
1397
+ extend ContextDev::Internal::Type::Enum
1398
+
1399
+ TaggedSymbol =
1400
+ T.type_alias do
1401
+ T.all(
1402
+ Symbol,
1403
+ ContextDev::Models::MonitorRetrieveResponse::Schedule::Type
1404
+ )
1405
+ end
1406
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1407
+
1408
+ INTERVAL =
1409
+ T.let(
1410
+ :interval,
1411
+ ContextDev::Models::MonitorRetrieveResponse::Schedule::Type::TaggedSymbol
1412
+ )
1413
+
1414
+ sig do
1415
+ override.returns(
1416
+ T::Array[
1417
+ ContextDev::Models::MonitorRetrieveResponse::Schedule::Type::TaggedSymbol
1418
+ ]
1419
+ )
1420
+ end
1421
+ def self.values
1422
+ end
1423
+ end
1424
+
1425
+ # Time unit used with `frequency` to set the run interval.
1426
+ module Unit
1427
+ extend ContextDev::Internal::Type::Enum
1428
+
1429
+ TaggedSymbol =
1430
+ T.type_alias do
1431
+ T.all(
1432
+ Symbol,
1433
+ ContextDev::Models::MonitorRetrieveResponse::Schedule::Unit
1434
+ )
1435
+ end
1436
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1437
+
1438
+ MINUTES =
1439
+ T.let(
1440
+ :minutes,
1441
+ ContextDev::Models::MonitorRetrieveResponse::Schedule::Unit::TaggedSymbol
1442
+ )
1443
+ HOURS =
1444
+ T.let(
1445
+ :hours,
1446
+ ContextDev::Models::MonitorRetrieveResponse::Schedule::Unit::TaggedSymbol
1447
+ )
1448
+ DAYS =
1449
+ T.let(
1450
+ :days,
1451
+ ContextDev::Models::MonitorRetrieveResponse::Schedule::Unit::TaggedSymbol
1452
+ )
1453
+
1454
+ sig do
1455
+ override.returns(
1456
+ T::Array[
1457
+ ContextDev::Models::MonitorRetrieveResponse::Schedule::Unit::TaggedSymbol
1458
+ ]
1459
+ )
1460
+ end
1461
+ def self.values
1462
+ end
1463
+ end
1464
+ end
1465
+
1084
1466
  class Webhook < ContextDev::Internal::Type::BaseModel
1085
1467
  OrHash =
1086
1468
  T.type_alias do
@@ -1090,15 +1472,13 @@ module ContextDev
1090
1472
  )
1091
1473
  end
1092
1474
 
1093
- # Webhook URL events are delivered to. Slack incoming webhook URLs are
1094
- # automatically formatted as Slack messages.
1475
+ # Public HTTP(S) URL that receives events. Slack and GovSlack URLs get formatted
1476
+ # messages.
1095
1477
  sig { returns(String) }
1096
1478
  attr_accessor :url
1097
1479
 
1098
- # Events delivered to this endpoint. `change.detected` fires only when a run
1099
- # detects a change; `run.completed` fires on every completed run — including runs
1100
- # that detected no change — and embeds the change when one was detected. Defaults
1101
- # to `["change.detected"]` when omitted.
1480
+ # Events to deliver. Defaults to `change.detected`; `run.completed` also includes
1481
+ # unchanged runs.
1102
1482
  sig do
1103
1483
  returns(
1104
1484
  T.nilable(
@@ -1127,18 +1507,15 @@ module ContextDev
1127
1507
  sig { params(retry_: ContextDev::RetryConfig::OrHash).void }
1128
1508
  attr_writer :retry_
1129
1509
 
1130
- # Signing secret used to verify webhook authenticity. Omitted unless the API key
1131
- # has monitors:write permission or full access. Each delivery includes an
1132
- # `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
1133
- # `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
1134
- # compare and reject stale timestamps to prevent replay. Generated by the API;
1135
- # cannot be set by clients.
1510
+ # API-generated signing secret. Visible only with full access or `monitors:write`
1511
+ # permission.
1136
1512
  sig { returns(T.nilable(String)) }
1137
1513
  attr_reader :secret
1138
1514
 
1139
1515
  sig { params(secret: String).void }
1140
1516
  attr_writer :secret
1141
1517
 
1518
+ # Webhook destination and delivery settings. Null means no webhook is configured.
1142
1519
  sig do
1143
1520
  params(
1144
1521
  url: String,
@@ -1151,22 +1528,16 @@ module ContextDev
1151
1528
  ).returns(T.attached_class)
1152
1529
  end
1153
1530
  def self.new(
1154
- # Webhook URL events are delivered to. Slack incoming webhook URLs are
1155
- # automatically formatted as Slack messages.
1531
+ # Public HTTP(S) URL that receives events. Slack and GovSlack URLs get formatted
1532
+ # messages.
1156
1533
  url:,
1157
- # Events delivered to this endpoint. `change.detected` fires only when a run
1158
- # detects a change; `run.completed` fires on every completed run — including runs
1159
- # that detected no change — and embeds the change when one was detected. Defaults
1160
- # to `["change.detected"]` when omitted.
1534
+ # Events to deliver. Defaults to `change.detected`; `run.completed` also includes
1535
+ # unchanged runs.
1161
1536
  events: nil,
1162
1537
  # Webhook retry settings. Use {} for the default schedule.
1163
1538
  retry_: nil,
1164
- # Signing secret used to verify webhook authenticity. Omitted unless the API key
1165
- # has monitors:write permission or full access. Each delivery includes an
1166
- # `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
1167
- # `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
1168
- # compare and reject stale timestamps to prevent replay. Generated by the API;
1169
- # cannot be set by clients.
1539
+ # API-generated signing secret. Visible only with full access or `monitors:write`
1540
+ # permission.
1170
1541
  secret: nil
1171
1542
  )
1172
1543
  end