context.dev 2.5.0 → 2.7.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 (94) 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 +4 -0
  5. data/lib/context_dev/models/batch_cancel_params.rb +22 -0
  6. data/lib/context_dev/models/batch_cancel_response.rb +241 -0
  7. data/lib/context_dev/models/batch_get_results_params.rb +42 -0
  8. data/lib/context_dev/models/batch_get_results_response.rb +463 -0
  9. data/lib/context_dev/models/batch_list_params.rb +94 -0
  10. data/lib/context_dev/models/batch_list_response.rb +379 -0
  11. data/lib/context_dev/models/batch_retrieve_params.rb +22 -0
  12. data/lib/context_dev/models/batch_retrieve_response.rb +373 -0
  13. data/lib/context_dev/models/batch_submit_params.rb +56 -0
  14. data/lib/context_dev/models/batch_submit_response.rb +614 -0
  15. data/lib/context_dev/models/crawl_controls.rb +126 -0
  16. data/lib/context_dev/models/failure.rb +27 -0
  17. data/lib/context_dev/models/intake.rb +62 -0
  18. data/lib/context_dev/models/monitor_create_params.rb +141 -127
  19. data/lib/context_dev/models/monitor_create_response.rb +34 -10
  20. data/lib/context_dev/models/monitor_list_response.rb +21 -7
  21. data/lib/context_dev/models/monitor_retrieve_response.rb +21 -7
  22. data/lib/context_dev/models/monitor_update_params.rb +21 -7
  23. data/lib/context_dev/models/monitor_update_response.rb +21 -7
  24. data/lib/context_dev/models/page_error_count.rb +26 -0
  25. data/lib/context_dev/models/web_screenshot_params.rb +5 -7
  26. data/lib/context_dev/models/web_web_crawl_md_params.rb +5 -7
  27. data/lib/context_dev/models/web_web_scrape_html_params.rb +5 -7
  28. data/lib/context_dev/models/web_web_scrape_html_response.rb +93 -1
  29. data/lib/context_dev/models/web_web_scrape_md_params.rb +5 -7
  30. data/lib/context_dev/models/web_web_scrape_md_response.rb +93 -1
  31. data/lib/context_dev/models.rb +18 -0
  32. data/lib/context_dev/resources/batch.rb +152 -0
  33. data/lib/context_dev/resources/monitors.rb +5 -5
  34. data/lib/context_dev/resources/web.rb +4 -4
  35. data/lib/context_dev/version.rb +1 -1
  36. data/lib/context_dev.rb +15 -0
  37. data/rbi/context_dev/client.rbi +3 -0
  38. data/rbi/context_dev/models/batch_cancel_params.rbi +40 -0
  39. data/rbi/context_dev/models/batch_cancel_response.rbi +424 -0
  40. data/rbi/context_dev/models/batch_get_results_params.rbi +70 -0
  41. data/rbi/context_dev/models/batch_get_results_response.rbi +848 -0
  42. data/rbi/context_dev/models/batch_list_params.rbi +166 -0
  43. data/rbi/context_dev/models/batch_list_response.rbi +713 -0
  44. data/rbi/context_dev/models/batch_retrieve_params.rbi +40 -0
  45. data/rbi/context_dev/models/batch_retrieve_response.rbi +672 -0
  46. data/rbi/context_dev/models/batch_submit_params.rbi +105 -0
  47. data/rbi/context_dev/models/batch_submit_response.rbi +1330 -0
  48. data/rbi/context_dev/models/crawl_controls.rbi +252 -0
  49. data/rbi/context_dev/models/failure.rbi +35 -0
  50. data/rbi/context_dev/models/intake.rbi +88 -0
  51. data/rbi/context_dev/models/monitor_create_params.rbi +274 -242
  52. data/rbi/context_dev/models/monitor_create_response.rbi +38 -7
  53. data/rbi/context_dev/models/monitor_list_response.rbi +24 -5
  54. data/rbi/context_dev/models/monitor_retrieve_response.rbi +24 -5
  55. data/rbi/context_dev/models/monitor_update_params.rbi +24 -5
  56. data/rbi/context_dev/models/monitor_update_response.rbi +24 -5
  57. data/rbi/context_dev/models/page_error_count.rbi +34 -0
  58. data/rbi/context_dev/models/web_screenshot_params.rbi +6 -9
  59. data/rbi/context_dev/models/web_web_crawl_md_params.rbi +6 -9
  60. data/rbi/context_dev/models/web_web_scrape_html_params.rbi +6 -9
  61. data/rbi/context_dev/models/web_web_scrape_html_response.rbi +182 -0
  62. data/rbi/context_dev/models/web_web_scrape_md_params.rbi +6 -9
  63. data/rbi/context_dev/models/web_web_scrape_md_response.rbi +180 -0
  64. data/rbi/context_dev/models.rbi +18 -0
  65. data/rbi/context_dev/resources/batch.rbi +117 -0
  66. data/rbi/context_dev/resources/monitors.rbi +12 -12
  67. data/rbi/context_dev/resources/web.rbi +8 -12
  68. data/sig/context_dev/client.rbs +2 -0
  69. data/sig/context_dev/models/batch_cancel_params.rbs +23 -0
  70. data/sig/context_dev/models/batch_cancel_response.rbs +174 -0
  71. data/sig/context_dev/models/batch_get_results_params.rbs +36 -0
  72. data/sig/context_dev/models/batch_get_results_response.rbs +399 -0
  73. data/sig/context_dev/models/batch_list_params.rbs +94 -0
  74. data/sig/context_dev/models/batch_list_response.rbs +283 -0
  75. data/sig/context_dev/models/batch_retrieve_params.rbs +23 -0
  76. data/sig/context_dev/models/batch_retrieve_response.rbs +262 -0
  77. data/sig/context_dev/models/batch_submit_params.rbs +52 -0
  78. data/sig/context_dev/models/batch_submit_response.rbs +542 -0
  79. data/sig/context_dev/models/crawl_controls.rbs +114 -0
  80. data/sig/context_dev/models/failure.rbs +15 -0
  81. data/sig/context_dev/models/intake.rbs +40 -0
  82. data/sig/context_dev/models/monitor_create_params.rbs +117 -97
  83. data/sig/context_dev/models/monitor_create_response.rbs +18 -1
  84. data/sig/context_dev/models/monitor_list_response.rbs +13 -1
  85. data/sig/context_dev/models/monitor_retrieve_response.rbs +13 -1
  86. data/sig/context_dev/models/monitor_update_params.rbs +13 -1
  87. data/sig/context_dev/models/monitor_update_response.rbs +13 -1
  88. data/sig/context_dev/models/page_error_count.rbs +15 -0
  89. data/sig/context_dev/models/web_web_scrape_html_response.rbs +85 -0
  90. data/sig/context_dev/models/web_web_scrape_md_response.rbs +85 -0
  91. data/sig/context_dev/models.rbs +18 -0
  92. data/sig/context_dev/resources/batch.rbs +41 -0
  93. data/sig/context_dev/resources/monitors.rbs +2 -2
  94. metadata +47 -2
