context.dev 2.2.0 → 2.4.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 +22 -0
  3. data/README.md +9 -9
  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 +28 -3
  7. data/lib/context_dev/models/monitor_create_response.rb +96 -4
  8. data/lib/context_dev/models/monitor_list_account_runs_response.rb +19 -98
  9. data/lib/context_dev/models/monitor_list_response.rb +100 -4
  10. data/lib/context_dev/models/monitor_list_runs_response.rb +19 -96
  11. data/lib/context_dev/models/monitor_retrieve_change_response.rb +10 -10
  12. data/lib/context_dev/models/monitor_retrieve_response.rb +97 -4
  13. data/lib/context_dev/models/monitor_update_params.rb +28 -3
  14. data/lib/context_dev/models/monitor_update_response.rb +96 -4
  15. data/lib/context_dev/models/parse_handle_params.rb +194 -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 +59 -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 +85 -5
  30. data/rbi/context_dev/models/monitor_create_response.rbi +234 -6
  31. data/rbi/context_dev/models/monitor_list_account_runs_response.rbi +27 -192
  32. data/rbi/context_dev/models/monitor_list_response.rbi +235 -5
  33. data/rbi/context_dev/models/monitor_list_runs_response.rbi +27 -192
  34. data/rbi/context_dev/models/monitor_retrieve_change_response.rbi +12 -15
  35. data/rbi/context_dev/models/monitor_retrieve_response.rbi +234 -6
  36. data/rbi/context_dev/models/monitor_update_params.rbi +85 -5
  37. data/rbi/context_dev/models/monitor_update_response.rbi +234 -6
  38. data/rbi/context_dev/models/parse_handle_params.rbi +339 -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 +58 -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 +15 -68
  53. data/sig/context_dev/models/monitor_list_response.rbs +85 -6
  54. data/sig/context_dev/models/monitor_list_runs_response.rbs +15 -68
  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 +244 -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 +19 -0
  68. metadata +14 -2
@@ -101,8 +101,8 @@ module ContextDev
101
101
  sig { params(max_pages: Integer).void }
102
102
  attr_writer :max_pages
103
103
 
104
- # PDF parsing controls. Use start/end to limit text extraction and OCR to an
105
- # inclusive 1-based page range.
104
+ # PDF parsing controls. Use start/end to limit text extraction and embedded-image
105
+ # detection/OCR to an inclusive 1-based page range.
106
106
  sig { returns(T.nilable(ContextDev::WebWebCrawlMdParams::Pdf)) }
107
107
  attr_reader :pdf
108
108
 
@@ -226,8 +226,8 @@ module ContextDev
226
226
  max_depth: nil,
227
227
  # Maximum number of pages to crawl. Hard cap: 500.
228
228
  max_pages: nil,
229
- # PDF parsing controls. Use start/end to limit text extraction and OCR to an
230
- # inclusive 1-based page range.
229
+ # PDF parsing controls. Use start/end to limit text extraction and embedded-image
230
+ # detection/OCR to an inclusive 1-based page range.
231
231
  pdf: nil,
232
232
  # When true, waits briefly for CSS and transition animations to settle before
233
233
  # extracting each crawled page. Defaults to false. This adds a bit of latency in
@@ -528,6 +528,15 @@ module ContextDev
528
528
  sig { params(end_: Integer).void }
529
529
  attr_writer :end_
530
530
 
531
+ # When true, detect and OCR images embedded in the selected PDF pages, inserting
532
+ # recognized text at each image's position in page reading order while preserving
533
+ # the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
534
+ sig { returns(T.nilable(T::Boolean)) }
535
+ attr_reader :ocr
536
+
537
+ sig { params(ocr: T::Boolean).void }
538
+ attr_writer :ocr
539
+
531
540
  # When true, PDF pages are fetched and parsed. When false, PDF pages are skipped
532
541
  # entirely (not included in results and not counted as failures).
533
542
  sig { returns(T.nilable(T::Boolean)) }
@@ -543,11 +552,12 @@ module ContextDev
543
552
  sig { params(start: Integer).void }
544
553
  attr_writer :start
545
554
 
