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
@@ -124,7 +124,17 @@ module ContextDev
124
124
  # @return [ContextDev::Models::MonitorListResponse::Data::Webhook, nil]
125
125
  optional :webhook, -> { ContextDev::Models::MonitorListResponse::Data::Webhook }, nil?: true
126
126
 
127
- # @!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)
127
+ # @!attribute webhook_failure
128
+ # Present while webhook deliveries are failing consecutively; null when deliveries
129
+ # are healthy or no webhook is configured. Cleared on the next successful delivery
130
+ # and when the webhook URL changes.
131
+ #
132
+ # @return [ContextDev::Models::MonitorListResponse::Data::WebhookFailure, nil]
133
+ optional :webhook_failure,
134
+ -> { ContextDev::Models::MonitorListResponse::Data::WebhookFailure },
135
+ nil?: true
136
+
137
+ # @!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)
128
138
  # Some parameter documentations has been truncated, see
129
139
  # {ContextDev::Models::MonitorListResponse::Data} for more details.
130
140
  #
@@ -162,6 +172,8 @@ module ContextDev
162
172
  # @param tags [Array<String>] User-defined tags for grouping and filtering monitors and their changes.
163
173
  #
164
174
  # @param webhook [ContextDev::Models::MonitorListResponse::Data::Webhook, nil]
175
+ #
176
+ # @param webhook_failure [ContextDev::Models::MonitorListResponse::Data::WebhookFailure, nil] Present while webhook deliveries are failing consecutively; null when deliveries
165
177
 
166
178
  # Discriminated union describing how changes are detected.
167
179
  #
@@ -174,7 +186,7 @@ module ContextDev
174
186
  # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
175
187
  variant :exact, -> { ContextDev::Models::MonitorListResponse::Data::ChangeDetection::Exact }
176
188
 
177
- # 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`.
189
+ # 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).
178
190
  variant :semantic, -> { ContextDev::Models::MonitorListResponse::Data::ChangeDetection::Semantic }
179
191
 
180
192
  class Exact < ContextDev::Internal::Type::BaseModel
@@ -202,9 +214,9 @@ module ContextDev
202
214
  optional :confidence_threshold, Float
203
215
 
204
216
  # @!method initialize(confidence_threshold: nil, type: :semantic)
205
- # Detect meaning-level changes to the extracted data, ignoring cosmetic or
206
- # paraphrase-only differences. What is watched is determined by the extract
207
- # target's `schema` and `instructions`.
217
+ # Detect meaning-level changes to tracked page content, ignoring cosmetic or
218
+ # paraphrase-only differences. Which changes are meaningful is judged against the
219
+ # extract target's `instructions` (and `schema`, when provided).
208
220
  #
209
221
  # @param confidence_threshold [Float]
210
222
  # @param type [Symbol, :semantic]
@@ -316,7 +328,7 @@ module ContextDev
316
328
  # 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.
317
329
  variant :sitemap, -> { ContextDev::Models::MonitorListResponse::Data::Target::Sitemap }
318
330
 
319
- # 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.
331
+ # 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.
320
332
  variant :extract, -> { ContextDev::Models::MonitorListResponse::Data::Target::Extract }
321
333
 
322
334
  class Page < ContextDev::Internal::Type::BaseModel
@@ -431,9 +443,14 @@ module ContextDev
431
443
  optional :max_pages, Integer
432
444
 
433
445
  # @!attribute schema
434
- # JSON Schema describing the data you care about. It guides which pages are
435
- # selected for tracking and gives the change judge context on what matters. If
436
- # omitted, a default summary + key-points schema is used.
446
+ # JSON Schema describing the data you care about. It is used three ways: it guides
447
+ # which pages are selected for tracking, it gives the change judge extra context
448
+ # on which changes matter (alongside `instructions`), and it defines the shape of
449
+ # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
450
+ # about once a day). It is not a response format for changes: change events and
451
+ # webhook payloads always contain diffs, summaries, and evidence excerpts — never
452
+ # data in this schema's shape. If omitted, a default summary + key-points schema
453
+ # is used.
437
454
  #
438
455
  # @return [Hash{Symbol=>Object}, nil]
439
456
  optional :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown]
@@ -446,8 +463,8 @@ module ContextDev
446
463
  # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
447
464
  # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
448
465
  # track; each run re-checks exactly those pages, and confirmed content changes are
449
- # judged against the monitor's instructions. The tracked page set is refreshed by
450
- # a periodic re-discovery crawl.
466
+ # judged for relevance against the monitor's `instructions` (and `schema`, when
467
+ # provided). The tracked page set is refreshed by a periodic re-discovery crawl.
451
468
  #