@@ -0,0 +1,126 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ContextDev
4
+ module Models
5
+ class CrawlControls < ContextDev::Internal::Type::BaseModel
6
+ # @!attribute follow_subdomains
7
+ # Whether links to subdomains were followed. Always false for a sitemap crawl.
8
+ #
9
+ # @return [Boolean]
10
+ required :follow_subdomains, ContextDev::Internal::Type::Boolean
11
+
12
+ # @!attribute max_depth
13
+ # Link depth limit. Always 0 for a sitemap crawl, which never follows links off
14
+ # its URLs; null when a `start_url` crawl set no limit.
15
+ #
16
+ # @return [Integer, nil]
17
+ required :max_depth, Integer, nil?: true
18
+
19
+ # @!attribute max_pages
20
+ # The `maxUrls` submitted with the crawl. A sitemap crawl scrapes only the URLs
21
+ # its sitemap actually lists, up to this many, so `input.reserved` is often lower.
22
+ #
23
+ # @return [Integer]
24
+ required :max_pages, Integer
25
+
26
+ # @!attribute source
27
+ # Where the crawl started.
28
+ #
29
+ # @return [ContextDev::Models::CrawlControls::Source::UnionMember0, ContextDev::Models::CrawlControls::Source::UnionMember1]
30
+ required :source, union: -> { ContextDev::CrawlControls::Source }
31
+
32
+ # @!attribute url_pattern
33
+ # RE2 pattern URLs had to match to be crawled. Null when the crawl set none.
34
+ #
35
+ # @return [String, nil]
36
+ required :url_pattern, String, nil?: true
37
+
38
+ # @!method initialize(follow_subdomains:, max_depth:, max_pages:, source:, url_pattern:)
39
+ # Some parameter documentations has been truncated, see
40
+ # {ContextDev::Models::CrawlControls} for more details.
41
+ #
42
+ # The crawl controls as submitted, so the limits requested can be compared against
43
+ # what the crawl reached.
44
+ #
45
+ # @param follow_subdomains [Boolean] Whether links to subdomains were followed. Always false for a sitemap crawl.
46
+ #
47
+ # @param max_depth [Integer, nil] Link depth limit. Always 0 for a sitemap crawl, which never follows links off it
48
+ #
49
+ # @param max_pages [Integer] The `maxUrls` submitted with the crawl. A sitemap crawl scrapes only the URLs it
50
+ #
51
+ # @param source [ContextDev::Models::CrawlControls::Source::UnionMember0, ContextDev::Models::CrawlControls::Source::UnionMember1] Where the crawl started.
52
+ #
53
+ # @param url_pattern [String, nil] RE2 pattern URLs had to match to be crawled. Null when the crawl set none.
54
+
55
+ # Where the crawl started.
56
+ #
57
+ # @see ContextDev::Models::CrawlControls#source
58
+ module Source
59
+ extend ContextDev::Internal::Type::Union
60
+
61
+ variant -> { ContextDev::CrawlControls::Source::UnionMember0 }
62
+
63
+ variant -> { ContextDev::CrawlControls::Source::UnionMember1 }
64
+
65
+ class UnionMember0 < ContextDev::Internal::Type::BaseModel
66
+ # @!attribute type
67
+ #
68
+ # @return [Symbol, ContextDev::Models::CrawlControls::Source::UnionMember0::Type]
69
+ required :type, enum: -> { ContextDev::CrawlControls::Source::UnionMember0::Type }
70
+
71
+ # @!attribute url
72
+ # Page the crawl started from.
73
+ #
74
+ # @return [String]
75
+ required :url, String
76
+
77
+ # @!method initialize(type:, url:)
78
+ # @param type [Symbol, ContextDev::Models::CrawlControls::Source::UnionMember0::Type]
79
+ #
80
+ # @param url [String] Page the crawl started from.
81
+
82
+ # @see ContextDev::Models::CrawlControls::Source::UnionMember0#type
83
+ module Type
84
+ extend ContextDev::Internal::Type::Enum
85
+
86
+ START_URL = :start_url
87
+
88
+ # @!method self.values
89
+ # @return [Array<Symbol>]
90
+ end
91
+ end
92
+
93
+ class UnionMember1 < ContextDev::Internal::Type::BaseModel
94
+ # @!attribute domain
95
+ # Domain whose sitemap supplied the pages.
96
+ #
97
+ # @return [String]
98
+ required :domain, String
99
+
100
+ # @!attribute type
101
+ #
102
+ # @return [Symbol, ContextDev::Models::CrawlControls::Source::UnionMember1::Type]
103
+ required :type, enum: -> { ContextDev::CrawlControls::Source::UnionMember1::Type }
104
+
105
+ # @!method initialize(domain:, type:)
106
+ # @param domain [String] Domain whose sitemap supplied the pages.
107
+ #
108
+ # @param type [Symbol, ContextDev::Models::CrawlControls::Source::UnionMember1::Type]
109
+
110
+ # @see ContextDev::Models::CrawlControls::Source::UnionMember1#type
111
+ module Type
112
+ extend ContextDev::Internal::Type::Enum
113
+
114
+ SITEMAP = :sitemap
115
+
116
+ # @!method self.values
117
+ # @return [Array<Symbol>]
118
+ end
119
+ end
120
+
121
+ # @!method self.variants
122
+ # @return [Array(ContextDev::Models::CrawlControls::Source::UnionMember0, ContextDev::Models::CrawlControls::Source::UnionMember1)]
123
+ end
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ContextDev
4
+ module Models
5
+ class Failure < ContextDev::Internal::Type::BaseModel
6
+ # @!attribute code
7
+ # Why the batch itself stopped.
8
+ #
9
+ # @return [String]
10
+ required :code, String
11
+
12
+ # @!attribute message
13
+ # Human-readable explanation.
14
+ #
15
+ # @return [String]
16
+ required :message, String
17
+
18
+ # @!method initialize(code:, message:)
19
+ # A failure of the batch as a whole, distinct from the per-page failures in
20
+ # `page_errors`.
21
+ #
22
+ # @param code [String] Why the batch itself stopped.
23
+ #
24
+ # @param message [String] Human-readable explanation.
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ContextDev
4
+ module Models
5
+ class Intake < ContextDev::Internal::Type::BaseModel
6
+ # @!attribute duplicates
7
+ # URLs dropped before reserving because another entry resolved to the same page.
8
+ # Non-zero for sitemap crawls too, whose sitemaps routinely list a page more than
9
+ # once.
10
+ #
11
+ # @return [Integer]
12
+ required :duplicates, Integer
13
+
14
+ # @!attribute invalid
15
+ # URLs from your list rejected as unusable; the same ones are itemised in
16
+ # `invalid_urls` at submission. Null for a crawl — a crawl that resolves no usable
17
+ # page is rejected outright with a 400 rather than accepted with an empty list.
18
+ #
19
+ # @return [Integer, nil]
20
+ required :invalid, Integer, nil?: true
21
+
22
+ # @!attribute reserved
23
+ # Pages credits were reserved for. Everything else — progress, the refund, the
24
+ # completion percentage — is measured against this.
25
+ #
26
+ # @return [Integer]
27
+ required :reserved, Integer
28
+
29
+ # @!attribute reserved_is_ceiling
30
+ # Whether `reserved` is an upper bound the batch may finish under. True only for a
31
+ # crawl that follows links, whose reachable page count is unknowable until it
32
+ # runs. False for a scrape and for a sitemap crawl, where `reserved` is an exact
33
+ # page count.
34
+ #
35
+ # @return [Boolean]
36
+ required :reserved_is_ceiling, ContextDev::Internal::Type::Boolean
37
+
38
+ # @!attribute submitted
39
+ # URLs in the list you sent, before validation and de-duplication. Null for a
40
+ # crawl, which is given a source rather than a list.
41
+ #
42
+ # @return [Integer, nil]
43
+ required :submitted, Integer, nil?: true
44
+
45
+ # @!method initialize(duplicates:, invalid:, reserved:, reserved_is_ceiling:, submitted:)
46
+ # Some parameter documentations has been truncated, see
47
+ # {ContextDev::Models::Intake} for more details.
48
+ #
49
+ # What submission took in, and what it charged for.
50
+ #
51
+ # @param duplicates [Integer] URLs dropped before reserving because another entry resolved to the same page. N
52
+ #
53
+ # @param invalid [Integer, nil] URLs from your list rejected as unusable; the same ones are itemised in `invalid
54
+ #
55
+ # @param reserved [Integer] Pages credits were reserved for. Everything else — progress, the refund, the com
56
+ #
57
+ # @param reserved_is_ceiling [Boolean] Whether `reserved` is an upper bound the batch may finish under. True only for a
58
+ #
59
+ # @param submitted [Integer, nil] URLs in the list you sent, before validation and de-duplication. Null for a craw
60
+ end
61
+ end
62
+ end
@@ -7,31 +7,23 @@ module ContextDev
7
7
  extend ContextDev::Internal::Type::RequestParameters::Converter
