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::MonitorCreateResponse::ChangeDetection::Variants
@@ -25,14 +26,12 @@ module ContextDev
25
26
  sig { returns(Time) }
26
27
  attr_accessor :created_at
27
28
 
28
- # The baseline run queued by this create call, or null if it could not be queued
29
- # immediately (in which case the baseline runs on the next scheduled tick). Poll
30
- # GET /monitors/{monitor_id}/runs/{run_id}.
29
+ # ID of the baseline run queued at creation; null if it will start on the next
30
+ # scheduled tick.
31
31
  sig { returns(T.nilable(String)) }
32
32
  attr_accessor :initial_run_id
33
33
 
34
- # Top-level monitor category. Always `web` today; the concrete behavior is
35
- # described by `target` and `change_detection`.
34
+ # Always `web`. Optional.
36
35
  sig do
37
36
  returns(ContextDev::Models::MonitorCreateResponse::Mode::TaggedSymbol)
38
37
  end
@@ -41,30 +40,19 @@ module ContextDev
41
40
  sig { returns(String) }
42
41
  attr_accessor :name
43
42
 
44
- # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
45
- # every 6 hours or every 2 days. The total interval (frequency × unit) must be
46
- # between 10 minutes and 1 year.
47
- sig { returns(ContextDev::Models::MonitorCreateResponse::Schedule) }
48
- attr_reader :schedule
49
-
50
- sig do
51
- params(
52
- schedule: ContextDev::Models::MonitorCreateResponse::Schedule::OrHash
53
- ).void
54
- end
55
- attr_writer :schedule
43
+ # Unique ID of this request, also in `X-Request-Id`. Include it when contacting
44
+ # support.
45
+ sig { returns(String) }
46
+ attr_accessor :request_id
56
47
 
57
- # Monitor lifecycle status. `failed` means the most recent run failed (see the
58
- # monitor's `last_error`); failed monitors keep running on schedule and flip back
59
- # to `active` on the next successful run. Monitors are auto-`paused` after
60
- # repeated consecutive failures or insufficient-credit skips; resume by PATCHing
61
- # status to `active`.
48
+ # Current state. Failed monitors keep running; paused monitors must be resumed
49
+ # with `status: "active"`.
62
50
  sig do
63
51
  returns(ContextDev::Models::MonitorCreateResponse::Status::TaggedSymbol)
64
52
  end
65
53
  attr_accessor :status
66
54
 
67
- # Discriminated union describing what the monitor watches.
55
+ # What to watch: a page, a sitemap, or data extracted from a site.
68
56
  sig do
69
57
  returns(ContextDev::Models::MonitorCreateResponse::Target::Variants)
70
58
  end
@@ -73,10 +61,8 @@ module ContextDev
73
61
  sig { returns(Time) }
74
62
  attr_accessor :updated_at
75
63
 
76
- # Current baseline: the last observed value the monitor compares new snapshots
77
- # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
78
- # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
79
- # after a target or change_detection update, which resets the baseline).
64
+ # Comparison baseline, included on Retrieve. Null until capture completes or after
65
+ # target changes.
80
66
  sig do