546
- # PDF parsing controls. Use start/end to limit text extraction and OCR to an
547
- # inclusive 1-based page range.
555
+ # PDF parsing controls. Use start/end to limit text extraction and embedded-image
556
+ # detection/OCR to an inclusive 1-based page range.
548
557
  sig do
549
558
  params(
550
559
  end_: Integer,
560
+ ocr: T::Boolean,
551
561
  should_parse: T::Boolean,
552
562
  start: Integer
553
563
  ).returns(T.attached_class)
@@ -556,6 +566,10 @@ module ContextDev
556
566
  # Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
557
567
  # Must be greater than or equal to start when both are provided.
558
568
  end_: nil,
569
+ # When true, detect and OCR images embedded in the selected PDF pages, inserting
570
+ # recognized text at each image's position in page reading order while preserving
571
+ # the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
572
+ ocr: nil,
559
573
  # When true, PDF pages are fetched and parsed. When false, PDF pages are skipped
560
574
  # entirely (not included in results and not counted as failures).
561
575
  should_parse: nil,
@@ -566,7 +580,12 @@ module ContextDev
566
580
 
567
581
  sig do
568
582
  override.returns(
569
- { end_: Integer, should_parse: T::Boolean, start: Integer }
583
+ {
584
+ end_: Integer,
585
+ ocr: T::Boolean,
586
+ should_parse: T::Boolean,
587
+ start: Integer
588
+ }
570
589
  )
571
590
  end
572
591
  def to_hash
@@ -77,8 +77,8 @@ module ContextDev
77
77
  sig { params(max_age_ms: Integer).void }
78
78
  attr_writer :max_age_ms
79
79
 
80
- # PDF parsing controls. Use start/end to limit text extraction and OCR to an
81
- # inclusive 1-based page range.
80
+ # PDF parsing controls. Use start/end to limit text extraction and embedded-image
81
+ # detection/OCR to an inclusive 1-based page range.
82
82
  sig { returns(T.nilable(ContextDev::WebWebScrapeHTMLParams::Pdf)) }
83
83
  attr_reader :pdf
84
84
 
@@ -160,8 +160,8 @@ module ContextDev
160
160
  # younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
161
161
  # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
162
162
  max_age_ms: nil,
163
- # PDF parsing controls. Use start/end to limit text extraction and OCR to an
164
- # inclusive 1-based page range.
163
+ # PDF parsing controls. Use start/end to limit text extraction and embedded-image
164
+ # detection/OCR to an inclusive 1-based page range.
165
165
  pdf: nil,
166
166
  # When true, waits briefly for CSS and transition animations to settle before
167
167
  # extracting HTML. Defaults to false. This adds a bit of latency in exchange for
@@ -649,6 +649,15 @@ module ContextDev
649
649
  sig { params(end_: Integer).void }
650
650
  attr_writer :end_
651
651
 
652
+ # When true, detect and OCR images embedded in the selected PDF pages, inserting
653
+ # recognized text at each image's position in page reading order while preserving
654
+ # the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
655
+ sig { returns(T.nilable(T::Boolean)) }
656
+ attr_reader :ocr
657
+
658
+ sig { params(ocr: T::Boolean).void }
659
+ attr_writer :ocr
660
+
652
661
  # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
653
662
  # a 400 WEBSITE_ACCESS_ERROR is returned.
654
663
  sig { returns(T.nilable(T::Boolean)) }
@@ -664,11 +673,12 @@ module ContextDev
664
673
  sig { params(start: Integer).void }
665
674
  attr_writer :start
666
675
 
667
- # PDF parsing controls. Use start/end to limit text extraction and OCR to an
668
- # inclusive 1-based page range.
676
+ # PDF parsing controls. Use start/end to limit text extraction and embedded-image
677
+ # detection/OCR to an inclusive 1-based page range.
669
678
  sig do
670
679
  params(
671
680
  end_: Integer,
681
+ ocr: T::Boolean,
672
682
  should_parse: T::Boolean,
673
683
  start: Integer
674
684
  ).returns(T.attached_class)
@@ -677,6 +687,10 @@ module ContextDev
677
687
  # Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
678
688
  # Must be greater than or equal to start when both are provided.
679
689
  end_: nil,
690
+ # When true, detect and OCR images embedded in the selected PDF pages, inserting
691
+ # recognized text at each image's position in page reading order while preserving
692
+ # the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
693
+ ocr: nil,
680
694
  # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