8
8
  include ContextDev::Internal::Type::RequestParameters
9
9
 
10
- # @!attribute change_detection
11
- # Discriminated union describing how changes are detected.
12
- #
13
- # @return [ContextDev::Models::MonitorCreateParams::ChangeDetection::Exact, ContextDev::Models::MonitorCreateParams::ChangeDetection::Semantic]
14
- required :change_detection, union: -> { ContextDev::MonitorCreateParams::ChangeDetection }
15
-
16
10
  # @!attribute name
17
11
  #
18
12
  # @return [String]
19
13
  required :name, String
20
14
 
21
- # @!attribute schedule
22
- # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
23
- # every 6 hours or every 2 days. The total interval (frequency × unit) must be
24
- # between 10 minutes and 1 year.
25
- #
26
- # @return [ContextDev::Models::MonitorCreateParams::Schedule]
27
- required :schedule, -> { ContextDev::MonitorCreateParams::Schedule }
28
-
29
15
  # @!attribute target
30
16
  # Discriminated union describing what the monitor watches.
31
17
  #
32
18
  # @return [ContextDev::Models::MonitorCreateParams::Target::Page, ContextDev::Models::MonitorCreateParams::Target::Sitemap, ContextDev::Models::MonitorCreateParams::Target::Extract]
33
19
  required :target, union: -> { ContextDev::MonitorCreateParams::Target }