81
67
  returns(
82
68
  T.nilable(
@@ -86,6 +72,22 @@ module ContextDev
86
72
  end
87
73
  attr_accessor :baseline
88
74
 
75
+ # Credits this request used and your remaining balance.
76
+ sig do
77
+ returns(
78
+ T.nilable(ContextDev::Models::MonitorCreateResponse::KeyMetadata)
79
+ )
80
+ end
81
+ attr_reader :key_metadata
82
+
83
+ sig do
84
+ params(
85
+ key_metadata:
86
+ ContextDev::Models::MonitorCreateResponse::KeyMetadata::OrHash
87
+ ).void
88
+ end
89
+ attr_writer :key_metadata
90
+
89
91
  sig { returns(T.nilable(Time)) }
90
92
  attr_accessor :last_change_at
91
93
 
@@ -108,18 +110,33 @@ module ContextDev
108
110
  sig { returns(T.nilable(Time)) }
109
111
  attr_accessor :last_run_at
110
112
 
111
- # When the next scheduled run is due.
113
+ # When the next scheduled run is due; null while paused.
112
114
  sig { returns(T.nilable(Time)) }
113
115
  attr_accessor :next_run_at
114
116
 
115
- # User-defined tags for grouping and filtering monitors and their changes.
116
- # Duplicates are removed.
117
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
118
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
119
+ # between 10 minutes and 1 year.
120
+ sig do
121
+ returns(T.nilable(ContextDev::Models::MonitorCreateResponse::Schedule))
122
+ end
123
+ attr_reader :schedule
124
+
125
+ sig do
126
+ params(
127
+ schedule: ContextDev::Models::MonitorCreateResponse::Schedule::OrHash
128
+ ).void
129
+ end
130
+ attr_writer :schedule
131
+
132
+ # Labels for filtering monitors, their changes, and their usage.
117
133
  sig { returns(T.nilable(T::Array[String])) }
118
134
  attr_reader :tags
119
135
 
120
136
  sig { params(tags: T::Array[String]).void }
121
137
  attr_writer :tags
122
138
 
139
+ # Webhook destination and delivery settings. Null means no webhook is configured.
123
140
  sig do
124
141
  returns(T.nilable(ContextDev::Models::MonitorCreateResponse::Webhook))
125
142
  end
@@ -155,8 +172,6 @@ module ContextDev
155
172
  end
156
173
  attr_writer :webhook_failure
157
174
 
158
- # A newly created monitor plus `initial_run_id`, the id of the baseline run queued
159
- # at creation.
160
175
  sig do
161
176
  params(
162
177
  id: String,
@@ -169,7 +184,7 @@ module ContextDev
169
184
  initial_run_id: T.nilable(String),
170
185
  mode: ContextDev::Models::MonitorCreateResponse::Mode::OrSymbol,
171
186
  name: String,
172
- schedule: ContextDev::Models::MonitorCreateResponse::Schedule::OrHash,
187
+ request_id: String,
173
188
  status: ContextDev::Models::MonitorCreateResponse::Status::OrSymbol,
174
189
  target:
175
190
  T.any(
@@ -186,6 +201,8 @@ module ContextDev
186
201
  ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsExtractBaseline::OrHash
187
202
  )
188
203
  ),
204
+ key_metadata:
205
+ ContextDev::Models::MonitorCreateResponse::KeyMetadata::OrHash,
189
206
  last_change_at: T.nilable(Time),
190
207
  last_error:
191
208
  T.nilable(
@@ -193,6 +210,7 @@ module ContextDev
193
210
  ),
194
211
  last_run_at: T.nilable(Time),
195
212
  next_run_at: T.nilable(Time),
213
+ schedule: ContextDev::Models::MonitorCreateResponse::Schedule::OrHash,
196
214
  tags: T::Array[String],
197
215
  webhook:
198
216
  T.nilable(
@@ -206,44 +224,43 @@ module ContextDev
206
224
  end
207
225
  def self.new(
208
226
  id:,
209
- # Discriminated union describing how changes are detected.
227
+ # How changes are judged. Defaults to `semantic` for extract targets and page
228
+ # targets with `instructions`, otherwise `exact`.
210
229
  change_detection:,
211
230
  created_at:,
212
- # The baseline run queued by this create call, or null if it could not be queued
213
- # immediately (in which case the baseline runs on the next scheduled tick). Poll
214
- # GET /monitors/{monitor_id}/runs/{run_id}.
231
+ # ID of the baseline run queued at creation; null if it will start on the next
232
+ # scheduled tick.
215
233
  initial_run_id:,
216
- # Top-level monitor category. Always `web` today; the concrete behavior is
217
- # described by `target` and `change_detection`.
234
+ # Always `web`. Optional.
218
235
  mode:,
219
236
  name:,
220
- # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
221
- # every 6 hours or every 2 days. The total interval (frequency × unit) must be
222
- # between 10 minutes and 1 year.
223
- schedule:,
224
- # Monitor lifecycle status. `failed` means the most recent run failed (see the
225
- # monitor's `last_error`); failed monitors keep running on schedule and flip back
226
- # to `active` on the next successful run. Monitors are auto-`paused` after
227
- # repeated consecutive failures or insufficient-credit skips; resume by PATCHing
228
- # status to `active`.
237
+ # Unique ID of this request, also in `X-Request-Id`. Include it when contacting
238
+ # support.
239
+ request_id:,
240
+ # Current state. Failed monitors keep running; paused monitors must be resumed
241
+ # with `status: "active"`.
229
242
  status:,
230
- # Discriminated union describing what the monitor watches.
243
+ # What to watch: a page, a sitemap, or data extracted from a site.
231
244
  target:,
232
245
  updated_at:,
233
- # Current baseline: the last observed value the monitor compares new snapshots
234
- # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
235
- # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
236
- # after a target or change_detection update, which resets the baseline).
246
+ # Comparison baseline, included on Retrieve. Null until capture completes or after
247
+ # target changes.
237
248
  baseline: nil,
249
+ # Credits this request used and your remaining balance.
250
+ key_metadata: nil,
238
251
  last_change_at: nil,
239
252
  # Error from the most recent failed run; null when the last run succeeded.
240
253
  last_error: nil,
241
254
  last_run_at: nil,
242
- # When the next scheduled run is due.
255
+ # When the next scheduled run is due; null while paused.
243
256
  next_run_at: nil,
244
- # User-defined tags for grouping and filtering monitors and their changes.
245
- # Duplicates are removed.
257
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
258
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
259
+ # between 10 minutes and 1 year.
260
+ schedule: nil,
261
+ # Labels for filtering monitors, their changes, and their usage.
246
262
  tags: nil,
263
+ # Webhook destination and delivery settings. Null means no webhook is configured.
247
264
  webhook: nil,
248
265
  # Present while webhook deliveries are failing consecutively; null when deliveries
249
266
  # are healthy or no webhook is configured. Cleared on the next successful delivery
@@ -262,7 +279,7 @@ module ContextDev
262
279
  initial_run_id: T.nilable(String),
263
280
  mode: ContextDev::Models::MonitorCreateResponse::Mode::TaggedSymbol,
264
281
  name: String,
265
- schedule: ContextDev::Models::MonitorCreateResponse::Schedule,
282
+ request_id: String,
266
283
  status:
267
284
  ContextDev::Models::MonitorCreateResponse::Status::TaggedSymbol,
268
285
  target: ContextDev::Models::MonitorCreateResponse::Target::Variants,
@@ -271,11 +288,14 @@ module ContextDev
271
288
  T.nilable(
272
289
  ContextDev::Models::MonitorCreateResponse::Baseline::Variants
273
290
  ),
291
+ key_metadata:
292
+ ContextDev::Models::MonitorCreateResponse::KeyMetadata,
274
293
  last_change_at: T.nilable(Time),
275
294
  last_error:
276
295
  T.nilable(ContextDev::Models::MonitorCreateResponse::LastError),
277
296
  last_run_at: T.nilable(Time),
278
297
  next_run_at: T.nilable(Time),
298
+ schedule: ContextDev::Models::MonitorCreateResponse::Schedule,
279
299
  tags: T::Array[String],
280
300
  webhook:
281
301
  T.nilable(ContextDev::Models::MonitorCreateResponse::Webhook),
@@ -289,7 +309,8 @@ module ContextDev
289
309
  def to_hash
290
310
  end
291
311
 
292
- # 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`.
293
314
  module ChangeDetection
294
315
  extend ContextDev::Internal::Type::Union
295
316
 
@@ -310,13 +331,17 @@ module ContextDev
310
331
  )
311
332
  end
312
333
 
334
+ # Use `exact` to compare visible text or sitemap URLs.
313
335
  sig { returns(Symbol) }
314
336
  attr_accessor :type
315
337
 
316
338
  # Detect exact changes. For page targets, this means visible text diffs. For
317
339
  # sitemap targets, this means URL additions and removals.
318
340
  sig { params(type: Symbol).returns(T.attached_class) }
319
- def self.new(type: :exact)
341
+ def self.new(
342
+ # Use `exact` to compare visible text or sitemap URLs.
343
+ type: :exact
344
+ )
320
345
  end
321
346
 
322
347
  sig { override.returns({ type: Symbol }) }
@@ -333,25 +358,30 @@ module ContextDev
333
358
  )
334
359
  end
335
360
 
361
+ # Use `semantic` to judge changes against the target instructions.
336
362
  sig { returns(Symbol) }
337
363
  attr_accessor :type
338
364
 
365
+ # Minimum confidence required to report a meaningful change, from 0 to 1.
339
366
  sig { returns(T.nilable(Float)) }
340
367
  attr_reader :confidence_threshold
341
368
 
342
369
  sig { params(confidence_threshold: Float).void }
343
370
  attr_writer :confidence_threshold
344
371
 
345
- # Detect meaning-level changes to page content, ignoring cosmetic or
346
- # instruction-irrelevant differences. Which changes are meaningful is judged
347
- # against the page or extract target's `instructions` (and an extract target's
348
- # `schema`, when provided).
372
+ # Detect meaningful content changes using the target’s instructions and optional
373
+ # schema.
349
374
  sig do
350
375
  params(confidence_threshold: Float, type: Symbol).returns(
351
376
  T.attached_class
352
377
  )
353
378
  end
354
- 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
+ )
355
385
  end
356
386
 
357
387
  sig do
@@ -372,8 +402,7 @@ module ContextDev
372
402
  end
373
403
  end
374
404
 
375
- # Top-level monitor category. Always `web` today; the concrete behavior is
376
- # described by `target` and `change_detection`.
405
+ # Always `web`. Optional.
377
406
  module Mode
378
407
  extend ContextDev::Internal::Type::Enum
379
408
 
@@ -400,145 +429,8 @@ module ContextDev
400
429
  end
401
430
  end
402
431
 
403
- class Schedule < ContextDev::Internal::Type::BaseModel
404
- OrHash =
405
- T.type_alias do
406
- T.any(
407
- ContextDev::Models::MonitorCreateResponse::Schedule,
408
- ContextDev::Internal::AnyHash
409
- )
410
- end
411
-
412
- # Number of units between runs. The resulting interval (frequency × unit) must be
413
- # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
414
- # maximum 365 when unit is days).
415
- sig { returns(Integer) }
416
- attr_accessor :frequency
417
-
418
- sig do
419
- returns(
420
- ContextDev::Models::MonitorCreateResponse::Schedule::Type::TaggedSymbol
421
- )
422
- end
423
- attr_accessor :type
424
-
425
- sig do
426
- returns(
427
- ContextDev::Models::MonitorCreateResponse::Schedule::Unit::TaggedSymbol
428
- )
429
- end
430
- attr_accessor :unit
431
-
432
- # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
433
- # every 6 hours or every 2 days. The total interval (frequency × unit) must be
434
- # between 10 minutes and 1 year.
435
- sig do
436
- params(
437
- frequency: Integer,
438
- type:
439
- ContextDev::Models::MonitorCreateResponse::Schedule::Type::OrSymbol,
440
- unit:
441
- ContextDev::Models::MonitorCreateResponse::Schedule::Unit::OrSymbol
442
- ).returns(T.attached_class)
443
- end
444
- def self.new(
445
- # Number of units between runs. The resulting interval (frequency × unit) must be
446
- # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
447
- # maximum 365 when unit is days).
448
- frequency:,
449
- type:,
450
- unit:
451
- )
452
- end
453
-
454
- sig do
455
- override.returns(
456
- {
457
- frequency: Integer,
458
- type:
459
- ContextDev::Models::MonitorCreateResponse::Schedule::Type::TaggedSymbol,
460
- unit:
461
- ContextDev::Models::MonitorCreateResponse::Schedule::Unit::TaggedSymbol
462
- }
463
- )
464
- end
465
- def to_hash
466
- end
467
-
468
- module Type
469
- extend ContextDev::Internal::Type::Enum
470
-
471
- TaggedSymbol =
472
- T.type_alias do
473
- T.all(
474
- Symbol,
475
- ContextDev::Models::MonitorCreateResponse::Schedule::Type
476
- )
477
- end
478
- OrSymbol = T.type_alias { T.any(Symbol, String) }
479
-
480
- INTERVAL =
481
- T.let(
482
- :interval,
483
- ContextDev::Models::MonitorCreateResponse::Schedule::Type::TaggedSymbol
484
- )
485
-
486
- sig do
487
- override.returns(
488
- T::Array[
489
- ContextDev::Models::MonitorCreateResponse::Schedule::Type::TaggedSymbol
490
- ]
491
- )
492
- end
493
- def self.values
494
- end
495
- end
496
-
497
- module Unit
498
- extend ContextDev::Internal::Type::Enum
499
-
500
- TaggedSymbol =
501
- T.type_alias do
502
- T.all(
503
- Symbol,
504
- ContextDev::Models::MonitorCreateResponse::Schedule::Unit
505
- )
506
- end
507
- OrSymbol = T.type_alias { T.any(Symbol, String) }
508
-
509
- MINUTES =
510
- T.let(
511
- :minutes,
512
- ContextDev::Models::MonitorCreateResponse::Schedule::Unit::TaggedSymbol
513
- )
514
- HOURS =
515
- T.let(
516
- :hours,
517
- ContextDev::Models::MonitorCreateResponse::Schedule::Unit::TaggedSymbol
518
- )
519
- DAYS =
520
- T.let(
521
- :days,
522
- ContextDev::Models::MonitorCreateResponse::Schedule::Unit::TaggedSymbol
523
- )
524
-
525
- sig do
526
- override.returns(
527
- T::Array[
528
- ContextDev::Models::MonitorCreateResponse::Schedule::Unit::TaggedSymbol
529
- ]
530
- )
531
- end
532
- def self.values
533
- end
534
- end
535
- end
536
-
537
- # Monitor lifecycle status. `failed` means the most recent run failed (see the
538
- # monitor's `last_error`); failed monitors keep running on schedule and flip back
539
- # to `active` on the next successful run. Monitors are auto-`paused` after
540
- # repeated consecutive failures or insufficient-credit skips; resume by PATCHing
541
- # status to `active`.
432
+ # Current state. Failed monitors keep running; paused monitors must be resumed
433
+ # with `status: "active"`.
542
434
  module Status
543
435
  extend ContextDev::Internal::Type::Enum
544
436
 
@@ -575,7 +467,7 @@ module ContextDev
575
467
  end
576
468
  end
577
469
 
578
- # Discriminated union describing what the monitor watches.
470
+ # What to watch: a page, a sitemap, or data extracted from a site.
579
471
  module Target
580
472
  extend ContextDev::Internal::Type::Union
581
473
 
@@ -597,27 +489,37 @@ module ContextDev
597
489
  )
