context.dev 2.1.0 → 2.3.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 (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/client.rb +7 -2
  5. data/lib/context_dev/internal/type/base_model.rb +5 -5
  6. data/lib/context_dev/models/monitor_create_params.rb +44 -14
  7. data/lib/context_dev/models/monitor_create_response.rb +112 -15
  8. data/lib/context_dev/models/monitor_list_account_runs_response.rb +23 -1
  9. data/lib/context_dev/models/monitor_list_response.rb +116 -15
  10. data/lib/context_dev/models/monitor_list_runs_response.rb +23 -1
  11. data/lib/context_dev/models/monitor_retrieve_change_response.rb +10 -10
  12. data/lib/context_dev/models/monitor_retrieve_response.rb +113 -15
  13. data/lib/context_dev/models/monitor_update_params.rb +44 -14
  14. data/lib/context_dev/models/monitor_update_response.rb +112 -15
  15. data/lib/context_dev/models/parse_handle_params.rb +110 -0
  16. data/lib/context_dev/models/parse_handle_response.rb +132 -0
  17. data/lib/context_dev/models/web_web_crawl_md_params.rb +16 -6
  18. data/lib/context_dev/models/web_web_scrape_html_params.rb +16 -6
  19. data/lib/context_dev/models/web_web_scrape_md_params.rb +16 -6
  20. data/lib/context_dev/models/web_web_scrape_md_response.rb +11 -1
  21. data/lib/context_dev/models/webhook_delivery.rb +109 -0
  22. data/lib/context_dev/models.rb +4 -0
  23. data/lib/context_dev/resources/monitors.rb +3 -2
  24. data/lib/context_dev/resources/parse.rb +63 -0
  25. data/lib/context_dev/resources/web.rb +19 -4
  26. data/lib/context_dev/version.rb +1 -1
  27. data/lib/context_dev.rb +4 -0
  28. data/rbi/context_dev/client.rbi +6 -2
  29. data/rbi/context_dev/models/monitor_create_params.rbi +106 -16
  30. data/rbi/context_dev/models/monitor_create_response.rbi +255 -17
  31. data/rbi/context_dev/models/monitor_list_account_runs_response.rbi +39 -3
  32. data/rbi/context_dev/models/monitor_list_response.rbi +256 -16
  33. data/rbi/context_dev/models/monitor_list_runs_response.rbi +39 -3
  34. data/rbi/context_dev/models/monitor_retrieve_change_response.rbi +12 -15
  35. data/rbi/context_dev/models/monitor_retrieve_response.rbi +255 -17
  36. data/rbi/context_dev/models/monitor_update_params.rbi +106 -16
  37. data/rbi/context_dev/models/monitor_update_response.rbi +255 -17
  38. data/rbi/context_dev/models/parse_handle_params.rbi +163 -0
  39. data/rbi/context_dev/models/parse_handle_response.rbi +377 -0
  40. data/rbi/context_dev/models/web_web_crawl_md_params.rbi +26 -7
  41. data/rbi/context_dev/models/web_web_scrape_html_params.rbi +26 -7
  42. data/rbi/context_dev/models/web_web_scrape_md_params.rbi +26 -7
  43. data/rbi/context_dev/models/web_web_scrape_md_response.rbi +12 -0
  44. data/rbi/context_dev/models/webhook_delivery.rbi +172 -0
  45. data/rbi/context_dev/models.rbi +4 -0
  46. data/rbi/context_dev/resources/monitors.rbi +3 -2
  47. data/rbi/context_dev/resources/parse.rbi +65 -0
  48. data/rbi/context_dev/resources/web.rbi +22 -7
  49. data/sig/context_dev/client.rbs +2 -0
  50. data/sig/context_dev/models/monitor_create_params.rbs +32 -3
  51. data/sig/context_dev/models/monitor_create_response.rbs +85 -6
  52. data/sig/context_dev/models/monitor_list_account_runs_response.rbs +21 -3
  53. data/sig/context_dev/models/monitor_list_response.rbs +85 -6
  54. data/sig/context_dev/models/monitor_list_runs_response.rbs +21 -3
  55. data/sig/context_dev/models/monitor_retrieve_change_response.rbs +8 -10
  56. data/sig/context_dev/models/monitor_retrieve_response.rbs +85 -6
  57. data/sig/context_dev/models/monitor_update_params.rbs +32 -3
  58. data/sig/context_dev/models/monitor_update_response.rbs +85 -6
  59. data/sig/context_dev/models/parse_handle_params.rbs +96 -0
  60. data/sig/context_dev/models/parse_handle_response.rbs +159 -0
  61. data/sig/context_dev/models/web_web_crawl_md_params.rbs +13 -2
  62. data/sig/context_dev/models/web_web_scrape_html_params.rbs +13 -2
  63. data/sig/context_dev/models/web_web_scrape_md_params.rbs +13 -2
  64. data/sig/context_dev/models/web_web_scrape_md_response.rbs +5 -0
  65. data/sig/context_dev/models/webhook_delivery.rbs +81 -0
  66. data/sig/context_dev/models.rbs +4 -0
  67. data/sig/context_dev/resources/parse.rbs +22 -0
  68. metadata +14 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25638d74c398495cbef201fdc8903b11a2e392ca235856c22af7281dadb1fcc2
4
- data.tar.gz: 1c0ca0f9323f6a4a16e050a9dcd80298e70d07db776b4d3876c8c3bb359d0b0f
3
+ metadata.gz: adde8335edf19dff9d76bc4d66ae8a7a6593a7fe76b77400f1dc7f1d0306b545
4
+ data.tar.gz: 06d1ea73b8472749a835d88c6bad7c433976e6f06b5e7e873b42a9309b25df02
5
5
  SHA512:
6
- metadata.gz: 6e9ef0f156d49e0c907e8db8fcf8e5e2fe2986b83bbc92e84039664f7c6733ed719df0aa82a582af2a05046ee36a3c4e980ad6d6bd0bd64f3a887fa63237beb9
7
- data.tar.gz: 25fd60ebb92056db2ba5efaf793396255ed1661a69b3ae94d1683634294d575f364e0135592e23e8ff23c57482adcce67b35a72895e8058630941c468c35247f
6
+ metadata.gz: d827c5bb02c124f85f5c36d0eee5870d6612e2973b550272074b3c0a6be77f5254ec42383ce8273feb02eb7ecedf0391a6678919004dc392548d4ee7f99a195b
7
+ data.tar.gz: cc18411a99e00820eab476005adaacf0ac158cb8a0d0c4e88e9e566be24c8decb1e91e7610864a9568145b28c8a33e97396fa8d7e4f01bfbed76dccd4afccb99
data/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.3.0 (2026-07-12)
4
+
5
+ Full Changelog: [v2.2.0...v2.3.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v2.2.0...v2.3.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([3fd9604](https://github.com/context-dot-dev/context-ruby-sdk/commit/3fd960488c341f082b6d312dda927aeee23dccff))
10
+ * **api:** api update ([bdd3176](https://github.com/context-dot-dev/context-ruby-sdk/commit/bdd3176c7f507880adb7becae314b816c6bbe9bc))
11
+ * **api:** api update ([d68d31d](https://github.com/context-dot-dev/context-ruby-sdk/commit/d68d31dc5aa77ad154789b6cf91e0b8558353214))
12
+ * **api:** api update ([d4c601e](https://github.com/context-dot-dev/context-ruby-sdk/commit/d4c601ea30aa1d47ef041d0439ab8b5d976cc8e2))
13
+ * **api:** api update ([03fa3ac](https://github.com/context-dot-dev/context-ruby-sdk/commit/03fa3ac3c7c61aba88846db890bf4d3fd22d1086))
14
+ * **api:** api update ([626d105](https://github.com/context-dot-dev/context-ruby-sdk/commit/626d1054da9622e88469bb9c3b755f43d1d75280))
15
+ * **api:** manual updates ([b7f6b2c](https://github.com/context-dot-dev/context-ruby-sdk/commit/b7f6b2c0a5bb91cc065bcc2ef497c9999414262c))
16
+
17
+ ## 2.2.0 (2026-07-10)
18
+
19
+ Full Changelog: [v2.1.0...v2.2.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v2.1.0...v2.2.0)
20
+
21
+ ### Features
22
+
23
+ * **api:** api update ([04e3709](https://github.com/context-dot-dev/context-ruby-sdk/commit/04e370916ae9679892d86fc297e3c935afa1e2c2))
24
+ * **api:** api update ([59b7e62](https://github.com/context-dot-dev/context-ruby-sdk/commit/59b7e62e57eff7482db12fe2dd1a97298620b88f))
25
+
3
26
  ## 2.1.0 (2026-07-08)
4
27
 
5
28
  Full Changelog: [v2.0.0...v2.1.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v2.0.0...v2.1.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.1.0"
29
+ gem "context.dev", "~> 2.3.0"
30
30
  ```
31
31
 
32
32
  <!-- x-release-please-end -->
@@ -18,6 +18,9 @@ module ContextDev
18
18
  # @return [String]
19
19
  attr_reader :api_key
20
20
 
21
+ # @return [ContextDev::Resources::Parse]
22
+ attr_reader :parse
23
+
21
24
  # @return [ContextDev::Resources::Web]
22
25
  attr_reader :web
23
26
 
@@ -34,8 +37,9 @@ module ContextDev
34
37
  attr_reader :utility
35
38
 
36
39
  # Monitor pages, sitemaps, and extracted website data for exact or semantic
37
- # changes. The change.detected webhook payload is documented by the
38
- # MonitorsChangeDetectedWebhookPayload schema.
40
+ # changes. Webhook payloads are documented by the
41
+ # MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload
42
+ # schemas.
39
43
  # @return [ContextDev::Resources::Monitors]
40
44
  attr_reader :monitors
41
45
 
@@ -100,6 +104,7 @@ module ContextDev
100
104
  headers: headers
101
105
  )
102
106
 
107
+ @parse = ContextDev::Resources::Parse.new(client: self)
103
108
  @web = ContextDev::Resources::Web.new(client: self)
104
109
  @ai = ContextDev::Resources::AI.new(client: self)
105
110
  @brand = ContextDev::Resources::Brand.new(client: self)
@@ -438,11 +438,11 @@ module ContextDev
438
438
  # @return [Hash{Symbol=>Object}]
439
439
  #
440
440
  # @example
441
- # # `web_extract_response` is a `ContextDev::Models::WebExtractResponse`
442
- # web_extract_response => {
443
- # data: data,
444
- # metadata: metadata,
445
- # status: status
441
+ # # `parse_handle_response` is a `ContextDev::Models::ParseHandleResponse`
442
+ # parse_handle_response => {
443
+ # markdown: markdown,
444
+ # success: success,
445
+ # type: type
446
446
  # }
447
447
  def deconstruct_keys(keys)
448
448
  (keys || self.class.known_fields.keys)
@@ -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 to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`.
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
@@ -107,9 +107,9 @@ module ContextDev
107
107
  optional :confidence_threshold, Float
108
108
 
109
109
  # @!method initialize(confidence_threshold: nil, type: :semantic)
110
- # Detect meaning-level changes to the extracted data, ignoring cosmetic or
111
- # paraphrase-only differences. What is watched is determined by the extract
112
- # target's `schema` and `instructions`.
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).
113
113
  #
114
114
  # @param confidence_threshold [Float]
115
115
  # @param type [Symbol, :semantic]
@@ -187,7 +187,7 @@ module ContextDev
187
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.
188
188
  variant :sitemap, -> { ContextDev::MonitorCreateParams::Target::Sitemap }
189
189
 
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 against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl.
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.
191
191
  variant :extract, -> { ContextDev::MonitorCreateParams::Target::Extract }
192
192
 
193
193
  class Page < ContextDev::Internal::Type::BaseModel
@@ -302,9 +302,14 @@ module ContextDev
302
302
  optional :max_pages, Integer
303
303
 
304
304
  # @!attribute schema
305
- # JSON Schema describing the data you care about. It guides which pages are
306
- # selected for tracking and gives the change judge context on what matters. If
307
- # 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.
308
313
  #
309
314
  # @return [Hash{Symbol=>Object}, nil]
310
315
  optional :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown]
@@ -316,8 +321,8 @@ module ContextDev
316
321
  # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
317
322
  # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
318
323
  # track; each run re-checks exactly those pages, and confirmed content changes are
319
- # judged against the monitor's instructions. The tracked page set is refreshed by
320
- # a periodic re-discovery crawl.
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.
321
326
  #
322
327
  # @param instructions [String] Natural-language instructions guiding which pages and facts to track and which c
323
328
  #
@@ -329,7 +334,7 @@ module ContextDev
329
334
  #
330
335
  # @param max_pages [Integer] Maximum number of pages to track.
331
336
  #
332
- # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It guides which pages are select
337
+ # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It is used three ways: it guides
333
338
  #
334
339
  # @param type [Symbol, :extract]
335
340
  end
@@ -351,13 +356,38 @@ module ContextDev
351
356
 
352
357
  class Webhook < ContextDev::Internal::Type::BaseModel
353
358
  # @!attribute url
354
- # Webhook URL called when a change is detected.
359
+ # Webhook URL events are delivered to.
355
360
  #
356
361
  # @return [String]
357
362
  required :url, String
358
363
 
359
- # @!method initialize(url:)
360
- # @param url [String] Webhook URL called when a change is detected.
364
+ # @!attribute events
365
+ # Events delivered to this endpoint. `change.detected` fires only when a run
366
+ # detects a change; `run.completed` fires on every completed run — including runs
367
+ # that detected no change — and embeds the change when one was detected. Defaults
368
+ # to `["change.detected"]` when omitted.
369
+ #
370
+ # @return [Array<Symbol, ContextDev::Models::MonitorCreateParams::Webhook::Event>, nil]
371
+ optional :events,
372
+ -> { ContextDev::Internal::Type::ArrayOf[enum: ContextDev::MonitorCreateParams::Webhook::Event] }
373
+
374
+ # @!method initialize(url:, events: nil)
375
+ # Some parameter documentations has been truncated, see
376
+ # {ContextDev::Models::MonitorCreateParams::Webhook} for more details.
377
+ #
378
+ # @param url [String] Webhook URL events are delivered to.
379
+ #
380
+ # @param events [Array<Symbol, ContextDev::Models::MonitorCreateParams::Webhook::Event>] Events delivered to this endpoint. `change.detected` fires only when a run detec
381
+
382
+ module Event
383
+ extend ContextDev::Internal::Type::Enum
384
+
385
+ CHANGE_DETECTED = :"change.detected"
386
+ RUN_COMPLETED = :"run.completed"
387
+
388
+ # @!method self.values
389
+ # @return [Array<Symbol>]
390
+ end
361
391
  end
362
392
  end
363
393
  end
@@ -103,7 +103,15 @@ module ContextDev
103
103
  # @return [ContextDev::Models::MonitorCreateResponse::Webhook, nil]
104
104
  optional :webhook, -> { ContextDev::Models::MonitorCreateResponse::Webhook }, nil?: true
105
105
 
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)
106
+ # @!attribute webhook_failure
107
+ # Present while webhook deliveries are failing consecutively; null when deliveries
108
+ # are healthy or no webhook is configured. Cleared on the next successful delivery
109
+ # and when the webhook URL changes.
110
+ #
111
+ # @return [ContextDev::Models::MonitorCreateResponse::WebhookFailure, nil]
112
+ optional :webhook_failure, -> { ContextDev::Models::MonitorCreateResponse::WebhookFailure }, nil?: true
113
+
114
+ # @!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, webhook_failure: nil)
107
115
  # Some parameter documentations has been truncated, see
108
116
  # {ContextDev::Models::MonitorCreateResponse} for more details.
109
117
  #
@@ -141,6 +149,8 @@ module ContextDev
141
149
  # @param tags [Array<String>] User-defined tags for grouping and filtering monitors and their changes.
142
150
  #
143
151
  # @param webhook [ContextDev::Models::MonitorCreateResponse::Webhook, nil]
152
+ #
153
+ # @param webhook_failure [ContextDev::Models::MonitorCreateResponse::WebhookFailure, nil] Present while webhook deliveries are failing consecutively; null when deliveries
144
154
 
145
155
  # Discriminated union describing how changes are detected.
146
156
  #
@@ -153,7 +163,7 @@ module ContextDev
153
163
  # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
154
164
  variant :exact, -> { ContextDev::Models::MonitorCreateResponse::ChangeDetection::Exact }
155
165
 
156
- # Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`.
166
+ # 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).
157
167
  variant :semantic, -> { ContextDev::Models::MonitorCreateResponse::ChangeDetection::Semantic }
158
168
 
159
169
  class Exact < ContextDev::Internal::Type::BaseModel
@@ -181,9 +191,9 @@ module ContextDev
181
191
  optional :confidence_threshold, Float
182
192
 
183
193
  # @!method initialize(confidence_threshold: nil, type: :semantic)
184
- # Detect meaning-level changes to the extracted data, ignoring cosmetic or
185
- # paraphrase-only differences. What is watched is determined by the extract
186
- # target's `schema` and `instructions`.
194
+ # Detect meaning-level changes to tracked page content, ignoring cosmetic or
195
+ # paraphrase-only differences. Which changes are meaningful is judged against the
196
+ # extract target's `instructions` (and `schema`, when provided).
187
197
  #
188
198
  # @param confidence_threshold [Float]
189
199
  # @param type [Symbol, :semantic]
@@ -295,7 +305,7 @@ module ContextDev
295
305
  # 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.
296
306
  variant :sitemap, -> { ContextDev::Models::MonitorCreateResponse::Target::Sitemap }
297
307
 
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 against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl.
308
+ # 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.
299
309
  variant :extract, -> { ContextDev::Models::MonitorCreateResponse::Target::Extract }
300
310
 
301
311
  class Page < ContextDev::Internal::Type::BaseModel
@@ -410,9 +420,14 @@ module ContextDev
410
420
  optional :max_pages, Integer
411
421
 
412
422
  # @!attribute schema
413
- # JSON Schema describing the data you care about. It guides which pages are
414
- # selected for tracking and gives the change judge context on what matters. If
415
- # omitted, a default summary + key-points schema is used.
423
+ # JSON Schema describing the data you care about. It is used three ways: it guides
424
+ # which pages are selected for tracking, it gives the change judge extra context
425
+ # on which changes matter (alongside `instructions`), and it defines the shape of
426
+ # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
427
+ # about once a day). It is not a response format for changes: change events and
428
+ # webhook payloads always contain diffs, summaries, and evidence excerpts — never
429
+ # data in this schema's shape. If omitted, a default summary + key-points schema
430
+ # is used.
416
431
  #
417
432
  # @return [Hash{Symbol=>Object}, nil]
418
433
  optional :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown]
@@ -424,8 +439,8 @@ module ContextDev
424
439
  # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
425
440
  # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
426
441
  # track; each run re-checks exactly those pages, and confirmed content changes are
427
- # judged against the monitor's instructions. The tracked page set is refreshed by
428
- # a periodic re-discovery crawl.
442
+ # judged for relevance against the monitor's `instructions` (and `schema`, when
443
+ # provided). The tracked page set is refreshed by a periodic re-discovery crawl.
429
444
  #
430
445
  # @param instructions [String] Natural-language instructions guiding which pages and facts to track and which c
431
446
  #
@@ -437,7 +452,7 @@ module ContextDev
437
452
  #
438
453
  # @param max_pages [Integer] Maximum number of pages to track.
439
454
  #
440
- # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It guides which pages are select
455
+ # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It is used three ways: it guides
441
456
  #
442
457
  # @param type [Symbol, :extract]
443
458
  end
@@ -578,11 +593,21 @@ module ContextDev
578
593
  # @see ContextDev::Models::MonitorCreateResponse#webhook
579
594
  class Webhook < ContextDev::Internal::Type::BaseModel
580
595
  # @!attribute url
581
- # Webhook URL called when a change is detected.
596
+ # Webhook URL events are delivered to.
582
597
  #
583
598
  # @return [String]
584
599
  required :url, String
585
600
 
601
+ # @!attribute events
602
+ # Events delivered to this endpoint. `change.detected` fires only when a run
603
+ # detects a change; `run.completed` fires on every completed run — including runs
604
+ # that detected no change — and embeds the change when one was detected. Defaults
605
+ # to `["change.detected"]` when omitted.
606
+ #
607
+ # @return [Array<Symbol, ContextDev::Models::MonitorCreateResponse::Webhook::Event>, nil]
608
+ optional :events,
609
+ -> { ContextDev::Internal::Type::ArrayOf[enum: ContextDev::Models::MonitorCreateResponse::Webhook::Event] }
610
+
586
611
  response_only do
587
612
  # @!attribute secret
588
613
  # Signing secret used to verify webhook authenticity. Each delivery includes an
@@ -595,13 +620,85 @@ module ContextDev
595
620
  optional :secret, String
596
621
  end
597
622
 
598
- # @!method initialize(url:, secret: nil)
623
+ # @!method initialize(url:, events: nil, secret: nil)
599
624
  # Some parameter documentations has been truncated, see
600
625
  # {ContextDev::Models::MonitorCreateResponse::Webhook} for more details.
601
626
  #
602
- # @param url [String] Webhook URL called when a change is detected.
627
+ # @param url [String] Webhook URL events are delivered to.
628
+ #
629
+ # @param events [Array<Symbol, ContextDev::Models::MonitorCreateResponse::Webhook::Event>] Events delivered to this endpoint. `change.detected` fires only when a run detec
603
630
  #
604
631
  # @param secret [String] Signing secret used to verify webhook authenticity. Each delivery includes an `X
632
+
633
+ module Event
634
+ extend ContextDev::Internal::Type::Enum
635
+
636
+ CHANGE_DETECTED = :"change.detected"
637
+ RUN_COMPLETED = :"run.completed"
638
+
639
+ # @!method self.values
640
+ # @return [Array<Symbol>]
641
+ end
642
+ end
643
+
644
+ # @see ContextDev::Models::MonitorCreateResponse#webhook_failure
645
+ class WebhookFailure < ContextDev::Internal::Type::BaseModel
646
+ # @!attribute consecutive_failures
647
+ # Number of consecutive delivery attempts that did not succeed.
648
+ #
649
+ # @return [Integer]
650
+ required :consecutive_failures, Integer
651
+
652
+ # @!attribute last_failed_at
653
+ #
654
+ # @return [Time]
655
+ required :last_failed_at, Time
656
+
657
+ # @!attribute last_message
658
+ # Human-readable description of the most recent failure.
659
+ #
660
+ # @return [String]
661
+ required :last_message, String
662
+
663
+ # @!attribute last_status
664
+ # Outcome of the most recent failed delivery. rejected means a non-2xx response;
665
+ # failed means no HTTP response was received; skipped_unsafe_url means the URL
666
+ # failed the public-endpoint safety check.
667
+ #
668
+ # @return [Symbol, ContextDev::Models::MonitorCreateResponse::WebhookFailure::LastStatus]
669
+ required :last_status, enum: -> { ContextDev::Models::MonitorCreateResponse::WebhookFailure::LastStatus }
670
+
671
+ # @!method initialize(consecutive_failures:, last_failed_at:, last_message:, last_status:)
672
+ # Some parameter documentations has been truncated, see
673
+ # {ContextDev::Models::MonitorCreateResponse::WebhookFailure} for more details.
674
+ #
675
+ # Present while webhook deliveries are failing consecutively; null when deliveries
676
+ # are healthy or no webhook is configured. Cleared on the next successful delivery
677
+ # and when the webhook URL changes.
678
+ #
679
+ # @param consecutive_failures [Integer] Number of consecutive delivery attempts that did not succeed.
680
+ #
681
+ # @param last_failed_at [Time]
682
+ #
683
+ # @param last_message [String] Human-readable description of the most recent failure.
684
+ #
685
+ # @param last_status [Symbol, ContextDev::Models::MonitorCreateResponse::WebhookFailure::LastStatus] Outcome of the most recent failed delivery. rejected means a non-2xx response; f
686
+
687
+ # Outcome of the most recent failed delivery. rejected means a non-2xx response;
688
+ # failed means no HTTP response was received; skipped_unsafe_url means the URL
689
+ # failed the public-endpoint safety check.
690
+ #
691
+ # @see ContextDev::Models::MonitorCreateResponse::WebhookFailure#last_status
692
+ module LastStatus
693
+ extend ContextDev::Internal::Type::Enum
694
+
695
+ REJECTED = :rejected
696
+ FAILED = :failed
697
+ SKIPPED_UNSAFE_URL = :skipped_unsafe_url
698
+
699
+ # @!method self.values
700
+ # @return [Array<Symbol>]
701
+ end
605
702
  end
606
703
  end
607
704
  end
@@ -106,7 +106,25 @@ module ContextDev
106
106
  # @return [Time, nil]
107
107
  optional :started_at, Time, nil?: true
108
108
 
109
- # @!method initialize(id:, baseline_created:, change_detected:, change_detection_type:, credits_charged:, monitor_id:, run_type:, status:, target_type:, change_id: nil, completed_at: nil, error: nil, skip_reason: nil, started_at: nil)
109
+ # @!attribute webhook_deliveries
110
+ # All webhook deliveries attempted by this run — one per subscribed event that
111
+ # fired. Omitted when no webhook was attempted, including runs created before
112
+ # event selection was added.
113
+ #
114
+ # @return [Array<ContextDev::Models::WebhookDelivery>, nil]
115
+ optional :webhook_deliveries, -> { ContextDev::Internal::Type::ArrayOf[ContextDev::WebhookDelivery] }
116
+
117
+ # @!attribute webhook_delivery
118
+ # @deprecated
119
+ #
120
+ # Deprecated: use `webhook_deliveries`, which records every attempt now that a run
121
+ # can deliver multiple events. Omitted when no webhook was attempted, including
122
+ # historical runs created before delivery tracking was added.
123
+ #
124
+ # @return [ContextDev::Models::WebhookDelivery, nil]
125
+ optional :webhook_delivery, -> { ContextDev::WebhookDelivery }
126
+
127
+ # @!method initialize(id:, baseline_created:, change_detected:, change_detection_type:, credits_charged:, monitor_id:, run_type:, status:, target_type:, change_id: nil, completed_at: nil, error: nil, skip_reason: nil, started_at: nil, webhook_deliveries: nil, webhook_delivery: nil)
110
128
  # Some parameter documentations has been truncated, see
111
129
  # {ContextDev::Models::MonitorListAccountRunsResponse::Data} for more details.
112
130
  #
@@ -137,6 +155,10 @@ module ContextDev
137
155
  # @param skip_reason [Symbol, ContextDev::Models::MonitorListAccountRunsResponse::Data::SkipReason, nil] Why a skipped run never executed; null unless status is `skipped`.
138
156
  #
139
157
  # @param started_at [Time, nil]
158
+ #
159
+ # @param webhook_deliveries [Array<ContextDev::Models::WebhookDelivery>] All webhook deliveries attempted by this run — one per subscribed event that fir
160
+ #
161
+ # @param webhook_delivery [ContextDev::Models::WebhookDelivery] Deprecated: use `webhook_deliveries`, which records every attempt now that a run
140
162
 
141
163
  # @see ContextDev::Models::MonitorListAccountRunsResponse::Data#change_detection_type
142
164
  module ChangeDetectionType