34
20
 
21
+ # @!attribute change_detection
22
+ # Discriminated union describing how changes are detected.
23
+ #
24
+ # @return [ContextDev::Models::MonitorCreateParams::ChangeDetection::Exact, ContextDev::Models::MonitorCreateParams::ChangeDetection::Semantic, nil]
25
+ optional :change_detection, union: -> { ContextDev::MonitorCreateParams::ChangeDetection }
26
+
35
27
  # @!attribute mode
36
28
  # Top-level monitor category. Always `web` today; the concrete behavior is
37
29
  # described by `target` and `change_detection`.
@@ -39,6 +31,14 @@ module ContextDev
39
31
  # @return [Symbol, ContextDev::Models::MonitorCreateParams::Mode, nil]
40
32
  optional :mode, enum: -> { ContextDev::MonitorCreateParams::Mode }
41
33
 
34
+ # @!attribute schedule
35
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
36
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
37
+ # between 10 minutes and 1 year.
38
+ #
39
+ # @return [ContextDev::Models::MonitorCreateParams::Schedule, nil]
40
+ optional :schedule, -> { ContextDev::MonitorCreateParams::Schedule }
41
+
42
42
  # @!attribute tags
43
43
  # User-defined tags for grouping and filtering monitors and their changes.
44
44
  # Duplicates are removed.