598
490
  end
599
491
 
492
+ # Use `page` to watch one web page.
600
493
  sig { returns(Symbol) }
601
494
  attr_accessor :type
602
495
 
496
+ # Public HTTP(S) page URL to monitor.
603
497
  sig { returns(String) }
604
498
  attr_accessor :url
605
499
 
606
- # CSS selectors for HTML regions to remove before text extraction. Applied after
607
- # include_selectors; exclusion takes precedence when an element matches both. Omit
608
- # or pass an empty array to apply no explicit exclusions. Changing these selectors
609
- # 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::MonitorCreateResponse::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.
610
515
  sig { returns(T.nilable(T::Array[String])) }
611
516
  attr_reader :exclude_selectors
612
517
 
613
518
  sig { params(exclude_selectors: T::Array[String]).void }
614
519
  attr_writer :exclude_selectors
615
520
 
616
- # CSS selectors defining the HTML regions to monitor. Matching subtrees are
617
- # combined in document order before text extraction, instead of automatic
618
- # main-content selection. Omit or pass an empty array to use automatic
619
- # main-content extraction. If the filtered page has no usable text, the run fails
620
- # 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.
621
523
  sig { returns(T.nilable(T::Array[String])) }
622
524
  attr_reader :include_selectors
623
525
 
@@ -644,6 +546,16 @@ module ContextDev
644
546
  sig do