452
469
  # @param instructions [String] Natural-language instructions guiding which pages and facts to track and which c
453
470
  #
@@ -459,7 +476,7 @@ module ContextDev
459
476
  #
460
477
  # @param max_pages [Integer] Maximum number of pages to track.
461
478
  #
462
- # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It guides which pages are select
479
+ # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It is used three ways: it guides
463
480
  #
464
481
  # @param type [Symbol, :extract]
465
482
  end
@@ -600,11 +617,21 @@ module ContextDev
600
617
  # @see ContextDev::Models::MonitorListResponse::Data#webhook
601
618
  class Webhook < ContextDev::Internal::Type::BaseModel
602
619
  # @!attribute url
603
- # Webhook URL called when a change is detected.
620
+ # Webhook URL events are delivered to.
604
621
  #
605
622
  # @return [String]
606
623
  required :url, String
607
624
 
625
+ # @!attribute events
626
+ # Events delivered to this endpoint. `change.detected` fires only when a run
627
+ # detects a change; `run.completed` fires on every completed run — including runs
628
+ # that detected no change — and embeds the change when one was detected. Defaults
629
+ # to `["change.detected"]` when omitted.
630
+ #
631
+ # @return [Array<Symbol, ContextDev::Models::MonitorListResponse::Data::Webhook::Event>, nil]
632
+ optional :events,
633
+ -> { ContextDev::Internal::Type::ArrayOf[enum: ContextDev::Models::MonitorListResponse::Data::Webhook::Event] }
634
+
608
635
  response_only do
609
636
  # @!attribute secret
610
637
  # Signing secret used to verify webhook authenticity. Each delivery includes an
@@ -617,13 +644,87 @@ module ContextDev
617
644
  optional :secret, String
618
645
  end
619
646
 
620
- # @!method initialize(url:, secret: nil)
647
+ # @!method initialize(url:, events: nil, secret: nil)
621
648
  # Some parameter documentations has been truncated, see
622
649
  # {ContextDev::Models::MonitorListResponse::Data::Webhook} for more details.
623
650
  #
624
- # @param url [String] Webhook URL called when a change is detected.
651
+ # @param url [String] Webhook URL events are delivered to.
652
+ #
653
+ # @param events [Array<Symbol, ContextDev::Models::MonitorListResponse::Data::Webhook::Event>] Events delivered to this endpoint. `change.detected` fires only when a run detec
625
654
  #
626
655
  # @param secret [String] Signing secret used to verify webhook authenticity. Each delivery includes an `X
656
+
657
+ module Event
658
+ extend ContextDev::Internal::Type::Enum
659
+
660
+ CHANGE_DETECTED = :"change.detected"
661
+ RUN_COMPLETED = :"run.completed"
662
+
663
+ # @!method self.values
664
+ # @return [Array<Symbol>]
665
+ end
666
+ end
667
+
668
+ # @see ContextDev::Models::MonitorListResponse::Data#webhook_failure
669
+ class WebhookFailure < ContextDev::Internal::Type::BaseModel
670
+ # @!attribute consecutive_failures
671
+ # Number of consecutive delivery attempts that did not succeed.
672
+ #
673
+ # @return [Integer]
674
+ required :consecutive_failures, Integer
675
+
676
+ # @!attribute last_failed_at
677
+ #
678
+ # @return [Time]
679
+ required :last_failed_at, Time
680
+
681
+ # @!attribute last_message
682
+ # Human-readable description of the most recent failure.
683
+ #
684
+ # @return [String]
685
+ required :last_message, String
686
+
687
+ # @!attribute last_status
688
+ # Outcome of the most recent failed delivery. rejected means a non-2xx response;
689
+ # failed means no HTTP response was received; skipped_unsafe_url means the URL
690
+ # failed the public-endpoint safety check.
691
+ #
692
+ # @return [Symbol, ContextDev::Models::MonitorListResponse::Data::WebhookFailure::LastStatus]
693
+ required :last_status,
694
+ enum: -> { ContextDev::Models::MonitorListResponse::Data::WebhookFailure::LastStatus }
695
+
696
+ # @!method initialize(consecutive_failures:, last_failed_at:, last_message:, last_status:)
697
+ # Some parameter documentations has been truncated, see
698
+ # {ContextDev::Models::MonitorListResponse::Data::WebhookFailure} for more
699
+ # details.
700
+ #
701
+ # Present while webhook deliveries are failing consecutively; null when deliveries
702
+ # are healthy or no webhook is configured. Cleared on the next successful delivery
703
+ # and when the webhook URL changes.
704
+ #
705
+ # @param consecutive_failures [Integer] Number of consecutive delivery attempts that did not succeed.
706
+ #
707
+ # @param last_failed_at [Time]
708
+ #
709
+ # @param last_message [String] Human-readable description of the most recent failure.
710
+ #
711
+ # @param last_status [Symbol, ContextDev::Models::MonitorListResponse::Data::WebhookFailure::LastStatus] Outcome of the most recent failed delivery. rejected means a non-2xx response; f
712
+
713
+ # Outcome of the most recent failed delivery. rejected means a non-2xx response;
714
+ # failed means no HTTP response was received; skipped_unsafe_url means the URL
715
+ # failed the public-endpoint safety check.
716
+ #
717
+ # @see ContextDev::Models::MonitorListResponse::Data::WebhookFailure#last_status
718
+ module LastStatus
719
+ extend ContextDev::Internal::Type::Enum
720
+
721
+ REJECTED = :rejected
722
+ FAILED = :failed
723
+ SKIPPED_UNSAFE_URL = :skipped_unsafe_url
724
+
725
+ # @!method self.values
726
+ # @return [Array<Symbol>]
727
+ end
627
728
  end