@@ -51,138 +51,33 @@ module ContextDev
51
51
  # @return [ContextDev::Models::MonitorCreateParams::Webhook, nil]
52
52
  optional :webhook, -> { ContextDev::MonitorCreateParams::Webhook }, nil?: true
53
53
 
54
- # @!method initialize(change_detection:, name:, schedule:, target:, mode: nil, tags: nil, webhook: nil, request_options: {})
54
+ # @!method initialize(name:, target:, change_detection: nil, mode: nil, schedule: nil, tags: nil, webhook: nil, request_options: {})
55
55
  # Some parameter documentations has been truncated, see
56
56
  # {ContextDev::Models::MonitorCreateParams} for more details.
57
57
  #
58
- # @param change_detection [ContextDev::Models::MonitorCreateParams::ChangeDetection::Exact, ContextDev::Models::MonitorCreateParams::ChangeDetection::Semantic] Discriminated union describing how changes are detected.
59
- #
60
58
  # @param name [String]
61
59
  #
62
- # @param schedule [ContextDev::Models::MonitorCreateParams::Schedule] Run the monitor on a fixed interval defined by a frequency and a unit, e.g. ever
63
- #
64
60
  # @param target [ContextDev::Models::MonitorCreateParams::Target::Page, ContextDev::Models::MonitorCreateParams::Target::Sitemap, ContextDev::Models::MonitorCreateParams::Target::Extract] Discriminated union describing what the monitor watches.
65
61
  #
62
+ # @param change_detection [ContextDev::Models::MonitorCreateParams::ChangeDetection::Exact, ContextDev::Models::MonitorCreateParams::ChangeDetection::Semantic] Discriminated union describing how changes are detected.
63
+ #
66
64
  # @param mode [Symbol, ContextDev::Models::MonitorCreateParams::Mode] Top-level monitor category. Always `web` today; the concrete behavior is describ
67
65
  #
66
+ # @param schedule [ContextDev::Models::MonitorCreateParams::Schedule] Run the monitor on a fixed interval defined by a frequency and a unit, e.g. ever
67
+ #
68
68
  # @param tags [Array<String>] User-defined tags for grouping and filtering monitors and their changes. Duplica
69
69
  #
70
70
  # @param webhook [ContextDev::Models::MonitorCreateParams::Webhook, nil]
71
71
  #
72
72
  # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]
73
73
 
74
- # Discriminated union describing how changes are detected.
75
- module ChangeDetection
76
- extend ContextDev::Internal::Type::Union
77
-
78
- discriminator :type
79
-
80
- # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
81
- variant :exact, -> { ContextDev::MonitorCreateParams::ChangeDetection::Exact }
82
-
83
- # 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).
84
- variant :semantic, -> { ContextDev::MonitorCreateParams::ChangeDetection::Semantic }
85
-
86
- class Exact < ContextDev::Internal::Type::BaseModel
87
- # @!attribute type
88
- #
89
- # @return [Symbol, :exact]
90
- required :type, const: :exact
91
-
92
- # @!method initialize(type: :exact)
93
- # Detect exact changes. For page targets, this means visible text diffs. For
94
- # sitemap targets, this means URL additions and removals.
95
- #
96
- # @param type [Symbol, :exact]
97
- end
98
-
99
- class Semantic < ContextDev::Internal::Type::BaseModel
100
- # @!attribute type
101
- #
102
- # @return [Symbol, :semantic]
103
- required :type, const: :semantic
104
-
105
- # @!attribute confidence_threshold
106
- #
107
- # @return [Float, nil]
108
- optional :confidence_threshold, Float
109
-
110
- # @!method initialize(confidence_threshold: nil, type: :semantic)
111
- # Detect meaning-level changes to tracked page content, ignoring cosmetic or
112
- # paraphrase-only differences. Which changes are meaningful is judged against the
113
- # extract target's `instructions` (and `schema`, when provided).
114
- #
115
- # @param confidence_threshold [Float]
116
- # @param type [Symbol, :semantic]
117
- end
118
-
119
- # @!method self.variants
120
- # @return [Array(ContextDev::Models::MonitorCreateParams::ChangeDetection::Exact, ContextDev::Models::MonitorCreateParams::ChangeDetection::Semantic)]
121
- end
122
-
123
- class Schedule < ContextDev::Internal::Type::BaseModel
124
- # @!attribute frequency
125
- # Number of units between runs. The resulting interval (frequency × unit) must be
126
- # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
127
- # maximum 365 when unit is days).
128
- #
129
- # @return [Integer]
130
- required :frequency, Integer
131
-
132
- # @!attribute type
133
- #
134
- # @return [Symbol, ContextDev::Models::MonitorCreateParams::Schedule::Type]
135
- required :type, enum: -> { ContextDev::MonitorCreateParams::Schedule::Type }
136
-
137
- # @!attribute unit
138
- #
139
- # @return [Symbol, ContextDev::Models::MonitorCreateParams::Schedule::Unit]
140
- required :unit, enum: -> { ContextDev::MonitorCreateParams::Schedule::Unit }
141
-
142
- # @!method initialize(frequency:, type:, unit:)
143
- # Some parameter documentations has been truncated, see
144
- # {ContextDev::Models::MonitorCreateParams::Schedule} for more details.
145
- #
146
- # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
147
- # every 6 hours or every 2 days. The total interval (frequency × unit) must be
148
- # between 10 minutes and 1 year.
149
- #
150
- # @param frequency [Integer] Number of units between runs. The resulting interval (frequency × unit) must be
151
- #
152
- # @param type [Symbol, ContextDev::Models::MonitorCreateParams::Schedule::Type]
153
- #
154
- # @param unit [Symbol, ContextDev::Models::MonitorCreateParams::Schedule::Unit]
155
-
156
- # @see ContextDev::Models::MonitorCreateParams::Schedule#type
157
- module Type
158
- extend ContextDev::Internal::Type::Enum
159
-
160
- INTERVAL = :interval
161
-
162
- # @!method self.values
163
- # @return [Array<Symbol>]
164
- end
165
-
166
- # @see ContextDev::Models::MonitorCreateParams::Schedule#unit
167
- module Unit
168
- extend ContextDev::Internal::Type::Enum
169
-
170
- MINUTES = :minutes
171
- HOURS = :hours
172
- DAYS = :days
173
-
174
- # @!method self.values
175
- # @return [Array<Symbol>]
176
- end
177
- end
178
-
179
74
  # Discriminated union describing what the monitor watches.