681
695
  # a 400 WEBSITE_ACCESS_ERROR is returned.
682
696
  should_parse: nil,
@@ -687,7 +701,12 @@ module ContextDev
687
701
 
688
702
  sig do
689
703
  override.returns(
690
- { end_: Integer, should_parse: T::Boolean, start: Integer }
704
+ {
705
+ end_: Integer,
706
+ ocr: T::Boolean,
707
+ should_parse: T::Boolean,
708
+ start: Integer
709
+ }
691
710
  )
692
711
  end
693
712
  def to_hash
@@ -87,8 +87,8 @@ module ContextDev
87
87
  sig { params(max_age_ms: Integer).void }
88
88
  attr_writer :max_age_ms
89
89
 
90
- # PDF parsing controls. Use start/end to limit text extraction and OCR to an
91
- # inclusive 1-based page range.
90
+ # PDF parsing controls. Use start/end to limit text extraction and embedded-image
91
+ # detection/OCR to an inclusive 1-based page range.
92
92
  sig { returns(T.nilable(ContextDev::WebWebScrapeMdParams::Pdf)) }
93
93
  attr_reader :pdf
94
94
 
@@ -185,8 +185,8 @@ module ContextDev
185
185
  # younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
186
186
  # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
187
187
  max_age_ms: nil,
188
- # PDF parsing controls. Use start/end to limit text extraction and OCR to an
189
- # inclusive 1-based page range.
188
+ # PDF parsing controls. Use start/end to limit text extraction and embedded-image
189
+ # detection/OCR to an inclusive 1-based page range.
190
190
  pdf: nil,
191
191
  # When true, waits briefly for CSS and transition animations to settle before
192
192
  # converting to Markdown. Defaults to false. This adds a bit of latency in
@@ -475,6 +475,15 @@ module ContextDev
475
475
  sig { params(end_: Integer).void }
476
476
  attr_writer :end_
477
477
 
478
+ # When true, detect and OCR images embedded in the selected PDF pages, inserting
479
+ # recognized text at each image's position in page reading order while preserving
480
+ # the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
481
+ sig { returns(T.nilable(T::Boolean)) }
482
+ attr_reader :ocr
483
+
484
+ sig { params(ocr: T::Boolean).void }
485
+ attr_writer :ocr
486
+
478
487
  # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
479
488
  # a 400 WEBSITE_ACCESS_ERROR is returned.
480
489
  sig { returns(T.nilable(T::Boolean)) }
@@ -490,11 +499,12 @@ module ContextDev
490
499
  sig { params(start: Integer).void }
491
500
  attr_writer :start
492
501
 
493
- # PDF parsing controls. Use start/end to limit text extraction and OCR to an
494
- # inclusive 1-based page range.
502
+ # PDF parsing controls. Use start/end to limit text extraction and embedded-image
503
+ # detection/OCR to an inclusive 1-based page range.
495
504
  sig do
496
505
  params(
497
506
  end_: Integer,
507
+ ocr: T::Boolean,
498
508
  should_parse: T::Boolean,
499
509
  start: Integer
500
510
  ).returns(T.attached_class)
@@ -503,6 +513,10 @@ module ContextDev
503
513
  # Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
504
514
  # Must be greater than or equal to start when both are provided.
505
515
  end_: nil,
516
+ # When true, detect and OCR images embedded in the selected PDF pages, inserting
517
+ # recognized text at each image's position in page reading order while preserving
518
+ # the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
519
+ ocr: nil,
506
520
  # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
507
521
  # a 400 WEBSITE_ACCESS_ERROR is returned.
508
522
  should_parse: nil,
@@ -513,7 +527,12 @@ module ContextDev
513
527
 
514
528
  sig do
515
529
  override.returns(
516
- { end_: Integer, should_parse: T::Boolean, start: Integer }
530
+ {
531
+ end_: Integer,
532
+ ocr: T::Boolean,
533
+ should_parse: T::Boolean,
534
+ start: Integer
535
+ }
517
536
  )
518
537
  end
519
538
  def to_hash
@@ -11,6 +11,12 @@ module ContextDev
11
11
  )
12
12
  end
13
13
 