645
547
  params(
646
548
  url: String,
549
+ actions:
550
+ T.nilable(
551
+ T::Array[
552
+ T.any(
553
+ ContextDev::Models::MonitorCreateResponse::Target::Page::Action::Wait::OrHash,
554
+ ContextDev::Models::MonitorCreateResponse::Target::Page::Action::Perform::OrHash,
555
+ ContextDev::Models::MonitorCreateResponse::Target::Page::Action::Scroll::OrHash
556
+ )
557
+ ]
558
+ ),
647
559
  exclude_selectors: T::Array[String],
648
560
  include_selectors: T::Array[String],
649
561
  instructions: String,
@@ -652,23 +564,23 @@ module ContextDev
652
564
  ).returns(T.attached_class)
653
565
  end
654
566
  def self.new(
567
+ # Public HTTP(S) page URL to monitor.
655
568
  url:,
656
- # CSS selectors for HTML regions to remove before text extraction. Applied after
657
- # include_selectors; exclusion takes precedence when an element matches both. Omit
658
- # or pass an empty array to apply no explicit exclusions. Changing these selectors
659
- # 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.
660
574
  exclude_selectors: nil,
661
- # CSS selectors defining the HTML regions to monitor. Matching subtrees are
662
- # combined in document order before text extraction, instead of automatic
663
- # main-content selection. Omit or pass an empty array to use automatic
664
- # main-content extraction. If the filtered page has no usable text, the run fails
665
- # 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.
666
577
  include_selectors: nil,
667
578
  # Plain-language goal describing which page changes matter. When provided without
668
579
  # change_detection, semantic detection is inferred.
669
580
  instructions: nil,
670
581
  # Normalize whitespace before comparing or analyzing text.
671
582
  normalize_whitespace: nil,
583
+ # Use `page` to watch one web page.
672
584
  type: :page
673
585
  )