180
75
  module Target
181
76
  extend ContextDev::Internal::Type::Union
182
77
 
183
78
  discriminator :type
184
79
 
185
- # Watch a single web page.
80
+ # Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`.
186
81
  variant :page, -> { ContextDev::MonitorCreateParams::Target::Page }
187
82
 
188
83
  # 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.
@@ -202,17 +97,30 @@ module ContextDev
202
97
  # @return [String]
203
98
  required :url, String
204
99
 
100
+ # @!attribute instructions
101
+ # Plain-language goal describing which page changes matter. When provided without
102
+ # change_detection, semantic detection is inferred.
103
+ #
104
+ # @return [String, nil]
105
+ optional :instructions, String
106
+
205
107
  # @!attribute normalize_whitespace
206
108
  # Normalize whitespace before comparing or analyzing text.
207
109
  #
208
110
  # @return [Boolean, nil]
209
111
  optional :normalize_whitespace, ContextDev::Internal::Type::Boolean
210
112
 
211
- # @!method initialize(url:, normalize_whitespace: nil, type: :page)
212
- # Watch a single web page.
113
+ # @!method initialize(url:, instructions: nil, normalize_whitespace: nil, type: :page)
114
+ # Some parameter documentations has been truncated, see
115
+ # {ContextDev::Models::MonitorCreateParams::Target::Page} for more details.
116
+ #
117
+ # Watch a single web page. Exact detection reports visible-text diffs; semantic
118
+ # detection judges confirmed stable diffs against `instructions`.
213
119
  #
214
120
  # @param url [String]
215
121
  #
122
+ # @param instructions [String] Plain-language goal describing which page changes matter. When provided without
123
+ #
216
124
  # @param normalize_whitespace [Boolean] Normalize whitespace before comparing or analyzing text.
217
125
  #
218
126
  # @param type [Symbol, :page]
@@ -344,6 +252,56 @@ module ContextDev
344
252
  # @return [Array(ContextDev::Models::MonitorCreateParams::Target::Page, ContextDev::Models::MonitorCreateParams::Target::Sitemap, ContextDev::Models::MonitorCreateParams::Target::Extract)]
345
253
  end
346
254
 