14
+ # UTF-8 byte length of the returned Markdown. Use 0 to identify an empty result
15
+ # and compare small values against your workload's minimum useful-content
16
+ # threshold.
17
+ sig { returns(Integer) }
18
+ attr_accessor :content_length
19
+
14
20
  # Page content converted to GitHub Flavored Markdown
15
21
  sig { returns(String) }
16
22
  attr_accessor :markdown
@@ -57,6 +63,7 @@ module ContextDev
57
63
 
58
64
  sig do
59
65
  params(
66
+ content_length: Integer,
60
67
  markdown: String,
61
68
  metadata:
62
69
  ContextDev::Models::WebWebScrapeMdResponse::Metadata::OrHash,
@@ -68,6 +75,10 @@ module ContextDev
68
75
  ).returns(T.attached_class)
69
76
  end
70
77
  def self.new(
78
+ # UTF-8 byte length of the returned Markdown. Use 0 to identify an empty result
79
+ # and compare small values against your workload's minimum useful-content
80
+ # threshold.
81
+ content_length:,
71
82
  # Page content converted to GitHub Flavored Markdown
72
83
  markdown:,
73
84
  # Metadata extracted from the scraped page HTML.
@@ -85,6 +96,7 @@ module ContextDev
85
96
  sig do
86
97
  override.returns(
87
98
  {
99
+ content_length: Integer,
88
100
  markdown: String,
89
101
  metadata: ContextDev::Models::WebWebScrapeMdResponse::Metadata,
90
102
  success:
@@ -0,0 +1,172 @@
1
+ # typed: strong
2
+
3
+ module ContextDev
4
+ module Models
5
+ class WebhookDelivery < ContextDev::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(ContextDev::WebhookDelivery, ContextDev::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(Time) }
12
+ attr_accessor :attempted_at
13
+
14
+ sig { returns(T.nilable(ContextDev::WebhookDelivery::Error)) }
15
+ attr_reader :error
16
+
17
+ sig do
18
+ params(
19
+ error: T.nilable(ContextDev::WebhookDelivery::Error::OrHash)
20
+ ).void
21
+ end
22
+ attr_writer :error
23
+
24
+ # The event this delivery carried. Deliveries recorded before event selection
25
+ # existed report change.detected.
26
+ sig { returns(ContextDev::WebhookDelivery::Event::TaggedSymbol) }
27
+ attr_accessor :event
28
+
29
+ # Identifier sent in the X-Context-Id header.
30
+ sig { returns(String) }
31
+ attr_accessor :event_id
32
+
33
+ # The endpoint's final HTTP response status, or null when no response was
34
+ # received.
35
+ sig { returns(T.nilable(Integer)) }
36
+ attr_accessor :http_status
37
+
38
+ # Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
39
+ # response; failed means no HTTP response was received; skipped_unsafe_url means
40
+ # the URL failed the public-endpoint safety check.
41
+ sig { returns(ContextDev::WebhookDelivery::Status::TaggedSymbol) }
42
+ attr_accessor :status
43
+
44
+ sig do
45
+ params(
46
+ attempted_at: Time,
47
+ error: T.nilable(ContextDev::WebhookDelivery::Error::OrHash),
48
+ event: ContextDev::WebhookDelivery::Event::OrSymbol,
49
+ event_id: String,
50
+ http_status: T.nilable(Integer),
51
+ status: ContextDev::WebhookDelivery::Status::OrSymbol
52
+ ).returns(T.attached_class)
53
+ end
54
+ def self.new(
55
+ attempted_at:,
56
+ error:,
57
+ # The event this delivery carried. Deliveries recorded before event selection
58
+ # existed report change.detected.
59
+ event:,
60
+ # Identifier sent in the X-Context-Id header.
61
+ event_id:,
62
+ # The endpoint's final HTTP response status, or null when no response was
63
+ # received.
64
+ http_status:,
65
+ # Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
66
+ # response; failed means no HTTP response was received; skipped_unsafe_url means
67
+ # the URL failed the public-endpoint safety check.
68
+ status:
69
+ )
70
+ end
71
+
72
+ sig do
73
+ override.returns(
74
+ {
75
+ attempted_at: Time,
76
+ error: T.nilable(ContextDev::WebhookDelivery::Error),
77
+ event: ContextDev::WebhookDelivery::Event::TaggedSymbol,
78
+ event_id: String,
79
+ http_status: T.nilable(Integer),
80
+ status: ContextDev::WebhookDelivery::Status::TaggedSymbol
81
+ }
82
+ )
83
+ end
84
+ def to_hash
85
+ end
86
+
87
+ class Error < ContextDev::Internal::Type::BaseModel
88
+ OrHash =
89
+ T.type_alias do
90
+ T.any(
91
+ ContextDev::WebhookDelivery::Error,
92
+ ContextDev::Internal::AnyHash
93
+ )
94
+ end
95
+
96
+ sig { returns(String) }
97
+ attr_accessor :code
98
+
99
+ sig { returns(String) }
100
+ attr_accessor :message
101
+
102
+ sig { params(code: String, message: String).returns(T.attached_class) }
103
+ def self.new(code:, message:)
104
+ end
105
+
106
+ sig { override.returns({ code: String, message: String }) }
107
+ def to_hash
108
+ end
109
+ end
110
+
111
+ # The event this delivery carried. Deliveries recorded before event selection
112
+ # existed report change.detected.
113
+ module Event
114
+ extend ContextDev::Internal::Type::Enum
115
+
116
+ TaggedSymbol =
117
+ T.type_alias { T.all(Symbol, ContextDev::WebhookDelivery::Event) }
118
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
119
+
120
+ CHANGE_DETECTED =
121
+ T.let(
122
+ :"change.detected",
123
+ ContextDev::WebhookDelivery::Event::TaggedSymbol
124
+ )
125
+ RUN_COMPLETED =
126
+ T.let(
127
+ :"run.completed",
128
+ ContextDev::WebhookDelivery::Event::TaggedSymbol
129
+ )
130
+
131
+ sig do
132
+ override.returns(
133
+ T::Array[ContextDev::WebhookDelivery::Event::TaggedSymbol]
134
+ )
135
+ end
136
+ def self.values
137
+ end
138
+ end
139
+
140
+ # Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
141
+ # response; failed means no HTTP response was received; skipped_unsafe_url means
142
+ # the URL failed the public-endpoint safety check.
143
+ module Status
144
+ extend ContextDev::Internal::Type::Enum
145
+
146
+ TaggedSymbol =
147
+ T.type_alias { T.all(Symbol, ContextDev::WebhookDelivery::Status) }
148
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
149
+
150
+ DELIVERED =
151
+ T.let(:delivered, ContextDev::WebhookDelivery::Status::TaggedSymbol)
152
+ REJECTED =
153
+ T.let(:rejected, ContextDev::WebhookDelivery::Status::TaggedSymbol)
154
+ FAILED =
155
+ T.let(:failed, ContextDev::WebhookDelivery::Status::TaggedSymbol)
156
+ SKIPPED_UNSAFE_URL =
157
+ T.let(
158
+ :skipped_unsafe_url,
159
+ ContextDev::WebhookDelivery::Status::TaggedSymbol
160
+ )
161
+
162
+ sig do
163
+ override.returns(
164
+ T::Array[ContextDev::WebhookDelivery::Status::TaggedSymbol]
165
+ )
166
+ end
167
+ def self.values
168
+ end
169
+ end
170
+ end
171
+ end
172
+ end
@@ -38,6 +38,8 @@ module ContextDev
38
38
 
39
39
  MonitorUpdateParams = ContextDev::Models::MonitorUpdateParams
40
40
 
41
+ ParseHandleParams = ContextDev::Models::ParseHandleParams
42
+
41
43
  UtilityPrefetchParams = ContextDev::Models::UtilityPrefetchParams
42
44
 
43
45
  WebExtractCompetitorsParams = ContextDev::Models::WebExtractCompetitorsParams
@@ -48,6 +50,8 @@ module ContextDev
48
50
 
49
51
  WebExtractStyleguideParams = ContextDev::Models::WebExtractStyleguideParams
50
52
 
53
+ WebhookDelivery = ContextDev::Models::WebhookDelivery
54
+
51
55
  WebScreenshotParams = ContextDev::Models::WebScreenshotParams
52
56
 
53
57
  WebSearchParams = ContextDev::Models::WebSearchParams
@@ -3,8 +3,9 @@
3
3
  module ContextDev
4
4
  module Resources
5
5
  # Monitor pages, sitemaps, and extracted website data for exact or semantic
6
- # changes. The change.detected webhook payload is documented by the
7
- # MonitorsChangeDetectedWebhookPayload schema.
6
+ # changes. Webhook payloads are documented by the
7
+ # MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload
8
+ # schemas.
8
9
  class Monitors
9
10
  # Creates a monitor. The request body is a union of the supported target/change
10
11
  # detection combinations. The monitor runs immediately after creation to create
@@ -0,0 +1,58 @@
1
+ # typed: strong
2
+
3
+ module ContextDev
4
+ module Resources
5
+ class Parse
6
+ # Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes
7
+ # into LLM-usable Markdown. The base request costs 1 credit. When OCR runs
8
+ # (requires ocr=true), the entire call costs 5 credits; ocr=true requests where no
9
+ # OCR ends up running still cost 1 credit.
10
+ sig do
11
+ params(
12
+ body: ContextDev::Internal::FileInput,
13
+ extension: ContextDev::ParseHandleParams::Extension::OrSymbol,
14
+ include_images: T::Boolean,
15
+ include_links: T::Boolean,
16
+ ocr: T::Boolean,
17
+ pdf: ContextDev::ParseHandleParams::Pdf::OrHash,
18
+ shorten_base64_images: T::Boolean,
19
+ use_main_content_only: T::Boolean,
20
+ request_options: ContextDev::RequestOptions::OrHash
21
+ ).returns(ContextDev::Models::ParseHandleResponse)
22
+ end
23
+ def handle(
24
+ # Body param
25
+ body:,
26
+ # Query param: Optional file extension hint. Case-insensitive; a leading dot is
27
+ # accepted (e.g. ".pdf").
28
+ extension: nil,
29
+ # Query param: Include image references in Markdown output
30
+ include_images: nil,
31
+ # Query param: Preserve hyperlinks in Markdown output
32
+ include_links: nil,
33
+ # Query param: Gates all OCR. When true, PDFs get embedded-image OCR (recognized
34
+ # text inserted at each image's position in page reading order, preserving the
35
+ # text layer; pdf.start/pdf.end limit the page range), scanned PDFs with no text
36
+ # layer get full-document OCR, and raster images get their visible text
37
+ # transcribed. When false, no OCR runs: scanned PDFs may yield no content and
38
+ # images return only format/dimension metadata. Calls where OCR actually runs cost
39
+ # 5 credits instead of 1.
40
+ ocr: nil,
41
+ # Query param: PDF page-range controls. Use start/end to limit parsing (and OCR
42
+ # when ocr=true) to an inclusive 1-based page range.
43
+ pdf: nil,
44
+ # Query param: Shorten base64-encoded image data in the Markdown output
45
+ shorten_base64_images: nil,
46
+ # Query param: Extract only the main content from HTML-like inputs
47
+ use_main_content_only: nil,
48
+ request_options: {}
49
+ )
50
+ end
51
+
52
+ # @api private
53
+ sig { params(client: ContextDev::Client).returns(T.attached_class) }
54
+ def self.new(client:)
55
+ end
56
+ end
57
+ end
58
+ end
@@ -344,8 +344,8 @@ module ContextDev
344
344
  max_depth: nil,
345
345
  # Maximum number of pages to crawl. Hard cap: 500.
346
346
  max_pages: nil,
347
- # PDF parsing controls. Use start/end to limit text extraction and OCR to an
348
- # inclusive 1-based page range.
347
+ # PDF parsing controls. Use start/end to limit text extraction and embedded-image
348
+ # detection/OCR to an inclusive 1-based page range.
349
349
  pdf: nil,
350
350
  # When true, waits briefly for CSS and transition animations to settle before
351
351
  # extracting each crawled page. Defaults to false. This adds a bit of latency in
@@ -416,8 +416,8 @@ module ContextDev
416
416
  # younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
417
417
  # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
418
418
  max_age_ms: nil,
419
- # PDF parsing controls. Use start/end to limit text extraction and OCR to an
420
- # inclusive 1-based page range.
419
+ # PDF parsing controls. Use start/end to limit text extraction and embedded-image
420
+ # detection/OCR to an inclusive 1-based page range.
421
421
  pdf: nil,
422
422
  # When true, waits briefly for CSS and transition animations to settle before
423
423
  # extracting HTML. Defaults to false. This adds a bit of latency in exchange for
@@ -482,7 +482,22 @@ module ContextDev
482
482
  )
483
483
  end
484
484
 
485
- # Scrapes the given URL into LLM usable Markdown.
485
+ # Scrapes the given URL into LLM usable Markdown. Inspect key_metadata on JSON
486
+ # responses from a recognized API key; use error_code to distinguish stable
487
+ # failure categories.
488
+ #
489
+ # ### Billing & errors
490
+ #
491
+ # | HTTP status | Billed? | Meaning |
492
+ # | ----------- | -------------- | ---------------------------------------------------------------------------------------- |
493
+ # | 200 | Yes — 1 credit | Successful scrape, including a zero-length result when includeSelectors matched nothing |
494
+ # | 400 | No | Invalid input, skipped PDF, or the page could not be scraped |
495
+ # | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code |
496
+ # | 404 | No | Target page returned or fingerprinted as not found |
497
+ # | 408 | No | Request timed out |
498
+ # | 415 | No | Unsupported content type |
499
+ # | 429 | No | Per-minute rate limit exceeded; honor Retry-After |
500
+ # | 500 | No | Internal error |
486
501
  sig do
487
502
  params(
488
503
  url: String,
@@ -532,8 +547,8 @@ module ContextDev
532
547
  # younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
533
548
  # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
534
549
  max_age_ms: nil,
535
- # PDF parsing controls. Use start/end to limit text extraction and OCR to an
536
- # inclusive 1-based page range.
550
+ # PDF parsing controls. Use start/end to limit text extraction and embedded-image
551
+ # detection/OCR to an inclusive 1-based page range.
537
552
  pdf: nil,
538
553
  # When true, waits briefly for CSS and transition animations to settle before
539
554
  # converting to Markdown. Defaults to false. This adds a bit of latency in
@@ -10,6 +10,8 @@ module ContextDev
10
10
 
11
11
  attr_reader api_key: String
12
12
 
13
+ attr_reader parse: ContextDev::Resources::Parse
14
+
13
15
  attr_reader web: ContextDev::Resources::Web
14
16
 
15
17
  attr_reader ai: ContextDev::Resources::AI
@@ -287,14 +287,43 @@ module ContextDev
287
287
  def self?.values: -> ::Array[ContextDev::Models::MonitorCreateParams::mode]
288
288
  end
289
289
 
290
- type webhook = { url: String, secret: String }
290
+ type webhook =
291
+ {
292
+ url: String,
293
+ events: ::Array[ContextDev::Models::MonitorCreateParams::Webhook::event],
294
+ secret: String
295
+ }
291
296
 
292
297
  class Webhook < ContextDev::Internal::Type::BaseModel
293
298
  attr_accessor url: String
294
299
 
295
- def initialize: (url: String) -> void
300
+ attr_reader events: ::Array[ContextDev::Models::MonitorCreateParams::Webhook::event]?
301
+
302
+ def events=: (
303
+ ::Array[ContextDev::Models::MonitorCreateParams::Webhook::event]
304
+ ) -> ::Array[ContextDev::Models::MonitorCreateParams::Webhook::event]
305
+
306
+ def initialize: (
307
+ url: String,
308
+ ?events: ::Array[ContextDev::Models::MonitorCreateParams::Webhook::event]
309
+ ) -> void
310
+
311
+ def to_hash: -> {
312
+ url: String,
313
+ events: ::Array[ContextDev::Models::MonitorCreateParams::Webhook::event],
314
+ secret: String
315
+ }
296
316
 
297
- def to_hash: -> { url: String, secret: String }
317
+ type event = :"change.detected" | :"run.completed"
318
+
319
+ module Event
320
+ extend ContextDev::Internal::Type::Enum
321
+
322
+ CHANGE_DETECTED: :"change.detected"
323
+ RUN_COMPLETED: :"run.completed"
324
+
325
+ def self?.values: -> ::Array[ContextDev::Models::MonitorCreateParams::Webhook::event]
326
+ end
298
327
  end
299
328
  end
300
329
  end