674
586
  end
@@ -678,6 +590,12 @@ module ContextDev
678
590
  {
679
591
  type: Symbol,
680
592
  url: String,
593
+ actions:
594
+ T.nilable(
595
+ T::Array[
596
+ ContextDev::Models::MonitorCreateResponse::Target::Page::Action::Variants
597
+ ]
598
+ ),
681
599
  exclude_selectors: T::Array[String],
682
600
  include_selectors: T::Array[String],
683
601
  instructions: String,
@@ -687,6 +605,305 @@ module ContextDev
687
605
  end
688
606
  def to_hash
689
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::MonitorCreateResponse::Target::Page::Action::Wait,
618
+ ContextDev::Models::MonitorCreateResponse::Target::Page::Action::Perform,
619
+ ContextDev::Models::MonitorCreateResponse::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::MonitorCreateResponse::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::MonitorCreateResponse::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::MonitorCreateResponse::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::MonitorCreateResponse::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::MonitorCreateResponse::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::MonitorCreateResponse::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::MonitorCreateResponse::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::MonitorCreateResponse::Target::Page::Action::Scroll::Amount::OrSymbol
767
+ ),
768
+ container: String,
769
+ direction:
770
+ ContextDev::Models::MonitorCreateResponse::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::MonitorCreateResponse::Target::Page::Action::Scroll::Amount::Variants,
797
+ container: String,
798
+ direction:
799
+ ContextDev::Models::MonitorCreateResponse::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::MonitorCreateResponse::Target::Page::Action::Scroll::Amount::TaggedSymbol
817
+ )
818
+ end
819
+
820
+ sig do
821
+ override.returns(
822
+ T::Array[
823
+ ContextDev::Models::MonitorCreateResponse::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::MonitorCreateResponse::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::MonitorCreateResponse::Target::Page::Action::Scroll::Amount::TaggedSymbol
843
+ )
844
+ MAX =
845
+ T.let(
846
+ :max,
847
+ ContextDev::Models::MonitorCreateResponse::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::MonitorCreateResponse::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::MonitorCreateResponse::Target::Page::Action::Scroll::Direction::TaggedSymbol
868
+ )
869
+ DOWN =
870
+ T.let(
871
+ :down,
872
+ ContextDev::Models::MonitorCreateResponse::Target::Page::Action::Scroll::Direction::TaggedSymbol
873
+ )
874
+ LEFT =
875
+ T.let(
876
+ :left,
877
+ ContextDev::Models::MonitorCreateResponse::Target::Page::Action::Scroll::Direction::TaggedSymbol
878
+ )
879
+ RIGHT =
880
+ T.let(
881
+ :right,
882
+ ContextDev::Models::MonitorCreateResponse::Target::Page::Action::Scroll::Direction::TaggedSymbol
883
+ )
884
+
885
+ sig do
886
+ override.returns(
887
+ T::Array[
888
+ ContextDev::Models::MonitorCreateResponse::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::MonitorCreateResponse::Target::Page::Action::Variants
901
+ ]
902
+ )
903
+ end
904
+ def self.variants
905
+ end
906
+ end
690
907
  end
691
908
 
692
909
  class Sitemap < ContextDev::Internal::Type::BaseModel
@@ -698,6 +915,7 @@ module ContextDev
698
915
  )