255
+ # Discriminated union describing how changes are detected.
256
+ module ChangeDetection
257
+ extend ContextDev::Internal::Type::Union
258
+
259
+ discriminator :type
260
+
261
+ # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
262
+ variant :exact, -> { ContextDev::MonitorCreateParams::ChangeDetection::Exact }
263
+
264
+ # Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided).
265
+ variant :semantic, -> { ContextDev::MonitorCreateParams::ChangeDetection::Semantic }
266
+
267
+ class Exact < ContextDev::Internal::Type::BaseModel
268
+ # @!attribute type
269
+ #
270
+ # @return [Symbol, :exact]
271
+ required :type, const: :exact
272
+
273
+ # @!method initialize(type: :exact)
274
+ # Detect exact changes. For page targets, this means visible text diffs. For
275
+ # sitemap targets, this means URL additions and removals.
276
+ #
277
+ # @param type [Symbol, :exact]
278
+ end
279
+
280
+ class Semantic < ContextDev::Internal::Type::BaseModel
281
+ # @!attribute type
282
+ #
283
+ # @return [Symbol, :semantic]
284
+ required :type, const: :semantic
285
+
286
+ # @!attribute confidence_threshold
287
+ #
288
+ # @return [Float, nil]
289
+ optional :confidence_threshold, Float
290
+
291
+ # @!method initialize(confidence_threshold: nil, type: :semantic)
292
+ # Detect meaning-level changes to page content, ignoring cosmetic or
293
+ # instruction-irrelevant differences. Which changes are meaningful is judged
294
+ # against the page or extract target's `instructions` (and an extract target's
295
+ # `schema`, when provided).
296
+ #
297
+ # @param confidence_threshold [Float]
298
+ # @param type [Symbol, :semantic]
299
+ end
300
+
301
+ # @!method self.variants
302
+ # @return [Array(ContextDev::Models::MonitorCreateParams::ChangeDetection::Exact, ContextDev::Models::MonitorCreateParams::ChangeDetection::Semantic)]
303
+ end
304
+
347
305
  # Top-level monitor category. Always `web` today; the concrete behavior is
348
306
  # described by `target` and `change_detection`.
349
307
  module Mode
@@ -355,6 +313,62 @@ module ContextDev
355
313
  # @return [Array<Symbol>]
356
314
  end
357
315
 
316
+ class Schedule < ContextDev::Internal::Type::BaseModel
317
+ # @!attribute frequency
318
+ # Number of units between runs. The resulting interval (frequency × unit) must be
319
+ # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
320
+ # maximum 365 when unit is days).
321
+ #
322
+ # @return [Integer]
323
+ required :frequency, Integer
324
+
325
+ # @!attribute type
326
+ #
327
+ # @return [Symbol, ContextDev::Models::MonitorCreateParams::Schedule::Type]
328
+ required :type, enum: -> { ContextDev::MonitorCreateParams::Schedule::Type }
329
+
330
+ # @!attribute unit
331
+ #
332
+ # @return [Symbol, ContextDev::Models::MonitorCreateParams::Schedule::Unit]
333
+ required :unit, enum: -> { ContextDev::MonitorCreateParams::Schedule::Unit }
334
+
335
+ # @!method initialize(frequency:, type:, unit:)
336
+ # Some parameter documentations has been truncated, see
337
+ # {ContextDev::Models::MonitorCreateParams::Schedule} for more details.
338
+ #
339
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
340
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
341
+ # between 10 minutes and 1 year.
342
+ #
343
+ # @param frequency [Integer] Number of units between runs. The resulting interval (frequency × unit) must be
344
+ #
345
+ # @param type [Symbol, ContextDev::Models::MonitorCreateParams::Schedule::Type]
346
+ #
347
+ # @param unit [Symbol, ContextDev::Models::MonitorCreateParams::Schedule::Unit]
348
+
349
+ # @see ContextDev::Models::MonitorCreateParams::Schedule#type
350
+ module Type
351
+ extend ContextDev::Internal::Type::Enum
352
+
353
+ INTERVAL = :interval
354
+
355
+ # @!method self.values
356
+ # @return [Array<Symbol>]
357
+ end
358
+
359
+ # @see ContextDev::Models::MonitorCreateParams::Schedule#unit
360
+ module Unit
361
+ extend ContextDev::Internal::Type::Enum
362
+
363
+ MINUTES = :minutes
364
+ HOURS = :hours
365
+ DAYS = :days
366
+
367
+ # @!method self.values
368
+ # @return [Array<Symbol>]
369
+ end
370
+ end
371
+
358
372
  class Webhook < ContextDev::Internal::Type::BaseModel
359
373
  # @!attribute url
360
374
  # Webhook URL events are delivered to.
@@ -20,6 +20,14 @@ module ContextDev
20
20
  # @return [Time]
21
21
  required :created_at, Time
22
22
 
23
+ # @!attribute initial_run_id
24
+ # The baseline run queued by this create call, or null if it could not be queued
25
+ # immediately (in which case the baseline runs on the next scheduled tick). Poll
26
+ # GET /monitors/{monitor_id}/runs/{run_id}.
27
+ #
28
+ # @return [String, nil]
29
+ required :initial_run_id, String, nil?: true
30
+
23
31
  # @!attribute mode