628
729
  end
629
730
  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::MonitorListRunsResponse::Data} for more details.
112
130
  #
@@ -137,6 +155,10 @@ module ContextDev
137
155
  # @param skip_reason [Symbol, ContextDev::Models::MonitorListRunsResponse::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::MonitorListRunsResponse::Data#change_detection_type
142
164
  module ChangeDetectionType
@@ -43,6 +43,12 @@ module ContextDev
43
43
  # @return [String]
44
44
  required :summary, String
45
45
 
46
+ # @!attribute tags
47
+ # User-defined tags for grouping and filtering monitors and their changes.
48
+ #
49
+ # @return [Array<String>]
50
+ required :tags, ContextDev::Internal::Type::ArrayOf[String]
51
+
46
52
  # @!attribute target_type
47
53
  #
48
54
  # @return [Symbol, ContextDev::Models::MonitorRetrieveChangeResponse::TargetType]
@@ -123,13 +129,7 @@ module ContextDev
123
129
  # @return [Array<String>, nil]
124
130
  optional :removed_urls, ContextDev::Internal::Type::ArrayOf[String]
125
131
 
126
- # @!attribute tags
127
- # User-defined tags for grouping and filtering monitors and their changes.
128
- #
129
- # @return [Array<String>, nil]
130
- optional :tags, ContextDev::Internal::Type::ArrayOf[String]
131
-
132
- # @!method initialize(id:, change_detection_type:, detected_at:, mode:, monitor_id:, run_id:, summary:, target_type:, title:, url:, added_url_count: nil, added_urls: nil, after_text_excerpt: nil, before_text_excerpt: nil, confidence: nil, diff: nil, evidence: nil, importance: nil, matched_url_count: nil, matched_urls: nil, removed_url_count: nil, removed_urls: nil, tags: nil)
132
+ # @!method initialize(id:, change_detection_type:, detected_at:, mode:, monitor_id:, run_id:, summary:, tags:, target_type:, title:, url:, added_url_count: nil, added_urls: nil, after_text_excerpt: nil, before_text_excerpt: nil, confidence: nil, diff: nil, evidence: nil, importance: nil, matched_url_count: nil, matched_urls: nil, removed_url_count: nil, removed_urls: nil)
133
133
  # Some parameter documentations has been truncated, see
134
134
  # {ContextDev::Models::MonitorRetrieveChangeResponse} for more details.
135
135
  #
@@ -137,7 +137,7 @@ module ContextDev
137
137
  # `change_detection_type` describe the change, and which optional fields are
138
138
  # present depends on them (page: `diff` + excerpts; sitemap:
139
139
  # `added_urls`/`removed_urls`; semantic:
140
- # `query`/`confidence`/`importance`/`evidence`/`matched_urls`).
140
+ # `confidence`/`importance`/`evidence`/`matched_urls`).
141
141
  #
142
142
  # @param id [String]
143
143
  #
@@ -153,6 +153,8 @@ module ContextDev
153
153
  #
154
154
  # @param summary [String]
155
155
  #
156
+ # @param tags [Array<String>] User-defined tags for grouping and filtering monitors and their changes.
157
+ #
156
158
  # @param target_type [Symbol, ContextDev::Models::MonitorRetrieveChangeResponse::TargetType]