699
916
  end
700
917
 
918
+ # Use `sitemap` to watch a site for added or removed URLs.
701
919
  sig { returns(Symbol) }
702
920
  attr_accessor :type
703
921
 
@@ -726,11 +944,7 @@ module ContextDev
726
944
  sig { params(max_urls: Integer).void }
727
945
  attr_writer :max_urls
728
946
 
729
- # Watch a sitemap for URL additions and removals. Crawled URLs are normalized
730
- # (lowercased host, no trailing slash/fragment) and scoped to the monitored site
731
- # and its subdomains before comparison. On a detected difference the sitemap is
732
- # re-fetched within the same run and only URLs both observations agree on are
733
- # reported, suppressing transient crawl flaps.
947
+ # Watch a site’s URL inventory for confirmed additions and removals.
734
948
  sig do
735
949
  params(
736
950
  url: String,
@@ -749,6 +963,7 @@ module ContextDev
749
963
  include: nil,
750
964
  # Maximum number of sitemap URLs to track (capped at 10,000).
751
965
  max_urls: nil,
966
+ # Use `sitemap` to watch a site for added or removed URLs.
752
967
  type: :sitemap
753
968
  )
754
969
  end
@@ -782,6 +997,7 @@ module ContextDev
782
997
  sig { returns(String) }
783
998
  attr_accessor :instructions
784
999
 
1000
+ # Use `extract` to watch structured data across selected pages.
785
1001
  sig { returns(Symbol) }
786
1002
  attr_accessor :type
787
1003
 
@@ -789,6 +1005,7 @@ module ContextDev
789
1005
  sig { returns(String) }
790
1006
  attr_accessor :url
791
1007
 
1008
+ # Allow page discovery on subdomains of the target site.
792
1009
  sig { returns(T.nilable(T::Boolean)) }
793
1010
  attr_reader :follow_subdomains
794
1011
 
@@ -809,25 +1026,16 @@ module ContextDev
809
1026
  sig { params(max_pages: Integer).void }
810
1027
  attr_writer :max_pages
811
1028
 
812
- # JSON Schema describing the data you care about. It is used three ways: it guides
813
- # which pages are selected for tracking, it gives the change judge extra context
814
- # on which changes matter (alongside `instructions`), and it defines the shape of
815
- # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
816
- # about once a day). It is not a response format for changes: change events and
817
- # webhook payloads always contain diffs, summaries, and evidence excerpts — never
818
- # data in this schema's shape. If omitted, a default summary + key-points schema
819
- # is used.
1029
+ # JSON Schema for page selection and the baseline snapshot. Changes return diffs
1030
+ # and evidence.
820
1031
  sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