24
32
  # Top-level monitor category. Always `web` today; the concrete behavior is
25
33
  # described by `target` and `change_detection`.
@@ -112,12 +120,12 @@ module ContextDev
112
120
  # @return [ContextDev::Models::MonitorCreateResponse::WebhookFailure, nil]
113
121
  optional :webhook_failure, -> { ContextDev::Models::MonitorCreateResponse::WebhookFailure }, nil?: true
114
122
 
115
- # @!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)
123
+ # @!method initialize(id:, change_detection:, created_at:, initial_run_id:, 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)
116
124
  # Some parameter documentations has been truncated, see
117
125
  # {ContextDev::Models::MonitorCreateResponse} for more details.
118
126
  #
119
- # A web monitor. `mode` is the constant `web`; behavior is described by `target`
120
- # (page/sitemap/extract) and `change_detection` (exact/semantic).
127
+ # A newly created monitor plus `initial_run_id`, the id of the baseline run queued
128
+ # at creation.
121
129
  #
122
130
  # @param id [String]
123
131
  #
@@ -125,6 +133,8 @@ module ContextDev
125
133
  #
126
134
  # @param created_at [Time]
127
135
  #
136
+ # @param initial_run_id [String, nil] The baseline run queued by this create call, or null if it could not be queued i
137
+ #
128
138
  # @param mode [Symbol, ContextDev::Models::MonitorCreateResponse::Mode] Top-level monitor category. Always `web` today; the concrete behavior is describ
129
139
  #
130
140
  # @param name [String]
@@ -164,7 +174,7 @@ module ContextDev
164
174
  # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
165
175
  variant :exact, -> { ContextDev::Models::MonitorCreateResponse::ChangeDetection::Exact }
166
176
 
167
- # 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).
177
+ # Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided).
168
178
  variant :semantic, -> { ContextDev::Models::MonitorCreateResponse::ChangeDetection::Semantic }
169
179
 
170
180
  class Exact < ContextDev::Internal::Type::BaseModel
@@ -192,9 +202,10 @@ module ContextDev
192
202
  optional :confidence_threshold, Float
193
203
 
194
204
  # @!method initialize(confidence_threshold: nil, type: :semantic)
195
- # Detect meaning-level changes to tracked page content, ignoring cosmetic or
196
- # paraphrase-only differences. Which changes are meaningful is judged against the
197
- # extract target's `instructions` (and `schema`, when provided).
205
+ # Detect meaning-level changes to page content, ignoring cosmetic or
206
+ # instruction-irrelevant differences. Which changes are meaningful is judged
207
+ # against the page or extract target's `instructions` (and an extract target's
208
+ # `schema`, when provided).
198
209
  #
199
210
  # @param confidence_threshold [Float]
200
211
  # @param type [Symbol, :semantic]
@@ -300,7 +311,7 @@ module ContextDev
300
311
 
301
312
  discriminator :type
302
313
 
303
- # Watch a single web page.
314
+ # Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`.
304
315
  variant :page, -> { ContextDev::Models::MonitorCreateResponse::Target::Page }
305
316
 
306
317
  # 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.
@@ -320,17 +331,30 @@ module ContextDev
320
331
  # @return [String]
321
332
  required :url, String
322
333
 
334
+ # @!attribute instructions
335
+ # Plain-language goal describing which page changes matter. When provided without
336
+ # change_detection, semantic detection is inferred.
337
+ #
338
+ # @return [String, nil]
339
+ optional :instructions, String
340
+
323
341
  # @!attribute normalize_whitespace
324
342
  # Normalize whitespace before comparing or analyzing text.
325
343
  #
326
344
  # @return [Boolean, nil]
327
345
  optional :normalize_whitespace, ContextDev::Internal::Type::Boolean
328
346
 
329
- # @!method initialize(url:, normalize_whitespace: nil, type: :page)
330
- # Watch a single web page.
347
+ # @!method initialize(url:, instructions: nil, normalize_whitespace: nil, type: :page)
348
+ # Some parameter documentations has been truncated, see
349
+ # {ContextDev::Models::MonitorCreateResponse::Target::Page} for more details.
350
+ #
351
+ # Watch a single web page. Exact detection reports visible-text diffs; semantic
352
+ # detection judges confirmed stable diffs against `instructions`.
331
353
  #
332
354
  # @param url [String]
333
355
  #
356
+ # @param instructions [String] Plain-language goal describing which page changes matter. When provided without
357
+ #
334
358
  # @param normalize_whitespace [Boolean] Normalize whitespace before comparing or analyzing text.
335
359
  #
336
360
  # @param type [Symbol, :page]