context.dev 2.0.0 → 2.2.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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/models/brand_retrieve_params.rb +46 -3
  5. data/lib/context_dev/models/monitor_create_params.rb +36 -28
  6. data/lib/context_dev/models/monitor_create_response.rb +158 -29
  7. data/lib/context_dev/models/monitor_list_account_runs_response.rb +102 -1
  8. data/lib/context_dev/models/monitor_list_params.rb +4 -4
  9. data/lib/context_dev/models/monitor_list_response.rb +158 -29
  10. data/lib/context_dev/models/monitor_list_runs_response.rb +100 -1
  11. data/lib/context_dev/models/monitor_retrieve_change_response.rb +1 -8
  12. data/lib/context_dev/models/monitor_retrieve_response.rb +158 -29
  13. data/lib/context_dev/models/monitor_update_params.rb +36 -28
  14. data/lib/context_dev/models/monitor_update_response.rb +158 -29
  15. data/lib/context_dev/resources/brand.rb +4 -2
  16. data/lib/context_dev/resources/monitors.rb +1 -1
  17. data/lib/context_dev/version.rb +1 -1
  18. data/rbi/context_dev/models/brand_retrieve_params.rbi +67 -0
  19. data/rbi/context_dev/models/monitor_create_params.rbi +44 -33
  20. data/rbi/context_dev/models/monitor_create_response.rbi +243 -33
  21. data/rbi/context_dev/models/monitor_list_account_runs_response.rbi +204 -3
  22. data/rbi/context_dev/models/monitor_list_params.rbi +9 -6
  23. data/rbi/context_dev/models/monitor_list_response.rbi +247 -33
  24. data/rbi/context_dev/models/monitor_list_runs_response.rbi +204 -3
  25. data/rbi/context_dev/models/monitor_retrieve_change_response.rbi +0 -9
  26. data/rbi/context_dev/models/monitor_retrieve_response.rbi +243 -33
  27. data/rbi/context_dev/models/monitor_update_params.rbi +44 -33
  28. data/rbi/context_dev/models/monitor_update_response.rbi +243 -33
  29. data/rbi/context_dev/resources/brand.rbi +4 -1
  30. data/rbi/context_dev/resources/monitors.rbi +2 -2
  31. data/sig/context_dev/models/brand_retrieve_params.rbs +26 -0
  32. data/sig/context_dev/models/monitor_create_params.rbs +7 -17
  33. data/sig/context_dev/models/monitor_create_response.rbs +81 -17
  34. data/sig/context_dev/models/monitor_list_account_runs_response.rbs +74 -3
  35. data/sig/context_dev/models/monitor_list_params.rbs +2 -2
  36. data/sig/context_dev/models/monitor_list_response.rbs +81 -17
  37. data/sig/context_dev/models/monitor_list_runs_response.rbs +74 -3
  38. data/sig/context_dev/models/monitor_retrieve_change_response.rbs +0 -7
  39. data/sig/context_dev/models/monitor_retrieve_response.rbs +81 -17
  40. data/sig/context_dev/models/monitor_update_params.rbs +7 -17
  41. data/sig/context_dev/models/monitor_update_response.rbs +81 -17
  42. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b06afdbe71226ae880bbb9b13c6194a4d40a71f00c8b91aefb4002979a34526
4
- data.tar.gz: '0875fff31bf997194426e47578e394cb4d81d5d7fb8c1d7cd04fb0eb01d91d93'
3
+ metadata.gz: 71a15fd21461c08a07aee8a7a0b03646393d119834f5977c703fa504a3fef780
4
+ data.tar.gz: cb91bfce1cc1e42798249e1a08001bbdf881ef37c0c9832783d7e511e721bd58
5
5
  SHA512:
6
- metadata.gz: a59b9d17c502c0b0b06975cdf1e01863769a718af42f4b607150fe873e02a5a603801598d298c7567b6c4e66643dd860731251bec2d1145ed8921ac15f14dc5a
7
- data.tar.gz: 40843ad53f7f8abd5a6d504b13ee30a27027990df9ed1b5e41c78627fa79f868b4108d78e7b93dc4b187f8bc2eae49b1d036a03b5f3dfa8dba8dfb4b6a7f12fc
6
+ metadata.gz: 3720fb3277c71cf83c1b01867e7cfb956e4b0588e421c23b5ef36fb7c715c5d4a94678e3de49ec83ab268628b1fccfa3b1f526f6a08ba459c213292930ebbe41
7
+ data.tar.gz: 60494a702cba70b719ef8e83f4d410d3e4a59af67cb0d0e478b7061646ba87702605505d8c09c311b8dd8d2fdd8bd60caf684a17904229291fcc1e29b9696e02
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.2.0 (2026-07-10)
4
+
5
+ Full Changelog: [v2.1.0...v2.2.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v2.1.0...v2.2.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([04e3709](https://github.com/context-dot-dev/context-ruby-sdk/commit/04e370916ae9679892d86fc297e3c935afa1e2c2))
10
+ * **api:** api update ([59b7e62](https://github.com/context-dot-dev/context-ruby-sdk/commit/59b7e62e57eff7482db12fe2dd1a97298620b88f))
11
+
12
+ ## 2.1.0 (2026-07-08)
13
+
14
+ Full Changelog: [v2.0.0...v2.1.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v2.0.0...v2.1.0)
15
+
16
+ ### Features
17
+
18
+ * **api:** api update ([7fe6a1f](https://github.com/context-dot-dev/context-ruby-sdk/commit/7fe6a1fbd2977c0669b7623ba96533b43789b8ae))
19
+ * **api:** api update ([cd5b872](https://github.com/context-dot-dev/context-ruby-sdk/commit/cd5b8725dcd7fb06d7bd684aa4ce11b81ca4409a))
20
+ * **api:** api update ([bdc4962](https://github.com/context-dot-dev/context-ruby-sdk/commit/bdc4962f436086be52293ea489960b6b6158726b))
21
+ * **api:** api update ([531ccbe](https://github.com/context-dot-dev/context-ruby-sdk/commit/531ccbeb9770c4340641353859064b50aa6d72bc))
22
+
3
23
  ## 2.0.0 (2026-07-06)
4
24
 
5
25
  Full Changelog: [v1.36.0...v2.0.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.36.0...v2.0.0)
data/README.md CHANGED
@@ -26,7 +26,7 @@ To use this gem, install via Bundler by adding the following to your application
26
26
  <!-- x-release-please-start-version -->
27
27
 
28
28
  ```ruby
29
- gem "context.dev", "~> 2.0.0"
29
+ gem "context.dev", "~> 2.2.0"
30
30
  ```
31
31
 
32
32
  <!-- x-release-please-end -->
@@ -10,11 +10,11 @@ module ContextDev
10
10
  # @!attribute body
11
11
  # Exactly one lookup type must be provided.
12
12
  #
13
- # @return [ContextDev::Models::BrandRetrieveParams::Body::ByDomain, ContextDev::Models::BrandRetrieveParams::Body::ByName, ContextDev::Models::BrandRetrieveParams::Body::ByEmail, ContextDev::Models::BrandRetrieveParams::Body::ByTicker, ContextDev::Models::BrandRetrieveParams::Body::ByTransaction]
13
+ # @return [ContextDev::Models::BrandRetrieveParams::Body::ByDomain, ContextDev::Models::BrandRetrieveParams::Body::ByName, ContextDev::Models::BrandRetrieveParams::Body::ByEmail, ContextDev::Models::BrandRetrieveParams::Body::ByTicker, ContextDev::Models::BrandRetrieveParams::Body::ByDirectURL, ContextDev::Models::BrandRetrieveParams::Body::ByTransaction]
14
14
  required :body, union: -> { ContextDev::BrandRetrieveParams::Body }
15
15
 
16
16
  # @!method initialize(body:, request_options: {})
17
- # @param body [ContextDev::Models::BrandRetrieveParams::Body::ByDomain, ContextDev::Models::BrandRetrieveParams::Body::ByName, ContextDev::Models::BrandRetrieveParams::Body::ByEmail, ContextDev::Models::BrandRetrieveParams::Body::ByTicker, ContextDev::Models::BrandRetrieveParams::Body::ByTransaction] Exactly one lookup type must be provided.
17
+ # @param body [ContextDev::Models::BrandRetrieveParams::Body::ByDomain, ContextDev::Models::BrandRetrieveParams::Body::ByName, ContextDev::Models::BrandRetrieveParams::Body::ByEmail, ContextDev::Models::BrandRetrieveParams::Body::ByTicker, ContextDev::Models::BrandRetrieveParams::Body::ByDirectURL, ContextDev::Models::BrandRetrieveParams::Body::ByTransaction] Exactly one lookup type must be provided.
18
18
  #
19
19
  # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]
20
20
 
@@ -36,6 +36,9 @@ module ContextDev
36
36
  # Retrieve brand data by stock ticker. Cannot be combined with domain, name, or email.
37
37
  variant :by_ticker, -> { ContextDev::BrandRetrieveParams::Body::ByTicker }
38
38
 
39
+ # Retrieve brand data by fetching the provided URL directly. Note: if you use this, brand data is fetched only from the provided URL — not from the entire internet — so results are limited to what that single page contains. No domain resolution, database lookup, or cross-source enrichment is performed. Cannot be combined with domain, name, email, or ticker.
40
+ variant :by_direct_url, -> { ContextDev::BrandRetrieveParams::Body::ByDirectURL }
41
+
39
42
  # Identify brand data from a transaction descriptor. Cannot be combined with domain, name, email, or ticker.
40
43
  variant :by_transaction, -> { ContextDev::BrandRetrieveParams::Body::ByTransaction }
41
44
 
@@ -824,6 +827,46 @@ module ContextDev
824
827
  end
825
828
  end
826
829
 
830
+ class ByDirectURL < ContextDev::Internal::Type::BaseModel
831
+ # @!attribute direct_url
832
+ # Full http(s) URL to fetch brand data from (e.g.,
833
+ # 'https://stripe.com/enterprise'). Only this URL is fetched — not the entire
834
+ # internet.
835
+ #
836
+ # @return [String]
837
+ required :direct_url, String
838
+
839
+ # @!attribute type
840
+ # Discriminator for direct-URL-based brand retrieval.
841
+ #
842
+ # @return [Symbol, :by_direct_url]
843
+ required :type, const: :by_direct_url
844
+
845
+ # @!attribute timeout_ms
846
+ # Optional timeout in milliseconds for the request. If the request takes longer
847
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
848
+ # value is 300000ms (5 minutes).
849
+ #
850
+ # @return [Integer, nil]
851
+ optional :timeout_ms, Integer, api_name: :timeoutMS
852
+
853
+ # @!method initialize(direct_url:, timeout_ms: nil, type: :by_direct_url)
854
+ # Some parameter documentations has been truncated, see
855
+ # {ContextDev::Models::BrandRetrieveParams::Body::ByDirectURL} for more details.
856
+ #
857
+ # Retrieve brand data by fetching the provided URL directly. Note: if you use
858
+ # this, brand data is fetched only from the provided URL — not from the entire
859
+ # internet — so results are limited to what that single page contains. No domain
860
+ # resolution, database lookup, or cross-source enrichment is performed. Cannot be
861
+ # combined with domain, name, email, or ticker.
862
+ #
863
+ # @param direct_url [String] Full http(s) URL to fetch brand data from (e.g., 'https://stripe.com/enterprise'
864
+ #
865
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
866
+ #
867
+ # @param type [Symbol, :by_direct_url] Discriminator for direct-URL-based brand retrieval.
868
+ end
869
+
827
870
  class ByTransaction < ContextDev::Internal::Type::BaseModel
828
871
  # @!attribute transaction_info
829
872
  # Transaction information to identify the brand.
@@ -1049,7 +1092,7 @@ module ContextDev
1049
1092
  end
1050
1093
 
1051
1094
  # @!method self.variants
1052
- # @return [Array(ContextDev::Models::BrandRetrieveParams::Body::ByDomain, ContextDev::Models::BrandRetrieveParams::Body::ByName, ContextDev::Models::BrandRetrieveParams::Body::ByEmail, ContextDev::Models::BrandRetrieveParams::Body::ByTicker, ContextDev::Models::BrandRetrieveParams::Body::ByTransaction)]
1095
+ # @return [Array(ContextDev::Models::BrandRetrieveParams::Body::ByDomain, ContextDev::Models::BrandRetrieveParams::Body::ByName, ContextDev::Models::BrandRetrieveParams::Body::ByEmail, ContextDev::Models::BrandRetrieveParams::Body::ByTicker, ContextDev::Models::BrandRetrieveParams::Body::ByDirectURL, ContextDev::Models::BrandRetrieveParams::Body::ByTransaction)]
1053
1096
  end
1054
1097
  end
1055
1098
  end
@@ -79,7 +79,7 @@ module ContextDev
79
79
  # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
80
80
  variant :exact, -> { ContextDev::MonitorCreateParams::ChangeDetection::Exact }
81
81
 
82
- # Detect meaning-level changes that match a natural language query.
82
+ # Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided).
83
83
  variant :semantic, -> { ContextDev::MonitorCreateParams::ChangeDetection::Semantic }
84
84
 
85
85
  class Exact < ContextDev::Internal::Type::BaseModel
@@ -96,11 +96,6 @@ module ContextDev
96
96
  end
97
97
 
98
98
  class Semantic < ContextDev::Internal::Type::BaseModel
99
- # @!attribute query
100
- #
101
- # @return [String]
102
- required :query, String
103
-
104
99
  # @!attribute type
105
100
  #
106
101
  # @return [Symbol, :semantic]
@@ -111,10 +106,11 @@ module ContextDev
111
106
  # @return [Float, nil]
112
107
  optional :confidence_threshold, Float
113
108
 
114
- # @!method initialize(query:, confidence_threshold: nil, type: :semantic)
115
- # Detect meaning-level changes that match a natural language query.
109
+ # @!method initialize(confidence_threshold: nil, type: :semantic)
110
+ # Detect meaning-level changes to tracked page content, ignoring cosmetic or
111
+ # paraphrase-only differences. Which changes are meaningful is judged against the
112
+ # extract target's `instructions` (and `schema`, when provided).
116
113
  #
117
- # @param query [String]
118
114
  # @param confidence_threshold [Float]
119
115
  # @param type [Symbol, :semantic]
120
116
  end
@@ -188,10 +184,10 @@ module ContextDev
188
184
  # Watch a single web page.
189
185
  variant :page, -> { ContextDev::MonitorCreateParams::Target::Page }
190
186
 
191
- # Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps.
187
+ # Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps.
192
188
  variant :sitemap, -> { ContextDev::MonitorCreateParams::Target::Sitemap }
193
189
 
194
- # Watch a site's extracted structured data.
190
+ # Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged for relevance against the monitor's `instructions` (and `schema`, when provided). The tracked page set is refreshed by a periodic re-discovery crawl.
195
191
  variant :extract, -> { ContextDev::MonitorCreateParams::Target::Extract }
196
192
 
197
193
  class Page < ContextDev::Internal::Type::BaseModel
@@ -254,8 +250,9 @@ module ContextDev
254
250
  # @!method initialize(url:, exclude: nil, include: nil, max_urls: nil, type: :sitemap)
255
251
  # Watch a sitemap for URL additions and removals. Crawled URLs are normalized
256
252
  # (lowercased host, no trailing slash/fragment) and scoped to the monitored site
257
- # and its subdomains before comparison. A new URL set must be observed on two
258
- # consecutive runs before a change is reported, suppressing one-run crawl flaps.
253
+ # and its subdomains before comparison. On a detected difference the sitemap is
254
+ # re-fetched within the same run and only URLs both observations agree on are
255
+ # reported, suppressing transient crawl flaps.
259
256
  #
260
257
  # @param url [String] Sitemap URL to monitor.
261
258
  #
@@ -269,6 +266,13 @@ module ContextDev
269
266
  end
270
267
 
271
268
  class Extract < ContextDev::Internal::Type::BaseModel
269
+ # @!attribute instructions
270
+ # Natural-language instructions guiding which pages and facts to track and which
271
+ # changes to report.
272
+ #
273
+ # @return [String]
274
+ required :instructions, String
275
+
272
276
  # @!attribute type
273
277
  #
274
278
  # @return [Symbol, :extract]
@@ -285,12 +289,6 @@ module ContextDev
285
289
  # @return [Boolean, nil]
286
290
  optional :follow_subdomains, ContextDev::Internal::Type::Boolean
287
291
 
288
- # @!attribute instructions
289
- # Optional natural-language instructions guiding what to extract.
290
- #
291
- # @return [String, nil]
292
- optional :instructions, String
293
-
294
292
  # @!attribute max_depth
295
293
  # Optional maximum link depth from the starting URL (0 = only the starting page).
296
294
  #
@@ -298,35 +296,45 @@ module ContextDev
298
296
  optional :max_depth, Integer
299
297
 
300
298
  # @!attribute max_pages
301
- # Maximum number of pages to analyze during extraction.
299
+ # Maximum number of pages to track.
302
300
  #
303
301
  # @return [Integer, nil]
304
302
  optional :max_pages, Integer
305
303
 
306
304
  # @!attribute schema
307
- # JSON Schema describing the structured data to extract and watch for changes. If
308
- # omitted, a default summary + key-points schema is used.
305
+ # JSON Schema describing the data you care about. It is used three ways: it guides
306
+ # which pages are selected for tracking, it gives the change judge extra context
307
+ # on which changes matter (alongside `instructions`), and it defines the shape of
308
+ # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
309
+ # about once a day). It is not a response format for changes: change events and
310
+ # webhook payloads always contain diffs, summaries, and evidence excerpts — never
311
+ # data in this schema's shape. If omitted, a default summary + key-points schema
312
+ # is used.
309
313
  #
310
314
  # @return [Hash{Symbol=>Object}, nil]
311
315
  optional :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown]
312
316
 
313
- # @!method initialize(url:, follow_subdomains: nil, instructions: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract)
317
+ # @!method initialize(instructions:, url:, follow_subdomains: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract)
314
318
  # Some parameter documentations has been truncated, see
315
319
  # {ContextDev::Models::MonitorCreateParams::Target::Extract} for more details.
316
320
  #
317
- # Watch a site's extracted structured data.
321
+ # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
322
+ # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
323
+ # track; each run re-checks exactly those pages, and confirmed content changes are
324
+ # judged for relevance against the monitor's `instructions` (and `schema`, when
325
+ # provided). The tracked page set is refreshed by a periodic re-discovery crawl.
326
+ #
327
+ # @param instructions [String] Natural-language instructions guiding which pages and facts to track and which c
318
328
  #
319
329
  # @param url [String] Root URL to extract structured data from.
320
330
  #
321
331
  # @param follow_subdomains [Boolean]
322
332
  #
323
- # @param instructions [String] Optional natural-language instructions guiding what to extract.
324
- #
325
333
  # @param max_depth [Integer] Optional maximum link depth from the starting URL (0 = only the starting page).
326
334
  #
327
- # @param max_pages [Integer] Maximum number of pages to analyze during extraction.
335
+ # @param max_pages [Integer] Maximum number of pages to track.
328
336
  #
329
- # @param schema [Hash{Symbol=>Object}] JSON Schema describing the structured data to extract and watch for changes. If
337
+ # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It is used three ways: it guides
330
338
  #
331
339
  # @param type [Symbol, :extract]
332
340
  end
@@ -61,6 +61,15 @@ module ContextDev
61
61
  # @return [Time]
62
62
  required :updated_at, Time
63
63
 
64
+ # @!attribute baseline
65
+ # Current baseline: the last observed value the monitor compares new snapshots
66
+ # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
67
+ # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
68
+ # after a target or change_detection update, which resets the baseline).
69
+ #
70
+ # @return [ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsExtractBaseline, nil]
71
+ optional :baseline, union: -> { ContextDev::Models::MonitorCreateResponse::Baseline }, nil?: true
72
+
64
73
  # @!attribute last_change_at
65
74
  #
66
75
  # @return [Time, nil]
@@ -94,7 +103,7 @@ module ContextDev
94
103
  # @return [ContextDev::Models::MonitorCreateResponse::Webhook, nil]
95
104
  optional :webhook, -> { ContextDev::Models::MonitorCreateResponse::Webhook }, nil?: true
96
105
 
97
- # @!method initialize(id:, change_detection:, created_at:, mode:, name:, schedule:, status:, target:, updated_at:, last_change_at: nil, last_error: nil, last_run_at: nil, next_run_at: nil, tags: nil, webhook: nil)
106
+ # @!method initialize(id:, change_detection:, created_at:, mode:, name:, schedule:, status:, target:, updated_at:, baseline: nil, last_change_at: nil, last_error: nil, last_run_at: nil, next_run_at: nil, tags: nil, webhook: nil)
98
107
  # Some parameter documentations has been truncated, see
99
108
  # {ContextDev::Models::MonitorCreateResponse} for more details.
100
109
  #
@@ -119,6 +128,8 @@ module ContextDev
119
128
  #
120
129
  # @param updated_at [Time]
121
130
  #
131
+ # @param baseline [ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsExtractBaseline, nil] Current baseline: the last observed value the monitor compares new snapshots aga
132
+ #
122
133
  # @param last_change_at [Time, nil]
123
134
  #
124
135
  # @param last_error [ContextDev::Models::MonitorCreateResponse::LastError, nil] Error from the most recent failed run; null when the last run succeeded.
@@ -142,7 +153,7 @@ module ContextDev
142
153
  # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
143
154
  variant :exact, -> { ContextDev::Models::MonitorCreateResponse::ChangeDetection::Exact }
144
155
 
145
- # Detect meaning-level changes that match a natural language query.
156
+ # Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided).
146
157
  variant :semantic, -> { ContextDev::Models::MonitorCreateResponse::ChangeDetection::Semantic }
147
158
 
148
159
  class Exact < ContextDev::Internal::Type::BaseModel
@@ -159,11 +170,6 @@ module ContextDev
159
170
  end
160
171
 
161
172
  class Semantic < ContextDev::Internal::Type::BaseModel
162
- # @!attribute query
163
- #
164
- # @return [String]
165
- required :query, String
166
-
167
173
  # @!attribute type
168
174
  #
169
175
  # @return [Symbol, :semantic]
@@ -174,10 +180,11 @@ module ContextDev
174
180
  # @return [Float, nil]
175
181
  optional :confidence_threshold, Float
176
182
 
177
- # @!method initialize(query:, confidence_threshold: nil, type: :semantic)
178
- # Detect meaning-level changes that match a natural language query.
183
+ # @!method initialize(confidence_threshold: nil, type: :semantic)
184
+ # Detect meaning-level changes to tracked page content, ignoring cosmetic or
185
+ # paraphrase-only differences. Which changes are meaningful is judged against the
186
+ # extract target's `instructions` (and `schema`, when provided).
179
187
  #
180
- # @param query [String]
181
188
  # @param confidence_threshold [Float]
182
189
  # @param type [Symbol, :semantic]
183
190
  end
@@ -285,10 +292,10 @@ module ContextDev
285
292
  # Watch a single web page.
286
293
  variant :page, -> { ContextDev::Models::MonitorCreateResponse::Target::Page }
287
294
 
288
- # Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps.
295
+ # Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps.
289
296
  variant :sitemap, -> { ContextDev::Models::MonitorCreateResponse::Target::Sitemap }
290
297
 
291
- # Watch a site's extracted structured data.
298
+ # Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged for relevance against the monitor's `instructions` (and `schema`, when provided). The tracked page set is refreshed by a periodic re-discovery crawl.
292
299
  variant :extract, -> { ContextDev::Models::MonitorCreateResponse::Target::Extract }
293
300
 
294
301
  class Page < ContextDev::Internal::Type::BaseModel
@@ -351,8 +358,9 @@ module ContextDev
351
358
  # @!method initialize(url:, exclude: nil, include: nil, max_urls: nil, type: :sitemap)
352
359
  # Watch a sitemap for URL additions and removals. Crawled URLs are normalized
353
360
  # (lowercased host, no trailing slash/fragment) and scoped to the monitored site
354
- # and its subdomains before comparison. A new URL set must be observed on two
355
- # consecutive runs before a change is reported, suppressing one-run crawl flaps.
361
+ # and its subdomains before comparison. On a detected difference the sitemap is
362
+ # re-fetched within the same run and only URLs both observations agree on are
363
+ # reported, suppressing transient crawl flaps.
356
364
  #
357
365
  # @param url [String] Sitemap URL to monitor.
358
366
  #
@@ -366,6 +374,13 @@ module ContextDev
366
374
  end
367
375
 
368
376
  class Extract < ContextDev::Internal::Type::BaseModel
377
+ # @!attribute instructions
378
+ # Natural-language instructions guiding which pages and facts to track and which
379
+ # changes to report.
380
+ #
381
+ # @return [String]
382
+ required :instructions, String
383
+
369
384
  # @!attribute type
370
385
  #
371
386
  # @return [Symbol, :extract]
@@ -382,12 +397,6 @@ module ContextDev
382
397
  # @return [Boolean, nil]
383
398
  optional :follow_subdomains, ContextDev::Internal::Type::Boolean
384
399
 
385
- # @!attribute instructions
386
- # Optional natural-language instructions guiding what to extract.
387
- #
388
- # @return [String, nil]
389
- optional :instructions, String
390
-
391
400
  # @!attribute max_depth
392
401
  # Optional maximum link depth from the starting URL (0 = only the starting page).
393
402
  #
@@ -395,35 +404,45 @@ module ContextDev
395
404
  optional :max_depth, Integer
396
405
 
397
406
  # @!attribute max_pages
398
- # Maximum number of pages to analyze during extraction.
407
+ # Maximum number of pages to track.
399
408
  #
400
409
  # @return [Integer, nil]
401
410
  optional :max_pages, Integer
402
411
 
403
412
  # @!attribute schema
404
- # JSON Schema describing the structured data to extract and watch for changes. If
405
- # omitted, a default summary + key-points schema is used.
413
+ # JSON Schema describing the data you care about. It is used three ways: it guides
414
+ # which pages are selected for tracking, it gives the change judge extra context
415
+ # on which changes matter (alongside `instructions`), and it defines the shape of
416
+ # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
417
+ # about once a day). It is not a response format for changes: change events and
418
+ # webhook payloads always contain diffs, summaries, and evidence excerpts — never
419
+ # data in this schema's shape. If omitted, a default summary + key-points schema
420
+ # is used.
406
421
  #
407
422
  # @return [Hash{Symbol=>Object}, nil]
408
423
  optional :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown]
409
424
 
410
- # @!method initialize(url:, follow_subdomains: nil, instructions: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract)
425
+ # @!method initialize(instructions:, url:, follow_subdomains: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract)
411
426
  # Some parameter documentations has been truncated, see
412
427
  # {ContextDev::Models::MonitorCreateResponse::Target::Extract} for more details.
413
428
  #
414
- # Watch a site's extracted structured data.
429
+ # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
430
+ # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
431
+ # track; each run re-checks exactly those pages, and confirmed content changes are
432
+ # judged for relevance against the monitor's `instructions` (and `schema`, when
433
+ # provided). The tracked page set is refreshed by a periodic re-discovery crawl.
434
+ #
435
+ # @param instructions [String] Natural-language instructions guiding which pages and facts to track and which c
415
436
  #
416
437
  # @param url [String] Root URL to extract structured data from.
417
438
  #
418
439
  # @param follow_subdomains [Boolean]
419
440
  #
420
- # @param instructions [String] Optional natural-language instructions guiding what to extract.
421
- #
422
441
  # @param max_depth [Integer] Optional maximum link depth from the starting URL (0 = only the starting page).
423
442
  #
424
- # @param max_pages [Integer] Maximum number of pages to analyze during extraction.
443
+ # @param max_pages [Integer] Maximum number of pages to track.
425
444
  #
426
- # @param schema [Hash{Symbol=>Object}] JSON Schema describing the structured data to extract and watch for changes. If
445
+ # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It is used three ways: it guides
427
446
  #
428
447
  # @param type [Symbol, :extract]
429
448
  end
@@ -432,6 +451,116 @@ module ContextDev
432
451
  # @return [Array(ContextDev::Models::MonitorCreateResponse::Target::Page, ContextDev::Models::MonitorCreateResponse::Target::Sitemap, ContextDev::Models::MonitorCreateResponse::Target::Extract)]
433
452
  end
434
453
 
454
+ # Current baseline: the last observed value the monitor compares new snapshots
455
+ # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
456
+ # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
457
+ # after a target or change_detection update, which resets the baseline).
458
+ #
459
+ # @see ContextDev::Models::MonitorCreateResponse#baseline
460
+ module Baseline
461
+ extend ContextDev::Internal::Type::Union
462
+
463
+ # Current baseline of a `page` monitor: the visible page text as last observed.
464
+ variant -> { ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsPageBaseline }
465
+
466
+ # Current baseline of a `sitemap` monitor: the normalized URL set as last observed.
467
+ variant -> { ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsSitemapBaseline }
468
+
469
+ # Current baseline of an `extract` monitor: the pages it tracks and the structured data as last extracted.
470
+ variant -> { ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsExtractBaseline }
471
+
472
+ class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel
473
+ # @!attribute captured_at
474
+ # When this baseline was last captured or replaced.
475
+ #
476
+ # @return [Time]
477
+ required :captured_at, Time
478
+
479
+ # @!attribute text
480
+ # The page's visible text as last observed.
481
+ #
482
+ # @return [String]
483
+ required :text, String
484
+
485
+ # @!method initialize(captured_at:, text:)
486
+ # Current baseline of a `page` monitor: the visible page text as last observed.
487
+ #
488
+ # @param captured_at [Time] When this baseline was last captured or replaced.
489
+ #
490
+ # @param text [String] The page's visible text as last observed.
491
+ end
492
+
493
+ class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel
494
+ # @!attribute captured_at
495
+ # When this baseline was last captured or replaced.
496
+ #
497
+ # @return [Time]
498
+ required :captured_at, Time
499
+
500
+ # @!attribute url_count
501
+ # Number of URLs in the baseline.
502
+ #
503
+ # @return [Integer]
504
+ required :url_count, Integer
505
+
506
+ # @!attribute urls
507
+ # The sitemap URLs as last observed (sorted, normalized).
508
+ #
509
+ # @return [Array<String>]
510
+ required :urls, ContextDev::Internal::Type::ArrayOf[String]
511
+
512
+ # @!method initialize(captured_at:, url_count:, urls:)
513
+ # Current baseline of a `sitemap` monitor: the normalized URL set as last
514
+ # observed.
515
+ #
516
+ # @param captured_at [Time] When this baseline was last captured or replaced.
517
+ #
518
+ # @param url_count [Integer] Number of URLs in the baseline.
519
+ #
520
+ # @param urls [Array<String>] The sitemap URLs as last observed (sorted, normalized).
521
+ end
522
+
523
+ class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel
524
+ # @!attribute captured_at
525
+ # When this baseline was last captured or replaced.
526
+ #
527
+ # @return [Time]
528
+ required :captured_at, Time
529
+
530
+ # @!attribute data
531
+ # The extracted structured data, matching the monitor's extraction schema (same
532
+ # shape as the /web/extract endpoint's `data`). Refreshed when the monitor
533
+ # re-discovers its page set (at most about once a day); `null` when no extraction
534
+ # has been captured yet.
535
+ #
536
+ # @return [Object]
537
+ required :data, ContextDev::Internal::Type::Unknown
538
+
539
+ # @!attribute urls_analyzed
540
+ # The page URLs the monitor tracks and analyzes for changes.
541
+ #
542
+ # @return [Array<String>]
543
+ required :urls_analyzed, ContextDev::Internal::Type::ArrayOf[String]
544
+
545
+ # @!method initialize(captured_at:, data:, urls_analyzed:)
546
+ # Some parameter documentations has been truncated, see
547
+ # {ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsExtractBaseline}
548
+ # for more details.
549
+ #
550
+ # Current baseline of an `extract` monitor: the pages it tracks and the structured
551
+ # data as last extracted.
552
+ #
553
+ # @param captured_at [Time] When this baseline was last captured or replaced.
554
+ #
555
+ # @param data [Object] The extracted structured data, matching the monitor's extraction schema (same sh
556
+ #
557
+ # @param urls_analyzed [Array<String>] The page URLs the monitor tracks and analyzes for changes.
558
+ end
559
+
560
+ # @!method self.variants
561
+ # @return [Array(ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsExtractBaseline)]
562
+ end
563
+
435
564
  # @see ContextDev::Models::MonitorCreateResponse#last_error
436
565
  class LastError < ContextDev::Internal::Type::BaseModel
437
566
  # @!attribute code