157
159
  #
158
160
  # @param title [String]
@@ -182,8 +184,6 @@ module ContextDev
182
184
  # @param removed_url_count [Integer]
183
185
  #
184
186
  # @param removed_urls [Array<String>] At most 500 URLs are included; the corresponding count field is always exact.
185
- #
186
- # @param tags [Array<String>] User-defined tags for grouping and filtering monitors and their changes.
187
187
 
188
188
  # @see ContextDev::Models::MonitorRetrieveChangeResponse#change_detection_type
189
189
  module ChangeDetectionType
@@ -103,7 +103,15 @@ module ContextDev
103
103
  # @return [ContextDev::Models::MonitorRetrieveResponse::Webhook, nil]
104
104
  optional :webhook, -> { ContextDev::Models::MonitorRetrieveResponse::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::MonitorRetrieveResponse::WebhookFailure, nil]
112
+ optional :webhook_failure, -> { ContextDev::Models::MonitorRetrieveResponse::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::MonitorRetrieveResponse} 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::MonitorRetrieveResponse::Webhook, nil]
152
+ #
153
+ # @param webhook_failure [ContextDev::Models::MonitorRetrieveResponse::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::MonitorRetrieveResponse::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::MonitorRetrieveResponse::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::MonitorRetrieveResponse::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::MonitorRetrieveResponse::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::MonitorRetrieveResponse#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::MonitorRetrieveResponse::Webhook::Event>, nil]
608
+ optional :events,
609
+ -> { ContextDev::Internal::Type::ArrayOf[enum: ContextDev::Models::MonitorRetrieveResponse::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,86 @@ 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::MonitorRetrieveResponse::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::MonitorRetrieveResponse::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::MonitorRetrieveResponse#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::MonitorRetrieveResponse::WebhookFailure::LastStatus]
669
+ required :last_status,
670
+ enum: -> { ContextDev::Models::MonitorRetrieveResponse::WebhookFailure::LastStatus }
671
+
672
+ # @!method initialize(consecutive_failures:, last_failed_at:, last_message:, last_status:)
673
+ # Some parameter documentations has been truncated, see
674
+ # {ContextDev::Models::MonitorRetrieveResponse::WebhookFailure} for more details.
675
+ #
676
+ # Present while webhook deliveries are failing consecutively; null when deliveries
677
+ # are healthy or no webhook is configured. Cleared on the next successful delivery
678
+ # and when the webhook URL changes.
679
+ #
680
+ # @param consecutive_failures [Integer] Number of consecutive delivery attempts that did not succeed.
681
+ #
682
+ # @param last_failed_at [Time]
683
+ #
684
+ # @param last_message [String] Human-readable description of the most recent failure.
685
+ #
686
+ # @param last_status [Symbol, ContextDev::Models::MonitorRetrieveResponse::WebhookFailure::LastStatus] Outcome of the most recent failed delivery. rejected means a non-2xx response; f
687
+
688
+ # Outcome of the most recent failed delivery. rejected means a non-2xx response;
689
+ # failed means no HTTP response was received; skipped_unsafe_url means the URL
690
+ # failed the public-endpoint safety check.
691
+ #
692
+ # @see ContextDev::Models::MonitorRetrieveResponse::WebhookFailure#last_status
693
+ module LastStatus
694
+ extend ContextDev::Internal::Type::Enum
695
+
696
+ REJECTED = :rejected
697
+ FAILED = :failed
698
+ SKIPPED_UNSAFE_URL = :skipped_unsafe_url
699
+
700
+ # @!method self.values
701
+ # @return [Array<Symbol>]
702
+ end
605
703
  end
606
704
  end
607
705
  end
@@ -85,7 +85,7 @@ module ContextDev
85
85
  # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
86
86
  variant :exact, -> { ContextDev::MonitorUpdateParams::ChangeDetection::Exact }
87
87
 
88
- # 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`.
88
+ # 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).
89
89
  variant :semantic, -> { ContextDev::MonitorUpdateParams::ChangeDetection::Semantic }
90
90
 
91
91
  class Exact < ContextDev::Internal::Type::BaseModel
@@ -113,9 +113,9 @@ module ContextDev
113
113
  optional :confidence_threshold, Float
114
114
 
115
115
  # @!method initialize(confidence_threshold: nil, type: :semantic)
116
- # Detect meaning-level changes to the extracted data, ignoring cosmetic or
117
- # paraphrase-only differences. What is watched is determined by the extract
118
- # target's `schema` and `instructions`.
116
+ # Detect meaning-level changes to tracked page content, ignoring cosmetic or
117
+ # paraphrase-only differences. Which changes are meaningful is judged against the
118
+ # extract target's `instructions` (and `schema`, when provided).
119
119
  #
120
120
  # @param confidence_threshold [Float]
121
121
  # @param type [Symbol, :semantic]
@@ -203,7 +203,7 @@ module ContextDev
203
203
  # 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.
204
204
  variant :sitemap, -> { ContextDev::MonitorUpdateParams::Target::Sitemap }
205
205
 
206
- # 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.
206
+ # 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.
207
207
  variant :extract, -> { ContextDev::MonitorUpdateParams::Target::Extract }
208
208
 
209
209
  class Page < ContextDev::Internal::Type::BaseModel
@@ -318,9 +318,14 @@ module ContextDev
318
318
  optional :max_pages, Integer
319
319
 
320
320
  # @!attribute schema
321
- # JSON Schema describing the data you care about. It guides which pages are
322
- # selected for tracking and gives the change judge context on what matters. If
323
- # omitted, a default summary + key-points schema is used.
321
+ # JSON Schema describing the data you care about. It is used three ways: it guides
322
+ # which pages are selected for tracking, it gives the change judge extra context
323
+ # on which changes matter (alongside `instructions`), and it defines the shape of
324
+ # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
325
+ # about once a day). It is not a response format for changes: change events and
326
+ # webhook payloads always contain diffs, summaries, and evidence excerpts — never
327
+ # data in this schema's shape. If omitted, a default summary + key-points schema
328
+ # is used.
324
329
  #
325
330
  # @return [Hash{Symbol=>Object}, nil]
326
331
  optional :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown]
@@ -332,8 +337,8 @@ module ContextDev
332
337
  # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
333
338
  # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
334
339
  # track; each run re-checks exactly those pages, and confirmed content changes are
335
- # judged against the monitor's instructions. The tracked page set is refreshed by
336
- # a periodic re-discovery crawl.
340
+ # judged for relevance against the monitor's `instructions` (and `schema`, when
341
+ # provided). The tracked page set is refreshed by a periodic re-discovery crawl.
337
342
  #
338
343
  # @param instructions [String] Natural-language instructions guiding which pages and facts to track and which c
339
344
  #
@@ -345,7 +350,7 @@ module ContextDev
345
350
  #
346
351
  # @param max_pages [Integer] Maximum number of pages to track.
347
352
  #
348
- # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It guides which pages are select
353
+ # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It is used three ways: it guides
349
354
  #
350
355
  # @param type [Symbol, :extract]
351
356
  end
@@ -356,15 +361,40 @@ module ContextDev
356
361
 
357
362
  class Webhook < ContextDev::Internal::Type::BaseModel
358
363
  # @!attribute url
359
- # Webhook URL called when a change is detected.
364
+ # Webhook URL events are delivered to.
360
365
  #
361
366
  # @return [String]
362
367
  required :url, String
363
368
 
364
- # @!method initialize(url:)
369
+ # @!attribute events
370
+ # Events delivered to this endpoint. `change.detected` fires only when a run
371
+ # detects a change; `run.completed` fires on every completed run — including runs
372
+ # that detected no change — and embeds the change when one was detected. Defaults
373
+ # to `["change.detected"]` when omitted.
374
+ #
375
+ # @return [Array<Symbol, ContextDev::Models::MonitorUpdateParams::Webhook::Event>, nil]
376
+ optional :events,
377
+ -> { ContextDev::Internal::Type::ArrayOf[enum: ContextDev::MonitorUpdateParams::Webhook::Event] }
378
+
379
+ # @!method initialize(url:, events: nil)
380
+ # Some parameter documentations has been truncated, see
381
+ # {ContextDev::Models::MonitorUpdateParams::Webhook} for more details.
382
+ #
365
383
  # Set to null to remove the webhook.
366
384
  #
367
- # @param url [String] Webhook URL called when a change is detected.
385
+ # @param url [String] Webhook URL events are delivered to.
386
+ #
387
+ # @param events [Array<Symbol, ContextDev::Models::MonitorUpdateParams::Webhook::Event>] Events delivered to this endpoint. `change.detected` fires only when a run detec
388
+
389
+ module Event
390
+ extend ContextDev::Internal::Type::Enum
391
+
392
+ CHANGE_DETECTED = :"change.detected"
393
+ RUN_COMPLETED = :"run.completed"
394
+
395
+ # @!method self.values
396
+ # @return [Array<Symbol>]
397
+ end
368
398
  end
369
399
  end
370
400
  end