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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +1 -1
- data/lib/context_dev/client.rb +7 -2
- data/lib/context_dev/internal/type/base_model.rb +5 -5
- data/lib/context_dev/models/monitor_create_params.rb +44 -14
- data/lib/context_dev/models/monitor_create_response.rb +112 -15
- data/lib/context_dev/models/monitor_list_account_runs_response.rb +23 -1
- data/lib/context_dev/models/monitor_list_response.rb +116 -15
- data/lib/context_dev/models/monitor_list_runs_response.rb +23 -1
- data/lib/context_dev/models/monitor_retrieve_change_response.rb +10 -10
- data/lib/context_dev/models/monitor_retrieve_response.rb +113 -15
- data/lib/context_dev/models/monitor_update_params.rb +44 -14
- data/lib/context_dev/models/monitor_update_response.rb +112 -15
- data/lib/context_dev/models/parse_handle_params.rb +110 -0
- data/lib/context_dev/models/parse_handle_response.rb +132 -0
- data/lib/context_dev/models/web_web_crawl_md_params.rb +16 -6
- data/lib/context_dev/models/web_web_scrape_html_params.rb +16 -6
- data/lib/context_dev/models/web_web_scrape_md_params.rb +16 -6
- data/lib/context_dev/models/web_web_scrape_md_response.rb +11 -1
- data/lib/context_dev/models/webhook_delivery.rb +109 -0
- data/lib/context_dev/models.rb +4 -0
- data/lib/context_dev/resources/monitors.rb +3 -2
- data/lib/context_dev/resources/parse.rb +63 -0
- data/lib/context_dev/resources/web.rb +19 -4
- data/lib/context_dev/version.rb +1 -1
- data/lib/context_dev.rb +4 -0
- data/rbi/context_dev/client.rbi +6 -2
- data/rbi/context_dev/models/monitor_create_params.rbi +106 -16
- data/rbi/context_dev/models/monitor_create_response.rbi +255 -17
- data/rbi/context_dev/models/monitor_list_account_runs_response.rbi +39 -3
- data/rbi/context_dev/models/monitor_list_response.rbi +256 -16
- data/rbi/context_dev/models/monitor_list_runs_response.rbi +39 -3
- data/rbi/context_dev/models/monitor_retrieve_change_response.rbi +12 -15
- data/rbi/context_dev/models/monitor_retrieve_response.rbi +255 -17
- data/rbi/context_dev/models/monitor_update_params.rbi +106 -16
- data/rbi/context_dev/models/monitor_update_response.rbi +255 -17
- data/rbi/context_dev/models/parse_handle_params.rbi +163 -0
- data/rbi/context_dev/models/parse_handle_response.rbi +377 -0
- data/rbi/context_dev/models/web_web_crawl_md_params.rbi +26 -7
- data/rbi/context_dev/models/web_web_scrape_html_params.rbi +26 -7
- data/rbi/context_dev/models/web_web_scrape_md_params.rbi +26 -7
- data/rbi/context_dev/models/web_web_scrape_md_response.rbi +12 -0
- data/rbi/context_dev/models/webhook_delivery.rbi +172 -0
- data/rbi/context_dev/models.rbi +4 -0
- data/rbi/context_dev/resources/monitors.rbi +3 -2
- data/rbi/context_dev/resources/parse.rbi +65 -0
- data/rbi/context_dev/resources/web.rbi +22 -7
- data/sig/context_dev/client.rbs +2 -0
- data/sig/context_dev/models/monitor_create_params.rbs +32 -3
- data/sig/context_dev/models/monitor_create_response.rbs +85 -6
- data/sig/context_dev/models/monitor_list_account_runs_response.rbs +21 -3
- data/sig/context_dev/models/monitor_list_response.rbs +85 -6
- data/sig/context_dev/models/monitor_list_runs_response.rbs +21 -3
- data/sig/context_dev/models/monitor_retrieve_change_response.rbs +8 -10
- data/sig/context_dev/models/monitor_retrieve_response.rbs +85 -6
- data/sig/context_dev/models/monitor_update_params.rbs +32 -3
- data/sig/context_dev/models/monitor_update_response.rbs +85 -6
- data/sig/context_dev/models/parse_handle_params.rbs +96 -0
- data/sig/context_dev/models/parse_handle_response.rbs +159 -0
- data/sig/context_dev/models/web_web_crawl_md_params.rbs +13 -2
- data/sig/context_dev/models/web_web_scrape_html_params.rbs +13 -2
- data/sig/context_dev/models/web_web_scrape_md_params.rbs +13 -2
- data/sig/context_dev/models/web_web_scrape_md_response.rbs +5 -0
- data/sig/context_dev/models/webhook_delivery.rbs +81 -0
- data/sig/context_dev/models.rbs +4 -0
- data/sig/context_dev/resources/parse.rbs +22 -0
- metadata +14 -2
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ContextDev
|
|
4
|
+
module Models
|
|
5
|
+
class WebhookDelivery < ContextDev::Internal::Type::BaseModel
|
|
6
|
+
# @!attribute attempted_at
|
|
7
|
+
#
|
|
8
|
+
# @return [Time]
|
|
9
|
+
required :attempted_at, Time
|
|
10
|
+
|
|
11
|
+
# @!attribute error
|
|
12
|
+
#
|
|
13
|
+
# @return [ContextDev::Models::WebhookDelivery::Error, nil]
|
|
14
|
+
required :error, -> { ContextDev::WebhookDelivery::Error }, nil?: true
|
|
15
|
+
|
|
16
|
+
# @!attribute event
|
|
17
|
+
# The event this delivery carried. Deliveries recorded before event selection
|
|
18
|
+
# existed report change.detected.
|
|
19
|
+
#
|
|
20
|
+
# @return [Symbol, ContextDev::Models::WebhookDelivery::Event]
|
|
21
|
+
required :event, enum: -> { ContextDev::WebhookDelivery::Event }
|
|
22
|
+
|
|
23
|
+
# @!attribute event_id
|
|
24
|
+
# Identifier sent in the X-Context-Id header.
|
|
25
|
+
#
|
|
26
|
+
# @return [String]
|
|
27
|
+
required :event_id, String
|
|
28
|
+
|
|
29
|
+
# @!attribute http_status
|
|
30
|
+
# The endpoint's final HTTP response status, or null when no response was
|
|
31
|
+
# received.
|
|
32
|
+
#
|
|
33
|
+
# @return [Integer, nil]
|
|
34
|
+
required :http_status, Integer, nil?: true
|
|
35
|
+
|
|
36
|
+
# @!attribute status
|
|
37
|
+
# Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
|
|
38
|
+
# response; failed means no HTTP response was received; skipped_unsafe_url means
|
|
39
|
+
# the URL failed the public-endpoint safety check.
|
|
40
|
+
#
|
|
41
|
+
# @return [Symbol, ContextDev::Models::WebhookDelivery::Status]
|
|
42
|
+
required :status, enum: -> { ContextDev::WebhookDelivery::Status }
|
|
43
|
+
|
|
44
|
+
# @!method initialize(attempted_at:, error:, event:, event_id:, http_status:, status:)
|
|
45
|
+
# Some parameter documentations has been truncated, see
|
|
46
|
+
# {ContextDev::Models::WebhookDelivery} for more details.
|
|
47
|
+
#
|
|
48
|
+
# @param attempted_at [Time]
|
|
49
|
+
#
|
|
50
|
+
# @param error [ContextDev::Models::WebhookDelivery::Error, nil]
|
|
51
|
+
#
|
|
52
|
+
# @param event [Symbol, ContextDev::Models::WebhookDelivery::Event] The event this delivery carried. Deliveries recorded before event selection exis
|
|
53
|
+
#
|
|
54
|
+
# @param event_id [String] Identifier sent in the X-Context-Id header.
|
|
55
|
+
#
|
|
56
|
+
# @param http_status [Integer, nil] The endpoint's final HTTP response status, or null when no response was received
|
|
57
|
+
#
|
|
58
|
+
# @param status [Symbol, ContextDev::Models::WebhookDelivery::Status] Delivery outcome. delivered means any 2xx response; rejected means a non-2xx res
|
|
59
|
+
|
|
60
|
+
# @see ContextDev::Models::WebhookDelivery#error
|
|
61
|
+
class Error < ContextDev::Internal::Type::BaseModel
|
|
62
|
+
# @!attribute code
|
|
63
|
+
#
|
|
64
|
+
# @return [String]
|
|
65
|
+
required :code, String
|
|
66
|
+
|
|
67
|
+
# @!attribute message
|
|
68
|
+
#
|
|
69
|
+
# @return [String]
|
|
70
|
+
required :message, String
|
|
71
|
+
|
|
72
|
+
# @!method initialize(code:, message:)
|
|
73
|
+
# @param code [String]
|
|
74
|
+
# @param message [String]
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# The event this delivery carried. Deliveries recorded before event selection
|
|
78
|
+
# existed report change.detected.
|
|
79
|
+
#
|
|
80
|
+
# @see ContextDev::Models::WebhookDelivery#event
|
|
81
|
+
module Event
|
|
82
|
+
extend ContextDev::Internal::Type::Enum
|
|
83
|
+
|
|
84
|
+
CHANGE_DETECTED = :"change.detected"
|
|
85
|
+
RUN_COMPLETED = :"run.completed"
|
|
86
|
+
|
|
87
|
+
# @!method self.values
|
|
88
|
+
# @return [Array<Symbol>]
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
|
|
92
|
+
# response; failed means no HTTP response was received; skipped_unsafe_url means
|
|
93
|
+
# the URL failed the public-endpoint safety check.
|
|
94
|
+
#
|
|
95
|
+
# @see ContextDev::Models::WebhookDelivery#status
|
|
96
|
+
module Status
|
|
97
|
+
extend ContextDev::Internal::Type::Enum
|
|
98
|
+
|
|
99
|
+
DELIVERED = :delivered
|
|
100
|
+
REJECTED = :rejected
|
|
101
|
+
FAILED = :failed
|
|
102
|
+
SKIPPED_UNSAFE_URL = :skipped_unsafe_url
|
|
103
|
+
|
|
104
|
+
# @!method self.values
|
|
105
|
+
# @return [Array<Symbol>]
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
data/lib/context_dev/models.rb
CHANGED
|
@@ -73,6 +73,8 @@ module ContextDev
|
|
|
73
73
|
|
|
74
74
|
MonitorUpdateParams = ContextDev::Models::MonitorUpdateParams
|
|
75
75
|
|
|
76
|
+
ParseHandleParams = ContextDev::Models::ParseHandleParams
|
|
77
|
+
|
|
76
78
|
UtilityPrefetchParams = ContextDev::Models::UtilityPrefetchParams
|
|
77
79
|
|
|
78
80
|
WebExtractCompetitorsParams = ContextDev::Models::WebExtractCompetitorsParams
|
|
@@ -83,6 +85,8 @@ module ContextDev
|
|
|
83
85
|
|
|
84
86
|
WebExtractStyleguideParams = ContextDev::Models::WebExtractStyleguideParams
|
|
85
87
|
|
|
88
|
+
WebhookDelivery = ContextDev::Models::WebhookDelivery
|
|
89
|
+
|
|
86
90
|
WebScreenshotParams = ContextDev::Models::WebScreenshotParams
|
|
87
91
|
|
|
88
92
|
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.
|
|
7
|
-
# MonitorsChangeDetectedWebhookPayload
|
|
6
|
+
# changes. Webhook payloads are documented by the
|
|
7
|
+
# MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload
|
|
8
|
+
# schemas.
|
|
8
9
|
class Monitors
|
|
9
10
|
# Some parameter documentations has been truncated, see
|
|
10
11
|
# {ContextDev::Models::MonitorCreateParams} for more details.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ContextDev
|
|
4
|
+
module Resources
|
|
5
|
+
class Parse
|
|
6
|
+
# Some parameter documentations has been truncated, see
|
|
7
|
+
# {ContextDev::Models::ParseHandleParams} for more details.
|
|
8
|
+
#
|
|
9
|
+
# Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes
|
|
10
|
+
# into LLM-usable Markdown.
|
|
11
|
+
#
|
|
12
|
+
# @overload handle(body:, base_url: nil, extension: nil, filename: nil, include_images: nil, include_links: nil, ocr: nil, pdf_end: nil, pdf_start: nil, shorten_base64_images: nil, use_main_content_only: nil, request_options: {})
|
|
13
|
+
#
|
|
14
|
+
# @param body [Pathname, StringIO, IO, String, ContextDev::FilePart] Body param
|
|
15
|
+
#
|
|
16
|
+
# @param base_url [String] Query param: Optional HTTP(S) source document URL used to resolve relative links
|
|
17
|
+
#
|
|
18
|
+
# @param extension [String] Query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html,
|
|
19
|
+
#
|
|
20
|
+
# @param filename [String] Query param: Optional filename hint used to infer the extension when extension i
|
|
21
|
+
#
|
|
22
|
+
# @param include_images [Boolean] Query param: Include image references in Markdown output
|
|
23
|
+
#
|
|
24
|
+
# @param include_links [Boolean] Query param: Preserve hyperlinks in Markdown output
|
|
25
|
+
#
|
|
26
|
+
# @param ocr [Boolean] Query param: When true for PDF inputs, detect and OCR images embedded in the sel
|
|
27
|
+
#
|
|
28
|
+
# @param pdf_end [Integer] Query param: Last 1-based PDF page to parse. When omitted, parsing ends at the l
|
|
29
|
+
#
|
|
30
|
+
# @param pdf_start [Integer] Query param: First 1-based PDF page to parse. When omitted, parsing starts at th
|
|
31
|
+
#
|
|
32
|
+
# @param shorten_base64_images [Boolean] Query param: Shorten base64-encoded image data in the Markdown output
|
|
33
|
+
#
|
|
34
|
+
# @param use_main_content_only [Boolean] Query param: Extract only the main content from HTML-like inputs
|
|
35
|
+
#
|
|
36
|
+
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
37
|
+
#
|
|
38
|
+
# @return [ContextDev::Models::ParseHandleResponse]
|
|
39
|
+
#
|
|
40
|
+
# @see ContextDev::Models::ParseHandleParams
|
|
41
|
+
def handle(params)
|
|
42
|
+
parsed, options = ContextDev::ParseHandleParams.dump_request(params)
|
|
43
|
+
query = ContextDev::Internal::Util.encode_query_params(parsed.except(:body))
|
|
44
|
+
@client.request(
|
|
45
|
+
method: :post,
|
|
46
|
+
path: "parse",
|
|
47
|
+
query: query,
|
|
48
|
+
headers: {"content-type" => "application/octet-stream"},
|
|
49
|
+
body: parsed[:body],
|
|
50
|
+
model: ContextDev::Models::ParseHandleResponse,
|
|
51
|
+
options: options
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# @api private
|
|
56
|
+
#
|
|
57
|
+
# @param client [ContextDev::Client]
|
|
58
|
+
def initialize(client:)
|
|
59
|
+
@client = client
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -289,7 +289,7 @@ module ContextDev
|
|
|
289
289
|
#
|
|
290
290
|
# @param max_pages [Integer] Maximum number of pages to crawl. Hard cap: 500.
|
|
291
291
|
#
|
|
292
|
-
# @param pdf [ContextDev::Models::WebWebCrawlMdParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and
|
|
292
|
+
# @param pdf [ContextDev::Models::WebWebCrawlMdParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and embedded-image
|
|
293
293
|
#
|
|
294
294
|
# @param settle_animations [Boolean] When true, waits briefly for CSS and transition animations to settle before extr
|
|
295
295
|
#
|
|
@@ -342,7 +342,7 @@ module ContextDev
|
|
|
342
342
|
#
|
|
343
343
|
# @param max_age_ms [Integer] Return a cached result if a prior scrape for the same parameters exists and is y
|
|
344
344
|
#
|
|
345
|
-
# @param pdf [ContextDev::Models::WebWebScrapeHTMLParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and
|
|
345
|
+
# @param pdf [ContextDev::Models::WebWebScrapeHTMLParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and embedded-image
|
|
346
346
|
#
|
|
347
347
|
# @param settle_animations [Boolean] When true, waits briefly for CSS and transition animations to settle before extr
|
|
348
348
|
#
|
|
@@ -426,7 +426,22 @@ module ContextDev
|
|
|
426
426
|
# Some parameter documentations has been truncated, see
|
|
427
427
|
# {ContextDev::Models::WebWebScrapeMdParams} for more details.
|
|
428
428
|
#
|
|
429
|
-
# Scrapes the given URL into LLM usable Markdown.
|
|
429
|
+
# Scrapes the given URL into LLM usable Markdown. Inspect key_metadata on JSON
|
|
430
|
+
# responses from a recognized API key; use error_code to distinguish stable
|
|
431
|
+
# failure categories.
|
|
432
|
+
#
|
|
433
|
+
# ### Billing & errors
|
|
434
|
+
#
|
|
435
|
+
# | HTTP status | Billed? | Meaning |
|
|
436
|
+
# | ----------- | -------------- | ---------------------------------------------------------------------------------------- |
|
|
437
|
+
# | 200 | Yes — 1 credit | Successful scrape, including a zero-length result when includeSelectors matched nothing |
|
|
438
|
+
# | 400 | No | Invalid input, skipped PDF, or the page could not be scraped |
|
|
439
|
+
# | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code |
|
|
440
|
+
# | 404 | No | Target page returned or fingerprinted as not found |
|
|
441
|
+
# | 408 | No | Request timed out |
|
|
442
|
+
# | 415 | No | Unsupported content type |
|
|
443
|
+
# | 429 | No | Per-minute rate limit exceeded; honor Retry-After |
|
|
444
|
+
# | 500 | No | Internal error |
|
|
430
445
|
#
|
|
431
446
|
# @overload web_scrape_md(url:, country: nil, exclude_selectors: nil, headers: nil, include_frames: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, settle_animations: nil, shorten_base64_images: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil, request_options: {})
|
|
432
447
|
#
|
|
@@ -448,7 +463,7 @@ module ContextDev
|
|
|
448
463
|
#
|
|
449
464
|
# @param max_age_ms [Integer] Return a cached result if a prior scrape for the same parameters exists and is y
|
|
450
465
|
#
|
|
451
|
-
# @param pdf [ContextDev::Models::WebWebScrapeMdParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and
|
|
466
|
+
# @param pdf [ContextDev::Models::WebWebScrapeMdParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and embedded-image
|
|
452
467
|
#
|
|
453
468
|
# @param settle_animations [Boolean] When true, waits briefly for CSS and transition animations to settle before conv
|
|
454
469
|
#
|
data/lib/context_dev/version.rb
CHANGED
data/lib/context_dev.rb
CHANGED
|
@@ -86,6 +86,8 @@ require_relative "context_dev/models/monitor_run_params"
|
|
|
86
86
|
require_relative "context_dev/models/monitor_run_response"
|
|
87
87
|
require_relative "context_dev/models/monitor_update_params"
|
|
88
88
|
require_relative "context_dev/models/monitor_update_response"
|
|
89
|
+
require_relative "context_dev/models/parse_handle_params"
|
|
90
|
+
require_relative "context_dev/models/parse_handle_response"
|
|
89
91
|
require_relative "context_dev/models/utility_prefetch_params"
|
|
90
92
|
require_relative "context_dev/models/utility_prefetch_response"
|
|
91
93
|
require_relative "context_dev/models/web_extract_competitors_params"
|
|
@@ -96,6 +98,7 @@ require_relative "context_dev/models/web_extract_params"
|
|
|
96
98
|
require_relative "context_dev/models/web_extract_response"
|
|
97
99
|
require_relative "context_dev/models/web_extract_styleguide_params"
|
|
98
100
|
require_relative "context_dev/models/web_extract_styleguide_response"
|
|
101
|
+
require_relative "context_dev/models/webhook_delivery"
|
|
99
102
|
require_relative "context_dev/models/web_screenshot_params"
|
|
100
103
|
require_relative "context_dev/models/web_screenshot_response"
|
|
101
104
|
require_relative "context_dev/models/web_search_params"
|
|
@@ -115,5 +118,6 @@ require_relative "context_dev/resources/ai"
|
|
|
115
118
|
require_relative "context_dev/resources/brand"
|
|
116
119
|
require_relative "context_dev/resources/industry"
|
|
117
120
|
require_relative "context_dev/resources/monitors"
|
|
121
|
+
require_relative "context_dev/resources/parse"
|
|
118
122
|
require_relative "context_dev/resources/utility"
|
|
119
123
|
require_relative "context_dev/resources/web"
|
data/rbi/context_dev/client.rbi
CHANGED
|
@@ -13,6 +13,9 @@ module ContextDev
|
|
|
13
13
|
sig { returns(String) }
|
|
14
14
|
attr_reader :api_key
|
|
15
15
|
|
|
16
|
+
sig { returns(ContextDev::Resources::Parse) }
|
|
17
|
+
attr_reader :parse
|
|
18
|
+
|
|
16
19
|
sig { returns(ContextDev::Resources::Web) }
|
|
17
20
|
attr_reader :web
|
|
18
21
|
|
|
@@ -29,8 +32,9 @@ module ContextDev
|
|
|
29
32
|
attr_reader :utility
|
|
30
33
|
|
|
31
34
|
# Monitor pages, sitemaps, and extracted website data for exact or semantic
|
|
32
|
-
# changes.
|
|
33
|
-
# MonitorsChangeDetectedWebhookPayload
|
|
35
|
+
# changes. Webhook payloads are documented by the
|
|
36
|
+
# MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload
|
|
37
|
+
# schemas.
|
|
34
38
|
sig { returns(ContextDev::Resources::Monitors) }
|
|
35
39
|
attr_reader :monitors
|
|
36
40
|
|
|
@@ -195,9 +195,9 @@ module ContextDev
|
|
|
195
195
|
sig { params(confidence_threshold: Float).void }
|
|
196
196
|
attr_writer :confidence_threshold
|
|
197
197
|
|
|
198
|
-
# Detect meaning-level changes to
|
|
199
|
-
# paraphrase-only differences.
|
|
200
|
-
# target's `
|
|
198
|
+
# Detect meaning-level changes to tracked page content, ignoring cosmetic or
|
|
199
|
+
# paraphrase-only differences. Which changes are meaningful is judged against the
|
|
200
|
+
# extract target's `instructions` (and `schema`, when provided).
|
|
201
201
|
sig do
|
|
202
202
|
params(confidence_threshold: Float, type: Symbol).returns(
|
|
203
203
|
T.attached_class
|
|
@@ -522,9 +522,14 @@ module ContextDev
|
|
|
522
522
|
sig { params(max_pages: Integer).void }
|
|
523
523
|
attr_writer :max_pages
|
|
524
524
|
|
|
525
|
-
# JSON Schema describing the data you care about. It
|
|
526
|
-
# selected for tracking
|
|
527
|
-
#
|
|
525
|
+
# JSON Schema describing the data you care about. It is used three ways: it guides
|
|
526
|
+
# which pages are selected for tracking, it gives the change judge extra context
|
|
527
|
+
# on which changes matter (alongside `instructions`), and it defines the shape of
|
|
528
|
+
# the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
|
|
529
|
+
# about once a day). It is not a response format for changes: change events and
|
|
530
|
+
# webhook payloads always contain diffs, summaries, and evidence excerpts — never
|
|
531
|
+
# data in this schema's shape. If omitted, a default summary + key-points schema
|
|
532
|
+
# is used.
|
|
528
533
|
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
529
534
|
attr_reader :schema
|
|
530
535
|
|
|
@@ -534,8 +539,8 @@ module ContextDev
|
|
|
534
539
|
# Watch the monitor-relevant pages of a site for meaningful changes. A crawl
|
|
535
540
|
# guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
|
|
536
541
|
# track; each run re-checks exactly those pages, and confirmed content changes are
|
|
537
|
-
# judged against the monitor's instructions
|
|
538
|
-
# a periodic re-discovery crawl.
|
|
542
|
+
# judged for relevance against the monitor's `instructions` (and `schema`, when
|
|
543
|
+
# provided). The tracked page set is refreshed by a periodic re-discovery crawl.
|
|
539
544
|
sig do
|
|
540
545
|
params(
|
|
541
546
|
instructions: String,
|
|
@@ -558,9 +563,14 @@ module ContextDev
|
|
|
558
563
|
max_depth: nil,
|
|
559
564
|
# Maximum number of pages to track.
|
|
560
565
|
max_pages: nil,
|
|
561
|
-
# JSON Schema describing the data you care about. It
|
|
562
|
-
# selected for tracking
|
|
563
|
-
#
|
|
566
|
+
# JSON Schema describing the data you care about. It is used three ways: it guides
|
|
567
|
+
# which pages are selected for tracking, it gives the change judge extra context
|
|
568
|
+
# on which changes matter (alongside `instructions`), and it defines the shape of
|
|
569
|
+
# the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
|
|
570
|
+
# about once a day). It is not a response format for changes: change events and
|
|
571
|
+
# webhook payloads always contain diffs, summaries, and evidence excerpts — never
|
|
572
|
+
# data in this schema's shape. If omitted, a default summary + key-points schema
|
|
573
|
+
# is used.
|
|
564
574
|
schema: nil,
|
|
565
575
|
type: :extract
|
|
566
576
|
)
|
|
@@ -621,20 +631,100 @@ module ContextDev
|
|
|
621
631
|
)
|
|
622
632
|
end
|
|
623
633
|
|
|
624
|
-
# Webhook URL
|
|
634
|
+
# Webhook URL events are delivered to.
|
|
625
635
|
sig { returns(String) }
|
|
626
636
|
attr_accessor :url
|
|
627
637
|
|
|
628
|
-
|
|
638
|
+
# Events delivered to this endpoint. `change.detected` fires only when a run
|
|
639
|
+
# detects a change; `run.completed` fires on every completed run — including runs
|
|
640
|
+
# that detected no change — and embeds the change when one was detected. Defaults
|
|
641
|
+
# to `["change.detected"]` when omitted.
|
|
642
|
+
sig do
|
|
643
|
+
returns(
|
|
644
|
+
T.nilable(
|
|
645
|
+
T::Array[
|
|
646
|
+
ContextDev::MonitorCreateParams::Webhook::Event::OrSymbol
|
|
647
|
+
]
|
|
648
|
+
)
|
|
649
|
+
)
|
|
650
|
+
end
|
|
651
|
+
attr_reader :events
|
|
652
|
+
|
|
653
|
+
sig do
|
|
654
|
+
params(
|
|
655
|
+
events:
|
|
656
|
+
T::Array[
|
|
657
|
+
ContextDev::MonitorCreateParams::Webhook::Event::OrSymbol
|
|
658
|
+
]
|
|
659
|
+
).void
|
|
660
|
+
end
|
|
661
|
+
attr_writer :events
|
|
662
|
+
|
|
663
|
+
sig do
|
|
664
|
+
params(
|
|
665
|
+
url: String,
|
|
666
|
+
events:
|
|
667
|
+
T::Array[
|
|
668
|
+
ContextDev::MonitorCreateParams::Webhook::Event::OrSymbol
|
|
669
|
+
]
|
|
670
|
+
).returns(T.attached_class)
|
|
671
|
+
end
|
|
629
672
|
def self.new(
|
|
630
|
-
# Webhook URL
|
|
631
|
-
url
|
|
673
|
+
# Webhook URL events are delivered to.
|
|
674
|
+
url:,
|
|
675
|
+
# Events delivered to this endpoint. `change.detected` fires only when a run
|
|
676
|
+
# detects a change; `run.completed` fires on every completed run — including runs
|
|
677
|
+
# that detected no change — and embeds the change when one was detected. Defaults
|
|
678
|
+
# to `["change.detected"]` when omitted.
|
|
679
|
+
events: nil
|
|
632
680
|
)
|
|
633
681
|
end
|
|
634
682
|
|
|
635
|
-
sig
|
|
683
|
+
sig do
|
|
684
|
+
override.returns(
|
|
685
|
+
{
|
|
686
|
+
url: String,
|
|
687
|
+
events:
|
|
688
|
+
T::Array[
|
|
689
|
+
ContextDev::MonitorCreateParams::Webhook::Event::OrSymbol
|
|
690
|
+
],
|
|
691
|
+
secret: String
|
|
692
|
+
}
|
|
693
|
+
)
|
|
694
|
+
end
|
|
636
695
|
def to_hash
|
|
637
696
|
end
|
|
697
|
+
|
|
698
|
+
module Event
|
|
699
|
+
extend ContextDev::Internal::Type::Enum
|
|
700
|
+
|
|
701
|
+
TaggedSymbol =
|
|
702
|
+
T.type_alias do
|
|
703
|
+
T.all(Symbol, ContextDev::MonitorCreateParams::Webhook::Event)
|
|
704
|
+
end
|
|
705
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
706
|
+
|
|
707
|
+
CHANGE_DETECTED =
|
|
708
|
+
T.let(
|
|
709
|
+
:"change.detected",
|
|
710
|
+
ContextDev::MonitorCreateParams::Webhook::Event::TaggedSymbol
|
|
711
|
+
)
|
|
712
|
+
RUN_COMPLETED =
|
|
713
|
+
T.let(
|
|
714
|
+
:"run.completed",
|
|
715
|
+
ContextDev::MonitorCreateParams::Webhook::Event::TaggedSymbol
|
|
716
|
+
)
|
|
717
|
+
|
|
718
|
+
sig do
|
|
719
|
+
override.returns(
|
|
720
|
+
T::Array[
|
|
721
|
+
ContextDev::MonitorCreateParams::Webhook::Event::TaggedSymbol
|
|
722
|
+
]
|
|
723
|
+
)
|
|
724
|
+
end
|
|
725
|
+
def self.values
|
|
726
|
+
end
|
|
727
|
+
end
|
|
638
728
|
end
|
|
639
729
|
end
|
|
640
730
|
end
|