821
1032
  attr_reader :schema
822
1033
 
823
1034
  sig { params(schema: T::Hash[Symbol, T.anything]).void }
824
1035
  attr_writer :schema
825
1036
 
826
- # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
827
- # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
828
- # track; each run re-checks exactly those pages, and confirmed content changes are
829
- # judged for relevance against the monitor's `instructions` (and `schema`, when
830
- # 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.
831
1039
  sig do
832
1040
  params(
833
1041
  instructions: String,
@@ -845,20 +1053,16 @@ module ContextDev
845
1053
  instructions:,
846
1054
  # Root URL to extract structured data from.
847
1055
  url:,
1056
+ # Allow page discovery on subdomains of the target site.
848
1057
  follow_subdomains: nil,
849
1058
  # Optional maximum link depth from the starting URL (0 = only the starting page).
850
1059
  max_depth: nil,
851
1060
  # Maximum number of pages to track.
852
1061
  max_pages: nil,
853
- # JSON Schema describing the data you care about. It is used three ways: it guides
854
- # which pages are selected for tracking, it gives the change judge extra context
855
- # on which changes matter (alongside `instructions`), and it defines the shape of
856
- # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
857
- # about once a day). It is not a response format for changes: change events and
858
- # webhook payloads always contain diffs, summaries, and evidence excerpts — never
859
- # data in this schema's shape. If omitted, a default summary + key-points schema
860
- # is used.
1062
+ # JSON Schema for page selection and the baseline snapshot. Changes return diffs
1063
+ # and evidence.
861
1064
  schema: nil,
1065
+ # Use `extract` to watch structured data across selected pages.
862
1066
  type: :extract
863
1067
  )
864
1068
  end
@@ -891,10 +1095,8 @@ module ContextDev
891
1095
  end
892
1096
  end
893
1097
 
894
- # Current baseline: the last observed value the monitor compares new snapshots
895
- # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
896
- # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
897
- # 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.
898
1100
  module Baseline
899
1101
  extend ContextDev::Internal::Type::Union
900
1102
 
@@ -1003,10 +1205,8 @@ module ContextDev
1003
1205
  sig { returns(Time) }
1004
1206
  attr_accessor :captured_at
1005
1207
 
1006
- # The extracted structured data, matching the monitor's extraction schema (same
1007
- # shape as the /web/extract endpoint's `data`). Refreshed when the monitor
1008
- # re-discovers its page set (at most about once a day); `null` when no extraction
1009
- # has been captured yet.
1208
+ # Latest structured snapshot matching the extraction schema, refreshed at most
1209
+ # daily; `null` before capture.
1010
1210
  sig { returns(T.anything) }
1011
1211
  attr_accessor :data
1012
1212
 
@@ -1026,10 +1226,8 @@ module ContextDev
1026
1226
  def self.new(
1027
1227
  # When this baseline was last captured or replaced.
1028
1228
  captured_at:,
1029
- # The extracted structured data, matching the monitor's extraction schema (same
1030
- # shape as the /web/extract endpoint's `data`). Refreshed when the monitor
1031
- # re-discovers its page set (at most about once a day); `null` when no extraction
1032
- # has been captured yet.
1229
+ # Latest structured snapshot matching the extraction schema, refreshed at most
1230
+ # daily; `null` before capture.
1033
1231
  data:,
1034
1232
  # The page URLs the monitor tracks and analyzes for changes.
1035
1233
  urls_analyzed:
@@ -1060,6 +1258,46 @@ module ContextDev
1060
1258
  end
1061
1259
  end
1062
1260
 
1261
+ class KeyMetadata < ContextDev::Internal::Type::BaseModel
1262
+ OrHash =
1263
+ T.type_alias do
1264
+ T.any(
1265
+ ContextDev::Models::MonitorCreateResponse::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
+
1063
1301
  class LastError < ContextDev::Internal::Type::BaseModel
1064
1302
  OrHash =
1065
1303
  T.type_alias do
@@ -1085,6 +1323,146 @@ module ContextDev
1085
1323
  end
1086
1324
  end
1087
1325
 
1326
+ class Schedule < ContextDev::Internal::Type::BaseModel
1327
+ OrHash =
1328
+ T.type_alias do
1329
+ T.any(
1330
+ ContextDev::Models::MonitorCreateResponse::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::MonitorCreateResponse::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::MonitorCreateResponse::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::MonitorCreateResponse::Schedule::Type::OrSymbol,
1365
+ unit:
1366
+ ContextDev::Models::MonitorCreateResponse::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::MonitorCreateResponse::Schedule::Type::TaggedSymbol,
1387
+ unit:
1388
+ ContextDev::Models::MonitorCreateResponse::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::MonitorCreateResponse::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::MonitorCreateResponse::Schedule::Type::TaggedSymbol
1412
+ )
1413
+
1414
+ sig do
1415
+ override.returns(
1416
+ T::Array[
1417
+ ContextDev::Models::MonitorCreateResponse::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::MonitorCreateResponse::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::MonitorCreateResponse::Schedule::Unit::TaggedSymbol
1442
+ )
1443
+ HOURS =
1444
+ T.let(
1445
+ :hours,
1446
+ ContextDev::Models::MonitorCreateResponse::Schedule::Unit::TaggedSymbol
1447
+ )
1448
+ DAYS =
1449
+ T.let(
1450
+ :days,
1451
+ ContextDev::Models::MonitorCreateResponse::Schedule::Unit::TaggedSymbol
1452
+ )
1453
+
1454
+ sig do
1455
+ override.returns(
1456
+ T::Array[
1457
+ ContextDev::Models::MonitorCreateResponse::Schedule::Unit::TaggedSymbol
1458
+ ]
1459
+ )
1460
+ end
1461
+ def self.values
1462
+ end
1463
+ end
1464
+ end
1465
+
1088
1466
  class Webhook < ContextDev::Internal::Type::BaseModel
1089
1467
  OrHash =
1090
1468
  T.type_alias do
@@ -1094,15 +1472,13 @@ module ContextDev
1094
1472
  )
1095
1473
  end
1096
1474
 
1097
- # Webhook URL events are delivered to. Slack incoming webhook URLs are
1098
- # automatically formatted as Slack messages.
1475
+ # Public HTTP(S) URL that receives events. Slack and GovSlack URLs get formatted
1476
+ # messages.
1099
1477
  sig { returns(String) }
1100
1478
  attr_accessor :url
1101
1479
 
1102
- # Events delivered to this endpoint. `change.detected` fires only when a run
1103
- # detects a change; `run.completed` fires on every completed run — including runs
1104
- # that detected no change — and embeds the change when one was detected. Defaults
1105
- # to `["change.detected"]` when omitted.
1480
+ # Events to deliver. Defaults to `change.detected`; `run.completed` also includes
1481
+ # unchanged runs.
1106
1482
  sig do
1107
1483
  returns(
1108
1484
  T.nilable(
@@ -1131,18 +1507,15 @@ module ContextDev
1131
1507
  sig { params(retry_: ContextDev::RetryConfig::OrHash).void }
1132
1508
  attr_writer :retry_
1133
1509
 
1134
- # Signing secret used to verify webhook authenticity. Omitted unless the API key
1135
- # has monitors:write permission or full access. Each delivery includes an
1136
- # `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
1137
- # `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
1138
- # compare and reject stale timestamps to prevent replay. Generated by the API;
1139
- # cannot be set by clients.
1510
+ # API-generated signing secret. Visible only with full access or `monitors:write`
1511
+ # permission.
1140
1512
  sig { returns(T.nilable(String)) }
1141
1513
  attr_reader :secret
1142
1514
 
1143
1515
  sig { params(secret: String).void }
1144
1516
  attr_writer :secret
1145
1517
 
1518
+ # Webhook destination and delivery settings. Null means no webhook is configured.
1146
1519
  sig do
1147
1520
  params(
1148
1521
  url: String,
@@ -1155,22 +1528,16 @@ module ContextDev
1155
1528
  ).returns(T.attached_class)
1156
1529
  end
1157
1530
  def self.new(
1158
- # Webhook URL events are delivered to. Slack incoming webhook URLs are
1159
- # automatically formatted as Slack messages.
1531
+ # Public HTTP(S) URL that receives events. Slack and GovSlack URLs get formatted
1532
+ # messages.
1160
1533
  url:,
1161
- # Events delivered to this endpoint. `change.detected` fires only when a run
1162
- # detects a change; `run.completed` fires on every completed run — including runs
1163
- # that detected no change — and embeds the change when one was detected. Defaults
1164
- # to `["change.detected"]` when omitted.
1534
+ # Events to deliver. Defaults to `change.detected`; `run.completed` also includes
1535
+ # unchanged runs.
1165
1536
  events: nil,
1166
1537
  # Webhook retry settings. Use {} for the default schedule.
1167
1538
  retry_: nil,
1168
- # Signing secret used to verify webhook authenticity. Omitted unless the API key
1169
- # has monitors:write permission or full access. Each delivery includes an
1170
- # `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
1171
- # `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
1172
- # compare and reject stale timestamps to prevent replay. Generated by the API;
1173
- # cannot be set by clients.
1539
+ # API-generated signing secret. Visible only with full access or `monitors:write`
1540
+ # permission.
1174
1541
  secret: nil
1175
1542
  )
1176
1543
  end