diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 65f558e7..656a2ef1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.0.0" + ".": "2.1.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index f52f4302..6b4e1c45 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-7dbd739a81e6aaf7fc7ef1858606e7d572d309af55082a66431d9292e655e66f.yml -openapi_spec_hash: a6374d5d718a7bd9d3d54fb657e2bd9d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-51ebe668b198157ccb18984017dd2fe35f7675220e8b933b03325b3c459ef2a6.yml +openapi_spec_hash: b3ed94bd6b59d4e32fc2c5aa8187d6b2 config_hash: ff35e224e809656528c44163aa41bebd diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f8e7111..d3d23d11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 2.1.0 (2026-07-08) + +Full Changelog: [v2.0.0...v2.1.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v2.0.0...v2.1.0) + +### Features + +* **api:** api update ([7fe6a1f](https://github.com/context-dot-dev/context-ruby-sdk/commit/7fe6a1fbd2977c0669b7623ba96533b43789b8ae)) +* **api:** api update ([cd5b872](https://github.com/context-dot-dev/context-ruby-sdk/commit/cd5b8725dcd7fb06d7bd684aa4ce11b81ca4409a)) +* **api:** api update ([bdc4962](https://github.com/context-dot-dev/context-ruby-sdk/commit/bdc4962f436086be52293ea489960b6b6158726b)) +* **api:** api update ([531ccbe](https://github.com/context-dot-dev/context-ruby-sdk/commit/531ccbeb9770c4340641353859064b50aa6d72bc)) + ## 2.0.0 (2026-07-06) Full Changelog: [v1.36.0...v2.0.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.36.0...v2.0.0) diff --git a/Gemfile.lock b/Gemfile.lock index eb9b2de9..1bd5153d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - context.dev (2.0.0) + context.dev (2.1.0) cgi connection_pool diff --git a/README.md b/README.md index 86d0d37d..b6f51859 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "context.dev", "~> 2.0.0" +gem "context.dev", "~> 2.1.0" ``` diff --git a/lib/context_dev/models/brand_retrieve_params.rb b/lib/context_dev/models/brand_retrieve_params.rb index dd108b90..fc3b3815 100644 --- a/lib/context_dev/models/brand_retrieve_params.rb +++ b/lib/context_dev/models/brand_retrieve_params.rb @@ -10,11 +10,11 @@ class BrandRetrieveParams < ContextDev::Internal::Type::BaseModel # @!attribute body # Exactly one lookup type must be provided. # - # @return [ContextDev::Models::BrandRetrieveParams::Body::ByDomain, ContextDev::Models::BrandRetrieveParams::Body::ByName, ContextDev::Models::BrandRetrieveParams::Body::ByEmail, ContextDev::Models::BrandRetrieveParams::Body::ByTicker, ContextDev::Models::BrandRetrieveParams::Body::ByTransaction] + # @return [ContextDev::Models::BrandRetrieveParams::Body::ByDomain, ContextDev::Models::BrandRetrieveParams::Body::ByName, ContextDev::Models::BrandRetrieveParams::Body::ByEmail, ContextDev::Models::BrandRetrieveParams::Body::ByTicker, ContextDev::Models::BrandRetrieveParams::Body::ByDirectURL, ContextDev::Models::BrandRetrieveParams::Body::ByTransaction] required :body, union: -> { ContextDev::BrandRetrieveParams::Body } # @!method initialize(body:, request_options: {}) - # @param body [ContextDev::Models::BrandRetrieveParams::Body::ByDomain, ContextDev::Models::BrandRetrieveParams::Body::ByName, ContextDev::Models::BrandRetrieveParams::Body::ByEmail, ContextDev::Models::BrandRetrieveParams::Body::ByTicker, ContextDev::Models::BrandRetrieveParams::Body::ByTransaction] Exactly one lookup type must be provided. + # @param body [ContextDev::Models::BrandRetrieveParams::Body::ByDomain, ContextDev::Models::BrandRetrieveParams::Body::ByName, ContextDev::Models::BrandRetrieveParams::Body::ByEmail, ContextDev::Models::BrandRetrieveParams::Body::ByTicker, ContextDev::Models::BrandRetrieveParams::Body::ByDirectURL, ContextDev::Models::BrandRetrieveParams::Body::ByTransaction] Exactly one lookup type must be provided. # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] @@ -36,6 +36,9 @@ module Body # Retrieve brand data by stock ticker. Cannot be combined with domain, name, or email. variant :by_ticker, -> { ContextDev::BrandRetrieveParams::Body::ByTicker } + # Retrieve brand data by fetching the provided URL directly. Note: if you use this, brand data is fetched only from the provided URL — not from the entire internet — so results are limited to what that single page contains. No domain resolution, database lookup, or cross-source enrichment is performed. Cannot be combined with domain, name, email, or ticker. + variant :by_direct_url, -> { ContextDev::BrandRetrieveParams::Body::ByDirectURL } + # Identify brand data from a transaction descriptor. Cannot be combined with domain, name, email, or ticker. variant :by_transaction, -> { ContextDev::BrandRetrieveParams::Body::ByTransaction } @@ -824,6 +827,46 @@ module ForceLanguage end end + class ByDirectURL < ContextDev::Internal::Type::BaseModel + # @!attribute direct_url + # Full http(s) URL to fetch brand data from (e.g., + # 'https://stripe.com/enterprise'). Only this URL is fetched — not the entire + # internet. + # + # @return [String] + required :direct_url, String + + # @!attribute type + # Discriminator for direct-URL-based brand retrieval. + # + # @return [Symbol, :by_direct_url] + required :type, const: :by_direct_url + + # @!attribute timeout_ms + # Optional timeout in milliseconds for the request. If the request takes longer + # than this value, it will be aborted with a 408 status code. Maximum allowed + # value is 300000ms (5 minutes). + # + # @return [Integer, nil] + optional :timeout_ms, Integer, api_name: :timeoutMS + + # @!method initialize(direct_url:, timeout_ms: nil, type: :by_direct_url) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BrandRetrieveParams::Body::ByDirectURL} for more details. + # + # Retrieve brand data by fetching the provided URL directly. Note: if you use + # this, brand data is fetched only from the provided URL — not from the entire + # internet — so results are limited to what that single page contains. No domain + # resolution, database lookup, or cross-source enrichment is performed. Cannot be + # combined with domain, name, email, or ticker. + # + # @param direct_url [String] Full http(s) URL to fetch brand data from (e.g., 'https://stripe.com/enterprise' + # + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th + # + # @param type [Symbol, :by_direct_url] Discriminator for direct-URL-based brand retrieval. + end + class ByTransaction < ContextDev::Internal::Type::BaseModel # @!attribute transaction_info # Transaction information to identify the brand. @@ -1049,7 +1092,7 @@ module ForceLanguage end # @!method self.variants - # @return [Array(ContextDev::Models::BrandRetrieveParams::Body::ByDomain, ContextDev::Models::BrandRetrieveParams::Body::ByName, ContextDev::Models::BrandRetrieveParams::Body::ByEmail, ContextDev::Models::BrandRetrieveParams::Body::ByTicker, ContextDev::Models::BrandRetrieveParams::Body::ByTransaction)] + # @return [Array(ContextDev::Models::BrandRetrieveParams::Body::ByDomain, ContextDev::Models::BrandRetrieveParams::Body::ByName, ContextDev::Models::BrandRetrieveParams::Body::ByEmail, ContextDev::Models::BrandRetrieveParams::Body::ByTicker, ContextDev::Models::BrandRetrieveParams::Body::ByDirectURL, ContextDev::Models::BrandRetrieveParams::Body::ByTransaction)] end end end diff --git a/lib/context_dev/models/monitor_create_params.rb b/lib/context_dev/models/monitor_create_params.rb index fe1368b1..9817736e 100644 --- a/lib/context_dev/models/monitor_create_params.rb +++ b/lib/context_dev/models/monitor_create_params.rb @@ -79,7 +79,7 @@ module ChangeDetection # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. variant :exact, -> { ContextDev::MonitorCreateParams::ChangeDetection::Exact } - # Detect meaning-level changes that match a natural language query. + # Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. variant :semantic, -> { ContextDev::MonitorCreateParams::ChangeDetection::Semantic } class Exact < ContextDev::Internal::Type::BaseModel @@ -96,11 +96,6 @@ class Exact < ContextDev::Internal::Type::BaseModel end class Semantic < ContextDev::Internal::Type::BaseModel - # @!attribute query - # - # @return [String] - required :query, String - # @!attribute type # # @return [Symbol, :semantic] @@ -111,10 +106,11 @@ class Semantic < ContextDev::Internal::Type::BaseModel # @return [Float, nil] optional :confidence_threshold, Float - # @!method initialize(query:, confidence_threshold: nil, type: :semantic) - # Detect meaning-level changes that match a natural language query. + # @!method initialize(confidence_threshold: nil, type: :semantic) + # Detect meaning-level changes to the extracted data, ignoring cosmetic or + # paraphrase-only differences. What is watched is determined by the extract + # target's `schema` and `instructions`. # - # @param query [String] # @param confidence_threshold [Float] # @param type [Symbol, :semantic] end @@ -188,10 +184,10 @@ module Target # Watch a single web page. variant :page, -> { ContextDev::MonitorCreateParams::Target::Page } - # 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. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. variant :sitemap, -> { ContextDev::MonitorCreateParams::Target::Sitemap } - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. variant :extract, -> { ContextDev::MonitorCreateParams::Target::Extract } class Page < ContextDev::Internal::Type::BaseModel @@ -254,8 +250,9 @@ class Sitemap < ContextDev::Internal::Type::BaseModel # @!method initialize(url:, exclude: nil, include: nil, max_urls: nil, type: :sitemap) # 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. A new URL set must be observed on two - # consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. # # @param url [String] Sitemap URL to monitor. # @@ -269,6 +266,13 @@ class Sitemap < ContextDev::Internal::Type::BaseModel end class Extract < ContextDev::Internal::Type::BaseModel + # @!attribute instructions + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + # + # @return [String] + required :instructions, String + # @!attribute type # # @return [Symbol, :extract] @@ -285,12 +289,6 @@ class Extract < ContextDev::Internal::Type::BaseModel # @return [Boolean, nil] optional :follow_subdomains, ContextDev::Internal::Type::Boolean - # @!attribute instructions - # Optional natural-language instructions guiding what to extract. - # - # @return [String, nil] - optional :instructions, String - # @!attribute max_depth # Optional maximum link depth from the starting URL (0 = only the starting page). # @@ -298,35 +296,40 @@ class Extract < ContextDev::Internal::Type::BaseModel optional :max_depth, Integer # @!attribute max_pages - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. # # @return [Integer, nil] optional :max_pages, Integer # @!attribute schema - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. # # @return [Hash{Symbol=>Object}, nil] optional :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown] - # @!method initialize(url:, follow_subdomains: nil, instructions: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract) + # @!method initialize(instructions:, url:, follow_subdomains: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract) # Some parameter documentations has been truncated, see # {ContextDev::Models::MonitorCreateParams::Target::Extract} for more details. # - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl + # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to + # track; each run re-checks exactly those pages, and confirmed content changes are + # judged against the monitor's instructions. The tracked page set is refreshed by + # a periodic re-discovery crawl. + # + # @param instructions [String] Natural-language instructions guiding which pages and facts to track and which c # # @param url [String] Root URL to extract structured data from. # # @param follow_subdomains [Boolean] # - # @param instructions [String] Optional natural-language instructions guiding what to extract. - # # @param max_depth [Integer] Optional maximum link depth from the starting URL (0 = only the starting page). # - # @param max_pages [Integer] Maximum number of pages to analyze during extraction. + # @param max_pages [Integer] Maximum number of pages to track. # - # @param schema [Hash{Symbol=>Object}] JSON Schema describing the structured data to extract and watch for changes. If + # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It guides which pages are select # # @param type [Symbol, :extract] end diff --git a/lib/context_dev/models/monitor_create_response.rb b/lib/context_dev/models/monitor_create_response.rb index 2f91665f..95104c97 100644 --- a/lib/context_dev/models/monitor_create_response.rb +++ b/lib/context_dev/models/monitor_create_response.rb @@ -61,6 +61,15 @@ class MonitorCreateResponse < ContextDev::Internal::Type::BaseModel # @return [Time] required :updated_at, Time + # @!attribute baseline + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + # + # @return [ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsExtractBaseline, nil] + optional :baseline, union: -> { ContextDev::Models::MonitorCreateResponse::Baseline }, nil?: true + # @!attribute last_change_at # # @return [Time, nil] @@ -94,7 +103,7 @@ class MonitorCreateResponse < ContextDev::Internal::Type::BaseModel # @return [ContextDev::Models::MonitorCreateResponse::Webhook, nil] optional :webhook, -> { ContextDev::Models::MonitorCreateResponse::Webhook }, nil?: true - # @!method initialize(id:, change_detection:, created_at:, mode:, name:, schedule:, status:, target:, updated_at:, last_change_at: nil, last_error: nil, last_run_at: nil, next_run_at: nil, tags: nil, webhook: nil) + # @!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) # Some parameter documentations has been truncated, see # {ContextDev::Models::MonitorCreateResponse} for more details. # @@ -119,6 +128,8 @@ class MonitorCreateResponse < ContextDev::Internal::Type::BaseModel # # @param updated_at [Time] # + # @param baseline [ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsExtractBaseline, nil] Current baseline: the last observed value the monitor compares new snapshots aga + # # @param last_change_at [Time, nil] # # @param last_error [ContextDev::Models::MonitorCreateResponse::LastError, nil] Error from the most recent failed run; null when the last run succeeded. @@ -142,7 +153,7 @@ module ChangeDetection # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. variant :exact, -> { ContextDev::Models::MonitorCreateResponse::ChangeDetection::Exact } - # Detect meaning-level changes that match a natural language query. + # Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. variant :semantic, -> { ContextDev::Models::MonitorCreateResponse::ChangeDetection::Semantic } class Exact < ContextDev::Internal::Type::BaseModel @@ -159,11 +170,6 @@ class Exact < ContextDev::Internal::Type::BaseModel end class Semantic < ContextDev::Internal::Type::BaseModel - # @!attribute query - # - # @return [String] - required :query, String - # @!attribute type # # @return [Symbol, :semantic] @@ -174,10 +180,11 @@ class Semantic < ContextDev::Internal::Type::BaseModel # @return [Float, nil] optional :confidence_threshold, Float - # @!method initialize(query:, confidence_threshold: nil, type: :semantic) - # Detect meaning-level changes that match a natural language query. + # @!method initialize(confidence_threshold: nil, type: :semantic) + # Detect meaning-level changes to the extracted data, ignoring cosmetic or + # paraphrase-only differences. What is watched is determined by the extract + # target's `schema` and `instructions`. # - # @param query [String] # @param confidence_threshold [Float] # @param type [Symbol, :semantic] end @@ -285,10 +292,10 @@ module Target # Watch a single web page. variant :page, -> { ContextDev::Models::MonitorCreateResponse::Target::Page } - # 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. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. variant :sitemap, -> { ContextDev::Models::MonitorCreateResponse::Target::Sitemap } - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. variant :extract, -> { ContextDev::Models::MonitorCreateResponse::Target::Extract } class Page < ContextDev::Internal::Type::BaseModel @@ -351,8 +358,9 @@ class Sitemap < ContextDev::Internal::Type::BaseModel # @!method initialize(url:, exclude: nil, include: nil, max_urls: nil, type: :sitemap) # 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. A new URL set must be observed on two - # consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. # # @param url [String] Sitemap URL to monitor. # @@ -366,6 +374,13 @@ class Sitemap < ContextDev::Internal::Type::BaseModel end class Extract < ContextDev::Internal::Type::BaseModel + # @!attribute instructions + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + # + # @return [String] + required :instructions, String + # @!attribute type # # @return [Symbol, :extract] @@ -382,12 +397,6 @@ class Extract < ContextDev::Internal::Type::BaseModel # @return [Boolean, nil] optional :follow_subdomains, ContextDev::Internal::Type::Boolean - # @!attribute instructions - # Optional natural-language instructions guiding what to extract. - # - # @return [String, nil] - optional :instructions, String - # @!attribute max_depth # Optional maximum link depth from the starting URL (0 = only the starting page). # @@ -395,35 +404,40 @@ class Extract < ContextDev::Internal::Type::BaseModel optional :max_depth, Integer # @!attribute max_pages - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. # # @return [Integer, nil] optional :max_pages, Integer # @!attribute schema - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. # # @return [Hash{Symbol=>Object}, nil] optional :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown] - # @!method initialize(url:, follow_subdomains: nil, instructions: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract) + # @!method initialize(instructions:, url:, follow_subdomains: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract) # Some parameter documentations has been truncated, see # {ContextDev::Models::MonitorCreateResponse::Target::Extract} for more details. # - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl + # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to + # track; each run re-checks exactly those pages, and confirmed content changes are + # judged against the monitor's instructions. The tracked page set is refreshed by + # a periodic re-discovery crawl. + # + # @param instructions [String] Natural-language instructions guiding which pages and facts to track and which c # # @param url [String] Root URL to extract structured data from. # # @param follow_subdomains [Boolean] # - # @param instructions [String] Optional natural-language instructions guiding what to extract. - # # @param max_depth [Integer] Optional maximum link depth from the starting URL (0 = only the starting page). # - # @param max_pages [Integer] Maximum number of pages to analyze during extraction. + # @param max_pages [Integer] Maximum number of pages to track. # - # @param schema [Hash{Symbol=>Object}] JSON Schema describing the structured data to extract and watch for changes. If + # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It guides which pages are select # # @param type [Symbol, :extract] end @@ -432,6 +446,116 @@ class Extract < ContextDev::Internal::Type::BaseModel # @return [Array(ContextDev::Models::MonitorCreateResponse::Target::Page, ContextDev::Models::MonitorCreateResponse::Target::Sitemap, ContextDev::Models::MonitorCreateResponse::Target::Extract)] end + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + # + # @see ContextDev::Models::MonitorCreateResponse#baseline + module Baseline + extend ContextDev::Internal::Type::Union + + # Current baseline of a `page` monitor: the visible page text as last observed. + variant -> { ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsPageBaseline } + + # Current baseline of a `sitemap` monitor: the normalized URL set as last observed. + variant -> { ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsSitemapBaseline } + + # Current baseline of an `extract` monitor: the pages it tracks and the structured data as last extracted. + variant -> { ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsExtractBaseline } + + class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel + # @!attribute captured_at + # When this baseline was last captured or replaced. + # + # @return [Time] + required :captured_at, Time + + # @!attribute text + # The page's visible text as last observed. + # + # @return [String] + required :text, String + + # @!method initialize(captured_at:, text:) + # Current baseline of a `page` monitor: the visible page text as last observed. + # + # @param captured_at [Time] When this baseline was last captured or replaced. + # + # @param text [String] The page's visible text as last observed. + end + + class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel + # @!attribute captured_at + # When this baseline was last captured or replaced. + # + # @return [Time] + required :captured_at, Time + + # @!attribute url_count + # Number of URLs in the baseline. + # + # @return [Integer] + required :url_count, Integer + + # @!attribute urls + # The sitemap URLs as last observed (sorted, normalized). + # + # @return [Array] + required :urls, ContextDev::Internal::Type::ArrayOf[String] + + # @!method initialize(captured_at:, url_count:, urls:) + # Current baseline of a `sitemap` monitor: the normalized URL set as last + # observed. + # + # @param captured_at [Time] When this baseline was last captured or replaced. + # + # @param url_count [Integer] Number of URLs in the baseline. + # + # @param urls [Array] The sitemap URLs as last observed (sorted, normalized). + end + + class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel + # @!attribute captured_at + # When this baseline was last captured or replaced. + # + # @return [Time] + required :captured_at, Time + + # @!attribute data + # The extracted structured data, matching the monitor's extraction schema (same + # shape as the /web/extract endpoint's `data`). Refreshed when the monitor + # re-discovers its page set (at most about once a day); `null` when no extraction + # has been captured yet. + # + # @return [Object] + required :data, ContextDev::Internal::Type::Unknown + + # @!attribute urls_analyzed + # The page URLs the monitor tracks and analyzes for changes. + # + # @return [Array] + required :urls_analyzed, ContextDev::Internal::Type::ArrayOf[String] + + # @!method initialize(captured_at:, data:, urls_analyzed:) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsExtractBaseline} + # for more details. + # + # Current baseline of an `extract` monitor: the pages it tracks and the structured + # data as last extracted. + # + # @param captured_at [Time] When this baseline was last captured or replaced. + # + # @param data [Object] The extracted structured data, matching the monitor's extraction schema (same sh + # + # @param urls_analyzed [Array] The page URLs the monitor tracks and analyzes for changes. + end + + # @!method self.variants + # @return [Array(ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsExtractBaseline)] + end + # @see ContextDev::Models::MonitorCreateResponse#last_error class LastError < ContextDev::Internal::Type::BaseModel # @!attribute code diff --git a/lib/context_dev/models/monitor_list_params.rb b/lib/context_dev/models/monitor_list_params.rb index b4ff363f..079222c3 100644 --- a/lib/context_dev/models/monitor_list_params.rb +++ b/lib/context_dev/models/monitor_list_params.rb @@ -29,8 +29,8 @@ class MonitorListParams < ContextDev::Internal::Type::BaseModel optional :q, String # @!attribute search_by - # Comma-separated fields to search with `q`. Defaults to all of them. Note `query` - # only exists on semantic monitors. + # Comma-separated fields to search with `q`. Defaults to all of them. Note + # `instructions` only exists on extract monitors. # # @return [Array, nil] optional :search_by, @@ -82,7 +82,7 @@ class MonitorListParams < ContextDev::Internal::Type::BaseModel # # @param q [String] Free-text search term, matched against the fields named in `search_by`. # - # @param search_by [Array] Comma-separated fields to search with `q`. Defaults to all of them. Note `query` + # @param search_by [Array] Comma-separated fields to search with `q`. Defaults to all of them. Note `instru # # @param search_type [Symbol, ContextDev::Models::MonitorListParams::SearchType] `prefix` for as-you-type prefix matching (default), `exact` for full-token match # @@ -111,7 +111,7 @@ module SearchBy NAME = :name URL = :url - QUERY = :query + INSTRUCTIONS = :instructions TAGS = :tags # @!method self.values diff --git a/lib/context_dev/models/monitor_list_response.rb b/lib/context_dev/models/monitor_list_response.rb index 3fe47a25..8eeb68c0 100644 --- a/lib/context_dev/models/monitor_list_response.rb +++ b/lib/context_dev/models/monitor_list_response.rb @@ -82,6 +82,15 @@ class Data < ContextDev::Internal::Type::BaseModel # @return [Time] required :updated_at, Time + # @!attribute baseline + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + # + # @return [ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline, nil] + optional :baseline, union: -> { ContextDev::Models::MonitorListResponse::Data::Baseline }, nil?: true + # @!attribute last_change_at # # @return [Time, nil] @@ -115,7 +124,7 @@ class Data < ContextDev::Internal::Type::BaseModel # @return [ContextDev::Models::MonitorListResponse::Data::Webhook, nil] optional :webhook, -> { ContextDev::Models::MonitorListResponse::Data::Webhook }, nil?: true - # @!method initialize(id:, change_detection:, created_at:, mode:, name:, schedule:, status:, target:, updated_at:, last_change_at: nil, last_error: nil, last_run_at: nil, next_run_at: nil, tags: nil, webhook: nil) + # @!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) # Some parameter documentations has been truncated, see # {ContextDev::Models::MonitorListResponse::Data} for more details. # @@ -140,6 +149,8 @@ class Data < ContextDev::Internal::Type::BaseModel # # @param updated_at [Time] # + # @param baseline [ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline, nil] Current baseline: the last observed value the monitor compares new snapshots aga + # # @param last_change_at [Time, nil] # # @param last_error [ContextDev::Models::MonitorListResponse::Data::LastError, nil] Error from the most recent failed run; null when the last run succeeded. @@ -163,7 +174,7 @@ module ChangeDetection # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. variant :exact, -> { ContextDev::Models::MonitorListResponse::Data::ChangeDetection::Exact } - # Detect meaning-level changes that match a natural language query. + # Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. variant :semantic, -> { ContextDev::Models::MonitorListResponse::Data::ChangeDetection::Semantic } class Exact < ContextDev::Internal::Type::BaseModel @@ -180,11 +191,6 @@ class Exact < ContextDev::Internal::Type::BaseModel end class Semantic < ContextDev::Internal::Type::BaseModel - # @!attribute query - # - # @return [String] - required :query, String - # @!attribute type # # @return [Symbol, :semantic] @@ -195,10 +201,11 @@ class Semantic < ContextDev::Internal::Type::BaseModel # @return [Float, nil] optional :confidence_threshold, Float - # @!method initialize(query:, confidence_threshold: nil, type: :semantic) - # Detect meaning-level changes that match a natural language query. + # @!method initialize(confidence_threshold: nil, type: :semantic) + # Detect meaning-level changes to the extracted data, ignoring cosmetic or + # paraphrase-only differences. What is watched is determined by the extract + # target's `schema` and `instructions`. # - # @param query [String] # @param confidence_threshold [Float] # @param type [Symbol, :semantic] end @@ -306,10 +313,10 @@ module Target # Watch a single web page. variant :page, -> { ContextDev::Models::MonitorListResponse::Data::Target::Page } - # 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. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. variant :sitemap, -> { ContextDev::Models::MonitorListResponse::Data::Target::Sitemap } - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. variant :extract, -> { ContextDev::Models::MonitorListResponse::Data::Target::Extract } class Page < ContextDev::Internal::Type::BaseModel @@ -372,8 +379,9 @@ class Sitemap < ContextDev::Internal::Type::BaseModel # @!method initialize(url:, exclude: nil, include: nil, max_urls: nil, type: :sitemap) # 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. A new URL set must be observed on two - # consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. # # @param url [String] Sitemap URL to monitor. # @@ -387,6 +395,13 @@ class Sitemap < ContextDev::Internal::Type::BaseModel end class Extract < ContextDev::Internal::Type::BaseModel + # @!attribute instructions + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + # + # @return [String] + required :instructions, String + # @!attribute type # # @return [Symbol, :extract] @@ -403,12 +418,6 @@ class Extract < ContextDev::Internal::Type::BaseModel # @return [Boolean, nil] optional :follow_subdomains, ContextDev::Internal::Type::Boolean - # @!attribute instructions - # Optional natural-language instructions guiding what to extract. - # - # @return [String, nil] - optional :instructions, String - # @!attribute max_depth # Optional maximum link depth from the starting URL (0 = only the starting page). # @@ -416,36 +425,41 @@ class Extract < ContextDev::Internal::Type::BaseModel optional :max_depth, Integer # @!attribute max_pages - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. # # @return [Integer, nil] optional :max_pages, Integer # @!attribute schema - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. # # @return [Hash{Symbol=>Object}, nil] optional :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown] - # @!method initialize(url:, follow_subdomains: nil, instructions: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract) + # @!method initialize(instructions:, url:, follow_subdomains: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract) # Some parameter documentations has been truncated, see # {ContextDev::Models::MonitorListResponse::Data::Target::Extract} for more # details. # - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl + # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to + # track; each run re-checks exactly those pages, and confirmed content changes are + # judged against the monitor's instructions. The tracked page set is refreshed by + # a periodic re-discovery crawl. + # + # @param instructions [String] Natural-language instructions guiding which pages and facts to track and which c # # @param url [String] Root URL to extract structured data from. # # @param follow_subdomains [Boolean] # - # @param instructions [String] Optional natural-language instructions guiding what to extract. - # # @param max_depth [Integer] Optional maximum link depth from the starting URL (0 = only the starting page). # - # @param max_pages [Integer] Maximum number of pages to analyze during extraction. + # @param max_pages [Integer] Maximum number of pages to track. # - # @param schema [Hash{Symbol=>Object}] JSON Schema describing the structured data to extract and watch for changes. If + # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It guides which pages are select # # @param type [Symbol, :extract] end @@ -454,6 +468,116 @@ class Extract < ContextDev::Internal::Type::BaseModel # @return [Array(ContextDev::Models::MonitorListResponse::Data::Target::Page, ContextDev::Models::MonitorListResponse::Data::Target::Sitemap, ContextDev::Models::MonitorListResponse::Data::Target::Extract)] end + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + # + # @see ContextDev::Models::MonitorListResponse::Data#baseline + module Baseline + extend ContextDev::Internal::Type::Union + + # Current baseline of a `page` monitor: the visible page text as last observed. + variant -> { ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsPageBaseline } + + # Current baseline of a `sitemap` monitor: the normalized URL set as last observed. + variant -> { ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsSitemapBaseline } + + # Current baseline of an `extract` monitor: the pages it tracks and the structured data as last extracted. + variant -> { ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline } + + class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel + # @!attribute captured_at + # When this baseline was last captured or replaced. + # + # @return [Time] + required :captured_at, Time + + # @!attribute text + # The page's visible text as last observed. + # + # @return [String] + required :text, String + + # @!method initialize(captured_at:, text:) + # Current baseline of a `page` monitor: the visible page text as last observed. + # + # @param captured_at [Time] When this baseline was last captured or replaced. + # + # @param text [String] The page's visible text as last observed. + end + + class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel + # @!attribute captured_at + # When this baseline was last captured or replaced. + # + # @return [Time] + required :captured_at, Time + + # @!attribute url_count + # Number of URLs in the baseline. + # + # @return [Integer] + required :url_count, Integer + + # @!attribute urls + # The sitemap URLs as last observed (sorted, normalized). + # + # @return [Array] + required :urls, ContextDev::Internal::Type::ArrayOf[String] + + # @!method initialize(captured_at:, url_count:, urls:) + # Current baseline of a `sitemap` monitor: the normalized URL set as last + # observed. + # + # @param captured_at [Time] When this baseline was last captured or replaced. + # + # @param url_count [Integer] Number of URLs in the baseline. + # + # @param urls [Array] The sitemap URLs as last observed (sorted, normalized). + end + + class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel + # @!attribute captured_at + # When this baseline was last captured or replaced. + # + # @return [Time] + required :captured_at, Time + + # @!attribute data + # The extracted structured data, matching the monitor's extraction schema (same + # shape as the /web/extract endpoint's `data`). Refreshed when the monitor + # re-discovers its page set (at most about once a day); `null` when no extraction + # has been captured yet. + # + # @return [Object] + required :data, ContextDev::Internal::Type::Unknown + + # @!attribute urls_analyzed + # The page URLs the monitor tracks and analyzes for changes. + # + # @return [Array] + required :urls_analyzed, ContextDev::Internal::Type::ArrayOf[String] + + # @!method initialize(captured_at:, data:, urls_analyzed:) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline} + # for more details. + # + # Current baseline of an `extract` monitor: the pages it tracks and the structured + # data as last extracted. + # + # @param captured_at [Time] When this baseline was last captured or replaced. + # + # @param data [Object] The extracted structured data, matching the monitor's extraction schema (same sh + # + # @param urls_analyzed [Array] The page URLs the monitor tracks and analyzes for changes. + end + + # @!method self.variants + # @return [Array(ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline)] + end + # @see ContextDev::Models::MonitorListResponse::Data#last_error class LastError < ContextDev::Internal::Type::BaseModel # @!attribute code diff --git a/lib/context_dev/models/monitor_retrieve_change_response.rb b/lib/context_dev/models/monitor_retrieve_change_response.rb index e4dbfc97..36a71cb2 100644 --- a/lib/context_dev/models/monitor_retrieve_change_response.rb +++ b/lib/context_dev/models/monitor_retrieve_change_response.rb @@ -112,11 +112,6 @@ class MonitorRetrieveChangeResponse < ContextDev::Internal::Type::BaseModel # @return [Array, nil] optional :matched_urls, ContextDev::Internal::Type::ArrayOf[String] - # @!attribute query - # - # @return [String, nil] - optional :query, String - # @!attribute removed_url_count # # @return [Integer, nil] @@ -134,7 +129,7 @@ class MonitorRetrieveChangeResponse < ContextDev::Internal::Type::BaseModel # @return [Array, nil] optional :tags, ContextDev::Internal::Type::ArrayOf[String] - # @!method initialize(id:, change_detection_type:, detected_at:, mode:, monitor_id:, run_id:, summary:, target_type:, title:, url:, added_url_count: nil, added_urls: nil, after_text_excerpt: nil, before_text_excerpt: nil, confidence: nil, diff: nil, evidence: nil, importance: nil, matched_url_count: nil, matched_urls: nil, query: nil, removed_url_count: nil, removed_urls: nil, tags: nil) + # @!method initialize(id:, change_detection_type:, detected_at:, mode:, monitor_id:, run_id:, summary:, target_type:, title:, url:, added_url_count: nil, added_urls: nil, after_text_excerpt: nil, before_text_excerpt: nil, confidence: nil, diff: nil, evidence: nil, importance: nil, matched_url_count: nil, matched_urls: nil, removed_url_count: nil, removed_urls: nil, tags: nil) # Some parameter documentations has been truncated, see # {ContextDev::Models::MonitorRetrieveChangeResponse} for more details. # @@ -184,8 +179,6 @@ class MonitorRetrieveChangeResponse < ContextDev::Internal::Type::BaseModel # # @param matched_urls [Array] At most 500 URLs are included; the corresponding count field is always exact. # - # @param query [String] - # # @param removed_url_count [Integer] # # @param removed_urls [Array] At most 500 URLs are included; the corresponding count field is always exact. diff --git a/lib/context_dev/models/monitor_retrieve_response.rb b/lib/context_dev/models/monitor_retrieve_response.rb index b9bf3398..d62c3602 100644 --- a/lib/context_dev/models/monitor_retrieve_response.rb +++ b/lib/context_dev/models/monitor_retrieve_response.rb @@ -61,6 +61,15 @@ class MonitorRetrieveResponse < ContextDev::Internal::Type::BaseModel # @return [Time] required :updated_at, Time + # @!attribute baseline + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + # + # @return [ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsExtractBaseline, nil] + optional :baseline, union: -> { ContextDev::Models::MonitorRetrieveResponse::Baseline }, nil?: true + # @!attribute last_change_at # # @return [Time, nil] @@ -94,7 +103,7 @@ class MonitorRetrieveResponse < ContextDev::Internal::Type::BaseModel # @return [ContextDev::Models::MonitorRetrieveResponse::Webhook, nil] optional :webhook, -> { ContextDev::Models::MonitorRetrieveResponse::Webhook }, nil?: true - # @!method initialize(id:, change_detection:, created_at:, mode:, name:, schedule:, status:, target:, updated_at:, last_change_at: nil, last_error: nil, last_run_at: nil, next_run_at: nil, tags: nil, webhook: nil) + # @!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) # Some parameter documentations has been truncated, see # {ContextDev::Models::MonitorRetrieveResponse} for more details. # @@ -119,6 +128,8 @@ class MonitorRetrieveResponse < ContextDev::Internal::Type::BaseModel # # @param updated_at [Time] # + # @param baseline [ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsExtractBaseline, nil] Current baseline: the last observed value the monitor compares new snapshots aga + # # @param last_change_at [Time, nil] # # @param last_error [ContextDev::Models::MonitorRetrieveResponse::LastError, nil] Error from the most recent failed run; null when the last run succeeded. @@ -142,7 +153,7 @@ module ChangeDetection # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. variant :exact, -> { ContextDev::Models::MonitorRetrieveResponse::ChangeDetection::Exact } - # Detect meaning-level changes that match a natural language query. + # Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. variant :semantic, -> { ContextDev::Models::MonitorRetrieveResponse::ChangeDetection::Semantic } class Exact < ContextDev::Internal::Type::BaseModel @@ -159,11 +170,6 @@ class Exact < ContextDev::Internal::Type::BaseModel end class Semantic < ContextDev::Internal::Type::BaseModel - # @!attribute query - # - # @return [String] - required :query, String - # @!attribute type # # @return [Symbol, :semantic] @@ -174,10 +180,11 @@ class Semantic < ContextDev::Internal::Type::BaseModel # @return [Float, nil] optional :confidence_threshold, Float - # @!method initialize(query:, confidence_threshold: nil, type: :semantic) - # Detect meaning-level changes that match a natural language query. + # @!method initialize(confidence_threshold: nil, type: :semantic) + # Detect meaning-level changes to the extracted data, ignoring cosmetic or + # paraphrase-only differences. What is watched is determined by the extract + # target's `schema` and `instructions`. # - # @param query [String] # @param confidence_threshold [Float] # @param type [Symbol, :semantic] end @@ -285,10 +292,10 @@ module Target # Watch a single web page. variant :page, -> { ContextDev::Models::MonitorRetrieveResponse::Target::Page } - # 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. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. variant :sitemap, -> { ContextDev::Models::MonitorRetrieveResponse::Target::Sitemap } - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. variant :extract, -> { ContextDev::Models::MonitorRetrieveResponse::Target::Extract } class Page < ContextDev::Internal::Type::BaseModel @@ -351,8 +358,9 @@ class Sitemap < ContextDev::Internal::Type::BaseModel # @!method initialize(url:, exclude: nil, include: nil, max_urls: nil, type: :sitemap) # 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. A new URL set must be observed on two - # consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. # # @param url [String] Sitemap URL to monitor. # @@ -366,6 +374,13 @@ class Sitemap < ContextDev::Internal::Type::BaseModel end class Extract < ContextDev::Internal::Type::BaseModel + # @!attribute instructions + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + # + # @return [String] + required :instructions, String + # @!attribute type # # @return [Symbol, :extract] @@ -382,12 +397,6 @@ class Extract < ContextDev::Internal::Type::BaseModel # @return [Boolean, nil] optional :follow_subdomains, ContextDev::Internal::Type::Boolean - # @!attribute instructions - # Optional natural-language instructions guiding what to extract. - # - # @return [String, nil] - optional :instructions, String - # @!attribute max_depth # Optional maximum link depth from the starting URL (0 = only the starting page). # @@ -395,35 +404,40 @@ class Extract < ContextDev::Internal::Type::BaseModel optional :max_depth, Integer # @!attribute max_pages - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. # # @return [Integer, nil] optional :max_pages, Integer # @!attribute schema - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. # # @return [Hash{Symbol=>Object}, nil] optional :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown] - # @!method initialize(url:, follow_subdomains: nil, instructions: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract) + # @!method initialize(instructions:, url:, follow_subdomains: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract) # Some parameter documentations has been truncated, see # {ContextDev::Models::MonitorRetrieveResponse::Target::Extract} for more details. # - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl + # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to + # track; each run re-checks exactly those pages, and confirmed content changes are + # judged against the monitor's instructions. The tracked page set is refreshed by + # a periodic re-discovery crawl. + # + # @param instructions [String] Natural-language instructions guiding which pages and facts to track and which c # # @param url [String] Root URL to extract structured data from. # # @param follow_subdomains [Boolean] # - # @param instructions [String] Optional natural-language instructions guiding what to extract. - # # @param max_depth [Integer] Optional maximum link depth from the starting URL (0 = only the starting page). # - # @param max_pages [Integer] Maximum number of pages to analyze during extraction. + # @param max_pages [Integer] Maximum number of pages to track. # - # @param schema [Hash{Symbol=>Object}] JSON Schema describing the structured data to extract and watch for changes. If + # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It guides which pages are select # # @param type [Symbol, :extract] end @@ -432,6 +446,116 @@ class Extract < ContextDev::Internal::Type::BaseModel # @return [Array(ContextDev::Models::MonitorRetrieveResponse::Target::Page, ContextDev::Models::MonitorRetrieveResponse::Target::Sitemap, ContextDev::Models::MonitorRetrieveResponse::Target::Extract)] end + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + # + # @see ContextDev::Models::MonitorRetrieveResponse#baseline + module Baseline + extend ContextDev::Internal::Type::Union + + # Current baseline of a `page` monitor: the visible page text as last observed. + variant -> { ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsPageBaseline } + + # Current baseline of a `sitemap` monitor: the normalized URL set as last observed. + variant -> { ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsSitemapBaseline } + + # Current baseline of an `extract` monitor: the pages it tracks and the structured data as last extracted. + variant -> { ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsExtractBaseline } + + class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel + # @!attribute captured_at + # When this baseline was last captured or replaced. + # + # @return [Time] + required :captured_at, Time + + # @!attribute text + # The page's visible text as last observed. + # + # @return [String] + required :text, String + + # @!method initialize(captured_at:, text:) + # Current baseline of a `page` monitor: the visible page text as last observed. + # + # @param captured_at [Time] When this baseline was last captured or replaced. + # + # @param text [String] The page's visible text as last observed. + end + + class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel + # @!attribute captured_at + # When this baseline was last captured or replaced. + # + # @return [Time] + required :captured_at, Time + + # @!attribute url_count + # Number of URLs in the baseline. + # + # @return [Integer] + required :url_count, Integer + + # @!attribute urls + # The sitemap URLs as last observed (sorted, normalized). + # + # @return [Array] + required :urls, ContextDev::Internal::Type::ArrayOf[String] + + # @!method initialize(captured_at:, url_count:, urls:) + # Current baseline of a `sitemap` monitor: the normalized URL set as last + # observed. + # + # @param captured_at [Time] When this baseline was last captured or replaced. + # + # @param url_count [Integer] Number of URLs in the baseline. + # + # @param urls [Array] The sitemap URLs as last observed (sorted, normalized). + end + + class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel + # @!attribute captured_at + # When this baseline was last captured or replaced. + # + # @return [Time] + required :captured_at, Time + + # @!attribute data + # The extracted structured data, matching the monitor's extraction schema (same + # shape as the /web/extract endpoint's `data`). Refreshed when the monitor + # re-discovers its page set (at most about once a day); `null` when no extraction + # has been captured yet. + # + # @return [Object] + required :data, ContextDev::Internal::Type::Unknown + + # @!attribute urls_analyzed + # The page URLs the monitor tracks and analyzes for changes. + # + # @return [Array] + required :urls_analyzed, ContextDev::Internal::Type::ArrayOf[String] + + # @!method initialize(captured_at:, data:, urls_analyzed:) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsExtractBaseline} + # for more details. + # + # Current baseline of an `extract` monitor: the pages it tracks and the structured + # data as last extracted. + # + # @param captured_at [Time] When this baseline was last captured or replaced. + # + # @param data [Object] The extracted structured data, matching the monitor's extraction schema (same sh + # + # @param urls_analyzed [Array] The page URLs the monitor tracks and analyzes for changes. + end + + # @!method self.variants + # @return [Array(ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsExtractBaseline)] + end + # @see ContextDev::Models::MonitorRetrieveResponse#last_error class LastError < ContextDev::Internal::Type::BaseModel # @!attribute code diff --git a/lib/context_dev/models/monitor_update_params.rb b/lib/context_dev/models/monitor_update_params.rb index 43d89578..e695ab81 100644 --- a/lib/context_dev/models/monitor_update_params.rb +++ b/lib/context_dev/models/monitor_update_params.rb @@ -85,7 +85,7 @@ module ChangeDetection # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. variant :exact, -> { ContextDev::MonitorUpdateParams::ChangeDetection::Exact } - # Detect meaning-level changes that match a natural language query. + # Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. variant :semantic, -> { ContextDev::MonitorUpdateParams::ChangeDetection::Semantic } class Exact < ContextDev::Internal::Type::BaseModel @@ -102,11 +102,6 @@ class Exact < ContextDev::Internal::Type::BaseModel end class Semantic < ContextDev::Internal::Type::BaseModel - # @!attribute query - # - # @return [String] - required :query, String - # @!attribute type # # @return [Symbol, :semantic] @@ -117,10 +112,11 @@ class Semantic < ContextDev::Internal::Type::BaseModel # @return [Float, nil] optional :confidence_threshold, Float - # @!method initialize(query:, confidence_threshold: nil, type: :semantic) - # Detect meaning-level changes that match a natural language query. + # @!method initialize(confidence_threshold: nil, type: :semantic) + # Detect meaning-level changes to the extracted data, ignoring cosmetic or + # paraphrase-only differences. What is watched is determined by the extract + # target's `schema` and `instructions`. # - # @param query [String] # @param confidence_threshold [Float] # @param type [Symbol, :semantic] end @@ -204,10 +200,10 @@ module Target # Watch a single web page. variant :page, -> { ContextDev::MonitorUpdateParams::Target::Page } - # 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. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. variant :sitemap, -> { ContextDev::MonitorUpdateParams::Target::Sitemap } - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. variant :extract, -> { ContextDev::MonitorUpdateParams::Target::Extract } class Page < ContextDev::Internal::Type::BaseModel @@ -270,8 +266,9 @@ class Sitemap < ContextDev::Internal::Type::BaseModel # @!method initialize(url:, exclude: nil, include: nil, max_urls: nil, type: :sitemap) # 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. A new URL set must be observed on two - # consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. # # @param url [String] Sitemap URL to monitor. # @@ -285,6 +282,13 @@ class Sitemap < ContextDev::Internal::Type::BaseModel end class Extract < ContextDev::Internal::Type::BaseModel + # @!attribute instructions + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + # + # @return [String] + required :instructions, String + # @!attribute type # # @return [Symbol, :extract] @@ -301,12 +305,6 @@ class Extract < ContextDev::Internal::Type::BaseModel # @return [Boolean, nil] optional :follow_subdomains, ContextDev::Internal::Type::Boolean - # @!attribute instructions - # Optional natural-language instructions guiding what to extract. - # - # @return [String, nil] - optional :instructions, String - # @!attribute max_depth # Optional maximum link depth from the starting URL (0 = only the starting page). # @@ -314,35 +312,40 @@ class Extract < ContextDev::Internal::Type::BaseModel optional :max_depth, Integer # @!attribute max_pages - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. # # @return [Integer, nil] optional :max_pages, Integer # @!attribute schema - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. # # @return [Hash{Symbol=>Object}, nil] optional :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown] - # @!method initialize(url:, follow_subdomains: nil, instructions: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract) + # @!method initialize(instructions:, url:, follow_subdomains: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract) # Some parameter documentations has been truncated, see # {ContextDev::Models::MonitorUpdateParams::Target::Extract} for more details. # - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl + # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to + # track; each run re-checks exactly those pages, and confirmed content changes are + # judged against the monitor's instructions. The tracked page set is refreshed by + # a periodic re-discovery crawl. + # + # @param instructions [String] Natural-language instructions guiding which pages and facts to track and which c # # @param url [String] Root URL to extract structured data from. # # @param follow_subdomains [Boolean] # - # @param instructions [String] Optional natural-language instructions guiding what to extract. - # # @param max_depth [Integer] Optional maximum link depth from the starting URL (0 = only the starting page). # - # @param max_pages [Integer] Maximum number of pages to analyze during extraction. + # @param max_pages [Integer] Maximum number of pages to track. # - # @param schema [Hash{Symbol=>Object}] JSON Schema describing the structured data to extract and watch for changes. If + # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It guides which pages are select # # @param type [Symbol, :extract] end diff --git a/lib/context_dev/models/monitor_update_response.rb b/lib/context_dev/models/monitor_update_response.rb index 581baa24..128bc0ea 100644 --- a/lib/context_dev/models/monitor_update_response.rb +++ b/lib/context_dev/models/monitor_update_response.rb @@ -61,6 +61,15 @@ class MonitorUpdateResponse < ContextDev::Internal::Type::BaseModel # @return [Time] required :updated_at, Time + # @!attribute baseline + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + # + # @return [ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsExtractBaseline, nil] + optional :baseline, union: -> { ContextDev::Models::MonitorUpdateResponse::Baseline }, nil?: true + # @!attribute last_change_at # # @return [Time, nil] @@ -94,7 +103,7 @@ class MonitorUpdateResponse < ContextDev::Internal::Type::BaseModel # @return [ContextDev::Models::MonitorUpdateResponse::Webhook, nil] optional :webhook, -> { ContextDev::Models::MonitorUpdateResponse::Webhook }, nil?: true - # @!method initialize(id:, change_detection:, created_at:, mode:, name:, schedule:, status:, target:, updated_at:, last_change_at: nil, last_error: nil, last_run_at: nil, next_run_at: nil, tags: nil, webhook: nil) + # @!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) # Some parameter documentations has been truncated, see # {ContextDev::Models::MonitorUpdateResponse} for more details. # @@ -119,6 +128,8 @@ class MonitorUpdateResponse < ContextDev::Internal::Type::BaseModel # # @param updated_at [Time] # + # @param baseline [ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsExtractBaseline, nil] Current baseline: the last observed value the monitor compares new snapshots aga + # # @param last_change_at [Time, nil] # # @param last_error [ContextDev::Models::MonitorUpdateResponse::LastError, nil] Error from the most recent failed run; null when the last run succeeded. @@ -142,7 +153,7 @@ module ChangeDetection # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. variant :exact, -> { ContextDev::Models::MonitorUpdateResponse::ChangeDetection::Exact } - # Detect meaning-level changes that match a natural language query. + # Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. variant :semantic, -> { ContextDev::Models::MonitorUpdateResponse::ChangeDetection::Semantic } class Exact < ContextDev::Internal::Type::BaseModel @@ -159,11 +170,6 @@ class Exact < ContextDev::Internal::Type::BaseModel end class Semantic < ContextDev::Internal::Type::BaseModel - # @!attribute query - # - # @return [String] - required :query, String - # @!attribute type # # @return [Symbol, :semantic] @@ -174,10 +180,11 @@ class Semantic < ContextDev::Internal::Type::BaseModel # @return [Float, nil] optional :confidence_threshold, Float - # @!method initialize(query:, confidence_threshold: nil, type: :semantic) - # Detect meaning-level changes that match a natural language query. + # @!method initialize(confidence_threshold: nil, type: :semantic) + # Detect meaning-level changes to the extracted data, ignoring cosmetic or + # paraphrase-only differences. What is watched is determined by the extract + # target's `schema` and `instructions`. # - # @param query [String] # @param confidence_threshold [Float] # @param type [Symbol, :semantic] end @@ -285,10 +292,10 @@ module Target # Watch a single web page. variant :page, -> { ContextDev::Models::MonitorUpdateResponse::Target::Page } - # 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. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. variant :sitemap, -> { ContextDev::Models::MonitorUpdateResponse::Target::Sitemap } - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. variant :extract, -> { ContextDev::Models::MonitorUpdateResponse::Target::Extract } class Page < ContextDev::Internal::Type::BaseModel @@ -351,8 +358,9 @@ class Sitemap < ContextDev::Internal::Type::BaseModel # @!method initialize(url:, exclude: nil, include: nil, max_urls: nil, type: :sitemap) # 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. A new URL set must be observed on two - # consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. # # @param url [String] Sitemap URL to monitor. # @@ -366,6 +374,13 @@ class Sitemap < ContextDev::Internal::Type::BaseModel end class Extract < ContextDev::Internal::Type::BaseModel + # @!attribute instructions + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + # + # @return [String] + required :instructions, String + # @!attribute type # # @return [Symbol, :extract] @@ -382,12 +397,6 @@ class Extract < ContextDev::Internal::Type::BaseModel # @return [Boolean, nil] optional :follow_subdomains, ContextDev::Internal::Type::Boolean - # @!attribute instructions - # Optional natural-language instructions guiding what to extract. - # - # @return [String, nil] - optional :instructions, String - # @!attribute max_depth # Optional maximum link depth from the starting URL (0 = only the starting page). # @@ -395,35 +404,40 @@ class Extract < ContextDev::Internal::Type::BaseModel optional :max_depth, Integer # @!attribute max_pages - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. # # @return [Integer, nil] optional :max_pages, Integer # @!attribute schema - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. # # @return [Hash{Symbol=>Object}, nil] optional :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown] - # @!method initialize(url:, follow_subdomains: nil, instructions: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract) + # @!method initialize(instructions:, url:, follow_subdomains: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract) # Some parameter documentations has been truncated, see # {ContextDev::Models::MonitorUpdateResponse::Target::Extract} for more details. # - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl + # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to + # track; each run re-checks exactly those pages, and confirmed content changes are + # judged against the monitor's instructions. The tracked page set is refreshed by + # a periodic re-discovery crawl. + # + # @param instructions [String] Natural-language instructions guiding which pages and facts to track and which c # # @param url [String] Root URL to extract structured data from. # # @param follow_subdomains [Boolean] # - # @param instructions [String] Optional natural-language instructions guiding what to extract. - # # @param max_depth [Integer] Optional maximum link depth from the starting URL (0 = only the starting page). # - # @param max_pages [Integer] Maximum number of pages to analyze during extraction. + # @param max_pages [Integer] Maximum number of pages to track. # - # @param schema [Hash{Symbol=>Object}] JSON Schema describing the structured data to extract and watch for changes. If + # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It guides which pages are select # # @param type [Symbol, :extract] end @@ -432,6 +446,116 @@ class Extract < ContextDev::Internal::Type::BaseModel # @return [Array(ContextDev::Models::MonitorUpdateResponse::Target::Page, ContextDev::Models::MonitorUpdateResponse::Target::Sitemap, ContextDev::Models::MonitorUpdateResponse::Target::Extract)] end + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + # + # @see ContextDev::Models::MonitorUpdateResponse#baseline + module Baseline + extend ContextDev::Internal::Type::Union + + # Current baseline of a `page` monitor: the visible page text as last observed. + variant -> { ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsPageBaseline } + + # Current baseline of a `sitemap` monitor: the normalized URL set as last observed. + variant -> { ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsSitemapBaseline } + + # Current baseline of an `extract` monitor: the pages it tracks and the structured data as last extracted. + variant -> { ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsExtractBaseline } + + class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel + # @!attribute captured_at + # When this baseline was last captured or replaced. + # + # @return [Time] + required :captured_at, Time + + # @!attribute text + # The page's visible text as last observed. + # + # @return [String] + required :text, String + + # @!method initialize(captured_at:, text:) + # Current baseline of a `page` monitor: the visible page text as last observed. + # + # @param captured_at [Time] When this baseline was last captured or replaced. + # + # @param text [String] The page's visible text as last observed. + end + + class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel + # @!attribute captured_at + # When this baseline was last captured or replaced. + # + # @return [Time] + required :captured_at, Time + + # @!attribute url_count + # Number of URLs in the baseline. + # + # @return [Integer] + required :url_count, Integer + + # @!attribute urls + # The sitemap URLs as last observed (sorted, normalized). + # + # @return [Array] + required :urls, ContextDev::Internal::Type::ArrayOf[String] + + # @!method initialize(captured_at:, url_count:, urls:) + # Current baseline of a `sitemap` monitor: the normalized URL set as last + # observed. + # + # @param captured_at [Time] When this baseline was last captured or replaced. + # + # @param url_count [Integer] Number of URLs in the baseline. + # + # @param urls [Array] The sitemap URLs as last observed (sorted, normalized). + end + + class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel + # @!attribute captured_at + # When this baseline was last captured or replaced. + # + # @return [Time] + required :captured_at, Time + + # @!attribute data + # The extracted structured data, matching the monitor's extraction schema (same + # shape as the /web/extract endpoint's `data`). Refreshed when the monitor + # re-discovers its page set (at most about once a day); `null` when no extraction + # has been captured yet. + # + # @return [Object] + required :data, ContextDev::Internal::Type::Unknown + + # @!attribute urls_analyzed + # The page URLs the monitor tracks and analyzes for changes. + # + # @return [Array] + required :urls_analyzed, ContextDev::Internal::Type::ArrayOf[String] + + # @!method initialize(captured_at:, data:, urls_analyzed:) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsExtractBaseline} + # for more details. + # + # Current baseline of an `extract` monitor: the pages it tracks and the structured + # data as last extracted. + # + # @param captured_at [Time] When this baseline was last captured or replaced. + # + # @param data [Object] The extracted structured data, matching the monitor's extraction schema (same sh + # + # @param urls_analyzed [Array] The page URLs the monitor tracks and analyzes for changes. + end + + # @!method self.variants + # @return [Array(ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsExtractBaseline)] + end + # @see ContextDev::Models::MonitorUpdateResponse#last_error class LastError < ContextDev::Internal::Type::BaseModel # @!attribute code diff --git a/lib/context_dev/resources/brand.rb b/lib/context_dev/resources/brand.rb index 942294d4..ff61691e 100644 --- a/lib/context_dev/resources/brand.rb +++ b/lib/context_dev/resources/brand.rb @@ -5,11 +5,13 @@ module Resources class Brand # Retrieve logos, backdrops, colors, industry, description, and more. Provide # exactly one lookup identifier in the request body: a domain, company name, email - # address, stock ticker, or transaction descriptor. + # address, stock ticker, transaction descriptor, or direct URL. Note: + # `by_direct_url` fetches brand data only from the provided URL — not from the + # entire internet. # # @overload retrieve(body:, request_options: {}) # - # @param body [ContextDev::Models::BrandRetrieveParams::Body::ByDomain, ContextDev::Models::BrandRetrieveParams::Body::ByName, ContextDev::Models::BrandRetrieveParams::Body::ByEmail, ContextDev::Models::BrandRetrieveParams::Body::ByTicker, ContextDev::Models::BrandRetrieveParams::Body::ByTransaction] Exactly one lookup type must be provided. + # @param body [ContextDev::Models::BrandRetrieveParams::Body::ByDomain, ContextDev::Models::BrandRetrieveParams::Body::ByName, ContextDev::Models::BrandRetrieveParams::Body::ByEmail, ContextDev::Models::BrandRetrieveParams::Body::ByTicker, ContextDev::Models::BrandRetrieveParams::Body::ByDirectURL, ContextDev::Models::BrandRetrieveParams::Body::ByTransaction] Exactly one lookup type must be provided. # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] # diff --git a/lib/context_dev/resources/monitors.rb b/lib/context_dev/resources/monitors.rb index 73fa1761..baaab6e9 100644 --- a/lib/context_dev/resources/monitors.rb +++ b/lib/context_dev/resources/monitors.rb @@ -122,7 +122,7 @@ def update(monitor_id, params = {}) # # @param q [String] Free-text search term, matched against the fields named in `search_by`. # - # @param search_by [Array] Comma-separated fields to search with `q`. Defaults to all of them. Note `query` + # @param search_by [Array] Comma-separated fields to search with `q`. Defaults to all of them. Note `instru # # @param search_type [Symbol, ContextDev::Models::MonitorListParams::SearchType] `prefix` for as-you-type prefix matching (default), `exact` for full-token match # diff --git a/lib/context_dev/version.rb b/lib/context_dev/version.rb index e2988dcd..f956e87b 100644 --- a/lib/context_dev/version.rb +++ b/lib/context_dev/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module ContextDev - VERSION = "2.0.0" + VERSION = "2.1.0" end diff --git a/rbi/context_dev/models/brand_retrieve_params.rbi b/rbi/context_dev/models/brand_retrieve_params.rbi index cea2505b..6dc2222f 100644 --- a/rbi/context_dev/models/brand_retrieve_params.rbi +++ b/rbi/context_dev/models/brand_retrieve_params.rbi @@ -19,6 +19,7 @@ module ContextDev ContextDev::BrandRetrieveParams::Body::ByName, ContextDev::BrandRetrieveParams::Body::ByEmail, ContextDev::BrandRetrieveParams::Body::ByTicker, + ContextDev::BrandRetrieveParams::Body::ByDirectURL, ContextDev::BrandRetrieveParams::Body::ByTransaction ) ) @@ -33,6 +34,7 @@ module ContextDev ContextDev::BrandRetrieveParams::Body::ByName::OrHash, ContextDev::BrandRetrieveParams::Body::ByEmail::OrHash, ContextDev::BrandRetrieveParams::Body::ByTicker::OrHash, + ContextDev::BrandRetrieveParams::Body::ByDirectURL::OrHash, ContextDev::BrandRetrieveParams::Body::ByTransaction::OrHash ), request_options: ContextDev::RequestOptions::OrHash @@ -54,6 +56,7 @@ module ContextDev ContextDev::BrandRetrieveParams::Body::ByName, ContextDev::BrandRetrieveParams::Body::ByEmail, ContextDev::BrandRetrieveParams::Body::ByTicker, + ContextDev::BrandRetrieveParams::Body::ByDirectURL, ContextDev::BrandRetrieveParams::Body::ByTransaction ), request_options: ContextDev::RequestOptions @@ -74,6 +77,7 @@ module ContextDev ContextDev::BrandRetrieveParams::Body::ByName, ContextDev::BrandRetrieveParams::Body::ByEmail, ContextDev::BrandRetrieveParams::Body::ByTicker, + ContextDev::BrandRetrieveParams::Body::ByDirectURL, ContextDev::BrandRetrieveParams::Body::ByTransaction ) end @@ -3054,6 +3058,69 @@ module ContextDev end end + class ByDirectURL < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::BrandRetrieveParams::Body::ByDirectURL, + ContextDev::Internal::AnyHash + ) + end + + # Full http(s) URL to fetch brand data from (e.g., + # 'https://stripe.com/enterprise'). Only this URL is fetched — not the entire + # internet. + sig { returns(String) } + attr_accessor :direct_url + + # Discriminator for direct-URL-based brand retrieval. + sig { returns(Symbol) } + attr_accessor :type + + # Optional timeout in milliseconds for the request. If the request takes longer + # than this value, it will be aborted with a 408 status code. Maximum allowed + # value is 300000ms (5 minutes). + sig { returns(T.nilable(Integer)) } + attr_reader :timeout_ms + + sig { params(timeout_ms: Integer).void } + attr_writer :timeout_ms + + # Retrieve brand data by fetching the provided URL directly. Note: if you use + # this, brand data is fetched only from the provided URL — not from the entire + # internet — so results are limited to what that single page contains. No domain + # resolution, database lookup, or cross-source enrichment is performed. Cannot be + # combined with domain, name, email, or ticker. + sig do + params( + direct_url: String, + timeout_ms: Integer, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Full http(s) URL to fetch brand data from (e.g., + # 'https://stripe.com/enterprise'). Only this URL is fetched — not the entire + # internet. + direct_url:, + # Optional timeout in milliseconds for the request. If the request takes longer + # than this value, it will be aborted with a 408 status code. Maximum allowed + # value is 300000ms (5 minutes). + timeout_ms: nil, + # Discriminator for direct-URL-based brand retrieval. + type: :by_direct_url + ) + end + + sig do + override.returns( + { direct_url: String, type: Symbol, timeout_ms: Integer } + ) + end + def to_hash + end + end + class ByTransaction < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do diff --git a/rbi/context_dev/models/monitor_create_params.rbi b/rbi/context_dev/models/monitor_create_params.rbi index ce117cfd..0fdb3237 100644 --- a/rbi/context_dev/models/monitor_create_params.rbi +++ b/rbi/context_dev/models/monitor_create_params.rbi @@ -186,9 +186,6 @@ module ContextDev ) end - sig { returns(String) } - attr_accessor :query - sig { returns(Symbol) } attr_accessor :type @@ -198,21 +195,19 @@ module ContextDev sig { params(confidence_threshold: Float).void } attr_writer :confidence_threshold - # Detect meaning-level changes that match a natural language query. + # Detect meaning-level changes to the extracted data, ignoring cosmetic or + # paraphrase-only differences. What is watched is determined by the extract + # target's `schema` and `instructions`. sig do - params( - query: String, - confidence_threshold: Float, - type: Symbol - ).returns(T.attached_class) + params(confidence_threshold: Float, type: Symbol).returns( + T.attached_class + ) end - def self.new(query:, confidence_threshold: nil, type: :semantic) + def self.new(confidence_threshold: nil, type: :semantic) end sig do - override.returns( - { query: String, type: Symbol, confidence_threshold: Float } - ) + override.returns({ type: Symbol, confidence_threshold: Float }) end def to_hash end @@ -446,8 +441,9 @@ module ContextDev # 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. A new URL set must be observed on two - # consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. sig do params( url: String, @@ -494,6 +490,11 @@ module ContextDev ) end + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + sig { returns(String) } + attr_accessor :instructions + sig { returns(Symbol) } attr_accessor :type @@ -507,13 +508,6 @@ module ContextDev sig { params(follow_subdomains: T::Boolean).void } attr_writer :follow_subdomains - # Optional natural-language instructions guiding what to extract. - sig { returns(T.nilable(String)) } - attr_reader :instructions - - sig { params(instructions: String).void } - attr_writer :instructions - # Optional maximum link depth from the starting URL (0 = only the starting page). sig { returns(T.nilable(Integer)) } attr_reader :max_depth @@ -521,14 +515,15 @@ module ContextDev sig { params(max_depth: Integer).void } attr_writer :max_depth - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. sig { returns(T.nilable(Integer)) } attr_reader :max_pages sig { params(max_pages: Integer).void } attr_writer :max_pages - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } attr_reader :schema @@ -536,12 +531,16 @@ module ContextDev sig { params(schema: T::Hash[Symbol, T.anything]).void } attr_writer :schema - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl + # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to + # track; each run re-checks exactly those pages, and confirmed content changes are + # judged against the monitor's instructions. The tracked page set is refreshed by + # a periodic re-discovery crawl. sig do params( + instructions: String, url: String, follow_subdomains: T::Boolean, - instructions: String, max_depth: Integer, max_pages: Integer, schema: T::Hash[Symbol, T.anything], @@ -549,16 +548,18 @@ module ContextDev ).returns(T.attached_class) end def self.new( + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + instructions:, # Root URL to extract structured data from. url:, follow_subdomains: nil, - # Optional natural-language instructions guiding what to extract. - instructions: nil, # Optional maximum link depth from the starting URL (0 = only the starting page). max_depth: nil, - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. max_pages: nil, - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. schema: nil, type: :extract @@ -568,10 +569,10 @@ module ContextDev sig do override.returns( { + instructions: String, type: Symbol, url: String, follow_subdomains: T::Boolean, - instructions: String, max_depth: Integer, max_pages: Integer, schema: T::Hash[Symbol, T.anything] diff --git a/rbi/context_dev/models/monitor_create_response.rbi b/rbi/context_dev/models/monitor_create_response.rbi index 63f1f64b..4e4c6acf 100644 --- a/rbi/context_dev/models/monitor_create_response.rbi +++ b/rbi/context_dev/models/monitor_create_response.rbi @@ -67,6 +67,19 @@ module ContextDev sig { returns(Time) } attr_accessor :updated_at + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + sig do + returns( + T.nilable( + ContextDev::Models::MonitorCreateResponse::Baseline::Variants + ) + ) + end + attr_accessor :baseline + sig { returns(T.nilable(Time)) } attr_accessor :last_change_at @@ -137,6 +150,14 @@ module ContextDev ContextDev::Models::MonitorCreateResponse::Target::Extract::OrHash ), updated_at: Time, + baseline: + T.nilable( + T.any( + ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsPageBaseline::OrHash, + ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsSitemapBaseline::OrHash, + ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsExtractBaseline::OrHash + ) + ), last_change_at: T.nilable(Time), last_error: T.nilable( @@ -173,6 +194,11 @@ module ContextDev # Discriminated union describing what the monitor watches. target:, updated_at:, + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + baseline: nil, last_change_at: nil, # Error from the most recent failed run; null when the last run succeeded. last_error: nil, @@ -199,6 +225,10 @@ module ContextDev ContextDev::Models::MonitorCreateResponse::Status::TaggedSymbol, target: ContextDev::Models::MonitorCreateResponse::Target::Variants, updated_at: Time, + baseline: + T.nilable( + ContextDev::Models::MonitorCreateResponse::Baseline::Variants + ), last_change_at: T.nilable(Time), last_error: T.nilable(ContextDev::Models::MonitorCreateResponse::LastError), @@ -257,9 +287,6 @@ module ContextDev ) end - sig { returns(String) } - attr_accessor :query - sig { returns(Symbol) } attr_accessor :type @@ -269,21 +296,19 @@ module ContextDev sig { params(confidence_threshold: Float).void } attr_writer :confidence_threshold - # Detect meaning-level changes that match a natural language query. + # Detect meaning-level changes to the extracted data, ignoring cosmetic or + # paraphrase-only differences. What is watched is determined by the extract + # target's `schema` and `instructions`. sig do - params( - query: String, - confidence_threshold: Float, - type: Symbol - ).returns(T.attached_class) + params(confidence_threshold: Float, type: Symbol).returns( + T.attached_class + ) end - def self.new(query:, confidence_threshold: nil, type: :semantic) + def self.new(confidence_threshold: nil, type: :semantic) end sig do - override.returns( - { query: String, type: Symbol, confidence_threshold: Float } - ) + override.returns({ type: Symbol, confidence_threshold: Float }) end def to_hash end @@ -602,8 +627,9 @@ module ContextDev # 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. A new URL set must be observed on two - # consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. sig do params( url: String, @@ -650,6 +676,11 @@ module ContextDev ) end + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + sig { returns(String) } + attr_accessor :instructions + sig { returns(Symbol) } attr_accessor :type @@ -663,13 +694,6 @@ module ContextDev sig { params(follow_subdomains: T::Boolean).void } attr_writer :follow_subdomains - # Optional natural-language instructions guiding what to extract. - sig { returns(T.nilable(String)) } - attr_reader :instructions - - sig { params(instructions: String).void } - attr_writer :instructions - # Optional maximum link depth from the starting URL (0 = only the starting page). sig { returns(T.nilable(Integer)) } attr_reader :max_depth @@ -677,14 +701,15 @@ module ContextDev sig { params(max_depth: Integer).void } attr_writer :max_depth - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. sig { returns(T.nilable(Integer)) } attr_reader :max_pages sig { params(max_pages: Integer).void } attr_writer :max_pages - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } attr_reader :schema @@ -692,12 +717,16 @@ module ContextDev sig { params(schema: T::Hash[Symbol, T.anything]).void } attr_writer :schema - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl + # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to + # track; each run re-checks exactly those pages, and confirmed content changes are + # judged against the monitor's instructions. The tracked page set is refreshed by + # a periodic re-discovery crawl. sig do params( + instructions: String, url: String, follow_subdomains: T::Boolean, - instructions: String, max_depth: Integer, max_pages: Integer, schema: T::Hash[Symbol, T.anything], @@ -705,16 +734,18 @@ module ContextDev ).returns(T.attached_class) end def self.new( + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + instructions:, # Root URL to extract structured data from. url:, follow_subdomains: nil, - # Optional natural-language instructions guiding what to extract. - instructions: nil, # Optional maximum link depth from the starting URL (0 = only the starting page). max_depth: nil, - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. max_pages: nil, - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. schema: nil, type: :extract @@ -724,10 +755,10 @@ module ContextDev sig do override.returns( { + instructions: String, type: Symbol, url: String, follow_subdomains: T::Boolean, - instructions: String, max_depth: Integer, max_pages: Integer, schema: T::Hash[Symbol, T.anything] @@ -749,6 +780,175 @@ module ContextDev end end + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + module Baseline + extend ContextDev::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsPageBaseline, + ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsSitemapBaseline, + ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsExtractBaseline + ) + end + + class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsPageBaseline, + ContextDev::Internal::AnyHash + ) + end + + # When this baseline was last captured or replaced. + sig { returns(Time) } + attr_accessor :captured_at + + # The page's visible text as last observed. + sig { returns(String) } + attr_accessor :text + + # Current baseline of a `page` monitor: the visible page text as last observed. + sig do + params(captured_at: Time, text: String).returns(T.attached_class) + end + def self.new( + # When this baseline was last captured or replaced. + captured_at:, + # The page's visible text as last observed. + text: + ) + end + + sig { override.returns({ captured_at: Time, text: String }) } + def to_hash + end + end + + class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsSitemapBaseline, + ContextDev::Internal::AnyHash + ) + end + + # When this baseline was last captured or replaced. + sig { returns(Time) } + attr_accessor :captured_at + + # Number of URLs in the baseline. + sig { returns(Integer) } + attr_accessor :url_count + + # The sitemap URLs as last observed (sorted, normalized). + sig { returns(T::Array[String]) } + attr_accessor :urls + + # Current baseline of a `sitemap` monitor: the normalized URL set as last + # observed. + sig do + params( + captured_at: Time, + url_count: Integer, + urls: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # When this baseline was last captured or replaced. + captured_at:, + # Number of URLs in the baseline. + url_count:, + # The sitemap URLs as last observed (sorted, normalized). + urls: + ) + end + + sig do + override.returns( + { captured_at: Time, url_count: Integer, urls: T::Array[String] } + ) + end + def to_hash + end + end + + class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsExtractBaseline, + ContextDev::Internal::AnyHash + ) + end + + # When this baseline was last captured or replaced. + sig { returns(Time) } + attr_accessor :captured_at + + # The extracted structured data, matching the monitor's extraction schema (same + # shape as the /web/extract endpoint's `data`). Refreshed when the monitor + # re-discovers its page set (at most about once a day); `null` when no extraction + # has been captured yet. + sig { returns(T.anything) } + attr_accessor :data + + # The page URLs the monitor tracks and analyzes for changes. + sig { returns(T::Array[String]) } + attr_accessor :urls_analyzed + + # Current baseline of an `extract` monitor: the pages it tracks and the structured + # data as last extracted. + sig do + params( + captured_at: Time, + data: T.anything, + urls_analyzed: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # When this baseline was last captured or replaced. + captured_at:, + # The extracted structured data, matching the monitor's extraction schema (same + # shape as the /web/extract endpoint's `data`). Refreshed when the monitor + # re-discovers its page set (at most about once a day); `null` when no extraction + # has been captured yet. + data:, + # The page URLs the monitor tracks and analyzes for changes. + urls_analyzed: + ) + end + + sig do + override.returns( + { + captured_at: Time, + data: T.anything, + urls_analyzed: T::Array[String] + } + ) + end + def to_hash + end + end + + sig do + override.returns( + T::Array[ + ContextDev::Models::MonitorCreateResponse::Baseline::Variants + ] + ) + end + def self.variants + end + end + class LastError < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do diff --git a/rbi/context_dev/models/monitor_list_params.rbi b/rbi/context_dev/models/monitor_list_params.rbi index 717f5260..dfabf2cf 100644 --- a/rbi/context_dev/models/monitor_list_params.rbi +++ b/rbi/context_dev/models/monitor_list_params.rbi @@ -47,8 +47,8 @@ module ContextDev sig { params(q: String).void } attr_writer :q - # Comma-separated fields to search with `q`. Defaults to all of them. Note `query` - # only exists on semantic monitors. + # Comma-separated fields to search with `q`. Defaults to all of them. Note + # `instructions` only exists on extract monitors. sig do returns( T.nilable(T::Array[ContextDev::MonitorListParams::SearchBy::OrSymbol]) @@ -141,8 +141,8 @@ module ContextDev limit: nil, # Free-text search term, matched against the fields named in `search_by`. q: nil, - # Comma-separated fields to search with `q`. Defaults to all of them. Note `query` - # only exists on semantic monitors. + # Comma-separated fields to search with `q`. Defaults to all of them. Note + # `instructions` only exists on extract monitors. search_by: nil, # `prefix` for as-you-type prefix matching (default), `exact` for full-token # matching. @@ -227,8 +227,11 @@ module ContextDev NAME = T.let(:name, ContextDev::MonitorListParams::SearchBy::TaggedSymbol) URL = T.let(:url, ContextDev::MonitorListParams::SearchBy::TaggedSymbol) - QUERY = - T.let(:query, ContextDev::MonitorListParams::SearchBy::TaggedSymbol) + INSTRUCTIONS = + T.let( + :instructions, + ContextDev::MonitorListParams::SearchBy::TaggedSymbol + ) TAGS = T.let(:tags, ContextDev::MonitorListParams::SearchBy::TaggedSymbol) diff --git a/rbi/context_dev/models/monitor_list_response.rbi b/rbi/context_dev/models/monitor_list_response.rbi index 25b53e59..f0a94ad2 100644 --- a/rbi/context_dev/models/monitor_list_response.rbi +++ b/rbi/context_dev/models/monitor_list_response.rbi @@ -114,6 +114,19 @@ module ContextDev sig { returns(Time) } attr_accessor :updated_at + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + sig do + returns( + T.nilable( + ContextDev::Models::MonitorListResponse::Data::Baseline::Variants + ) + ) + end + attr_accessor :baseline + sig { returns(T.nilable(Time)) } attr_accessor :last_change_at @@ -190,6 +203,14 @@ module ContextDev ContextDev::Models::MonitorListResponse::Data::Target::Extract::OrHash ), updated_at: Time, + baseline: + T.nilable( + T.any( + ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsPageBaseline::OrHash, + ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsSitemapBaseline::OrHash, + ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline::OrHash + ) + ), last_change_at: T.nilable(Time), last_error: T.nilable( @@ -226,6 +247,11 @@ module ContextDev # Discriminated union describing what the monitor watches. target:, updated_at:, + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + baseline: nil, last_change_at: nil, # Error from the most recent failed run; null when the last run succeeded. last_error: nil, @@ -254,6 +280,10 @@ module ContextDev target: ContextDev::Models::MonitorListResponse::Data::Target::Variants, updated_at: Time, + baseline: + T.nilable( + ContextDev::Models::MonitorListResponse::Data::Baseline::Variants + ), last_change_at: T.nilable(Time), last_error: T.nilable( @@ -316,9 +346,6 @@ module ContextDev ) end - sig { returns(String) } - attr_accessor :query - sig { returns(Symbol) } attr_accessor :type @@ -328,21 +355,19 @@ module ContextDev sig { params(confidence_threshold: Float).void } attr_writer :confidence_threshold - # Detect meaning-level changes that match a natural language query. + # Detect meaning-level changes to the extracted data, ignoring cosmetic or + # paraphrase-only differences. What is watched is determined by the extract + # target's `schema` and `instructions`. sig do - params( - query: String, - confidence_threshold: Float, - type: Symbol - ).returns(T.attached_class) + params(confidence_threshold: Float, type: Symbol).returns( + T.attached_class + ) end - def self.new(query:, confidence_threshold: nil, type: :semantic) + def self.new(confidence_threshold: nil, type: :semantic) end sig do - override.returns( - { query: String, type: Symbol, confidence_threshold: Float } - ) + override.returns({ type: Symbol, confidence_threshold: Float }) end def to_hash end @@ -664,8 +689,9 @@ module ContextDev # 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. A new URL set must be observed on two - # consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. sig do params( url: String, @@ -712,6 +738,11 @@ module ContextDev ) end + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + sig { returns(String) } + attr_accessor :instructions + sig { returns(Symbol) } attr_accessor :type @@ -725,13 +756,6 @@ module ContextDev sig { params(follow_subdomains: T::Boolean).void } attr_writer :follow_subdomains - # Optional natural-language instructions guiding what to extract. - sig { returns(T.nilable(String)) } - attr_reader :instructions - - sig { params(instructions: String).void } - attr_writer :instructions - # Optional maximum link depth from the starting URL (0 = only the starting page). sig { returns(T.nilable(Integer)) } attr_reader :max_depth @@ -739,14 +763,15 @@ module ContextDev sig { params(max_depth: Integer).void } attr_writer :max_depth - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. sig { returns(T.nilable(Integer)) } attr_reader :max_pages sig { params(max_pages: Integer).void } attr_writer :max_pages - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } attr_reader :schema @@ -754,12 +779,16 @@ module ContextDev sig { params(schema: T::Hash[Symbol, T.anything]).void } attr_writer :schema - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl + # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to + # track; each run re-checks exactly those pages, and confirmed content changes are + # judged against the monitor's instructions. The tracked page set is refreshed by + # a periodic re-discovery crawl. sig do params( + instructions: String, url: String, follow_subdomains: T::Boolean, - instructions: String, max_depth: Integer, max_pages: Integer, schema: T::Hash[Symbol, T.anything], @@ -767,16 +796,18 @@ module ContextDev ).returns(T.attached_class) end def self.new( + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + instructions:, # Root URL to extract structured data from. url:, follow_subdomains: nil, - # Optional natural-language instructions guiding what to extract. - instructions: nil, # Optional maximum link depth from the starting URL (0 = only the starting page). max_depth: nil, - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. max_pages: nil, - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. schema: nil, type: :extract @@ -786,10 +817,10 @@ module ContextDev sig do override.returns( { + instructions: String, type: Symbol, url: String, follow_subdomains: T::Boolean, - instructions: String, max_depth: Integer, max_pages: Integer, schema: T::Hash[Symbol, T.anything] @@ -811,6 +842,179 @@ module ContextDev end end + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + module Baseline + extend ContextDev::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsPageBaseline, + ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsSitemapBaseline, + ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline + ) + end + + class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsPageBaseline, + ContextDev::Internal::AnyHash + ) + end + + # When this baseline was last captured or replaced. + sig { returns(Time) } + attr_accessor :captured_at + + # The page's visible text as last observed. + sig { returns(String) } + attr_accessor :text + + # Current baseline of a `page` monitor: the visible page text as last observed. + sig do + params(captured_at: Time, text: String).returns(T.attached_class) + end + def self.new( + # When this baseline was last captured or replaced. + captured_at:, + # The page's visible text as last observed. + text: + ) + end + + sig { override.returns({ captured_at: Time, text: String }) } + def to_hash + end + end + + class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsSitemapBaseline, + ContextDev::Internal::AnyHash + ) + end + + # When this baseline was last captured or replaced. + sig { returns(Time) } + attr_accessor :captured_at + + # Number of URLs in the baseline. + sig { returns(Integer) } + attr_accessor :url_count + + # The sitemap URLs as last observed (sorted, normalized). + sig { returns(T::Array[String]) } + attr_accessor :urls + + # Current baseline of a `sitemap` monitor: the normalized URL set as last + # observed. + sig do + params( + captured_at: Time, + url_count: Integer, + urls: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # When this baseline was last captured or replaced. + captured_at:, + # Number of URLs in the baseline. + url_count:, + # The sitemap URLs as last observed (sorted, normalized). + urls: + ) + end + + sig do + override.returns( + { + captured_at: Time, + url_count: Integer, + urls: T::Array[String] + } + ) + end + def to_hash + end + end + + class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline, + ContextDev::Internal::AnyHash + ) + end + + # When this baseline was last captured or replaced. + sig { returns(Time) } + attr_accessor :captured_at + + # The extracted structured data, matching the monitor's extraction schema (same + # shape as the /web/extract endpoint's `data`). Refreshed when the monitor + # re-discovers its page set (at most about once a day); `null` when no extraction + # has been captured yet. + sig { returns(T.anything) } + attr_accessor :data + + # The page URLs the monitor tracks and analyzes for changes. + sig { returns(T::Array[String]) } + attr_accessor :urls_analyzed + + # Current baseline of an `extract` monitor: the pages it tracks and the structured + # data as last extracted. + sig do + params( + captured_at: Time, + data: T.anything, + urls_analyzed: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # When this baseline was last captured or replaced. + captured_at:, + # The extracted structured data, matching the monitor's extraction schema (same + # shape as the /web/extract endpoint's `data`). Refreshed when the monitor + # re-discovers its page set (at most about once a day); `null` when no extraction + # has been captured yet. + data:, + # The page URLs the monitor tracks and analyzes for changes. + urls_analyzed: + ) + end + + sig do + override.returns( + { + captured_at: Time, + data: T.anything, + urls_analyzed: T::Array[String] + } + ) + end + def to_hash + end + end + + sig do + override.returns( + T::Array[ + ContextDev::Models::MonitorListResponse::Data::Baseline::Variants + ] + ) + end + def self.variants + end + end + class LastError < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do diff --git a/rbi/context_dev/models/monitor_retrieve_change_response.rbi b/rbi/context_dev/models/monitor_retrieve_change_response.rbi index a3bb1177..cfa48154 100644 --- a/rbi/context_dev/models/monitor_retrieve_change_response.rbi +++ b/rbi/context_dev/models/monitor_retrieve_change_response.rbi @@ -145,12 +145,6 @@ module ContextDev sig { params(matched_urls: T::Array[String]).void } attr_writer :matched_urls - sig { returns(T.nilable(String)) } - attr_reader :query - - sig { params(query: String).void } - attr_writer :query - sig { returns(T.nilable(Integer)) } attr_reader :removed_url_count @@ -205,7 +199,6 @@ module ContextDev ContextDev::Models::MonitorRetrieveChangeResponse::Importance::OrSymbol, matched_url_count: Integer, matched_urls: T::Array[String], - query: String, removed_url_count: Integer, removed_urls: T::Array[String], tags: T::Array[String] @@ -238,7 +231,6 @@ module ContextDev matched_url_count: nil, # At most 500 URLs are included; the corresponding count field is always exact. matched_urls: nil, - query: nil, removed_url_count: nil, # At most 500 URLs are included; the corresponding count field is always exact. removed_urls: nil, @@ -277,7 +269,6 @@ module ContextDev ContextDev::Models::MonitorRetrieveChangeResponse::Importance::TaggedSymbol, matched_url_count: Integer, matched_urls: T::Array[String], - query: String, removed_url_count: Integer, removed_urls: T::Array[String], tags: T::Array[String] diff --git a/rbi/context_dev/models/monitor_retrieve_response.rbi b/rbi/context_dev/models/monitor_retrieve_response.rbi index 881048ed..3c5640f8 100644 --- a/rbi/context_dev/models/monitor_retrieve_response.rbi +++ b/rbi/context_dev/models/monitor_retrieve_response.rbi @@ -70,6 +70,19 @@ module ContextDev sig { returns(Time) } attr_accessor :updated_at + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + sig do + returns( + T.nilable( + ContextDev::Models::MonitorRetrieveResponse::Baseline::Variants + ) + ) + end + attr_accessor :baseline + sig { returns(T.nilable(Time)) } attr_accessor :last_change_at @@ -143,6 +156,14 @@ module ContextDev ContextDev::Models::MonitorRetrieveResponse::Target::Extract::OrHash ), updated_at: Time, + baseline: + T.nilable( + T.any( + ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsPageBaseline::OrHash, + ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsSitemapBaseline::OrHash, + ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsExtractBaseline::OrHash + ) + ), last_change_at: T.nilable(Time), last_error: T.nilable( @@ -179,6 +200,11 @@ module ContextDev # Discriminated union describing what the monitor watches. target:, updated_at:, + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + baseline: nil, last_change_at: nil, # Error from the most recent failed run; null when the last run succeeded. last_error: nil, @@ -207,6 +233,10 @@ module ContextDev target: ContextDev::Models::MonitorRetrieveResponse::Target::Variants, updated_at: Time, + baseline: + T.nilable( + ContextDev::Models::MonitorRetrieveResponse::Baseline::Variants + ), last_change_at: T.nilable(Time), last_error: T.nilable(ContextDev::Models::MonitorRetrieveResponse::LastError), @@ -265,9 +295,6 @@ module ContextDev ) end - sig { returns(String) } - attr_accessor :query - sig { returns(Symbol) } attr_accessor :type @@ -277,21 +304,19 @@ module ContextDev sig { params(confidence_threshold: Float).void } attr_writer :confidence_threshold - # Detect meaning-level changes that match a natural language query. + # Detect meaning-level changes to the extracted data, ignoring cosmetic or + # paraphrase-only differences. What is watched is determined by the extract + # target's `schema` and `instructions`. sig do - params( - query: String, - confidence_threshold: Float, - type: Symbol - ).returns(T.attached_class) + params(confidence_threshold: Float, type: Symbol).returns( + T.attached_class + ) end - def self.new(query:, confidence_threshold: nil, type: :semantic) + def self.new(confidence_threshold: nil, type: :semantic) end sig do - override.returns( - { query: String, type: Symbol, confidence_threshold: Float } - ) + override.returns({ type: Symbol, confidence_threshold: Float }) end def to_hash end @@ -610,8 +635,9 @@ module ContextDev # 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. A new URL set must be observed on two - # consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. sig do params( url: String, @@ -658,6 +684,11 @@ module ContextDev ) end + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + sig { returns(String) } + attr_accessor :instructions + sig { returns(Symbol) } attr_accessor :type @@ -671,13 +702,6 @@ module ContextDev sig { params(follow_subdomains: T::Boolean).void } attr_writer :follow_subdomains - # Optional natural-language instructions guiding what to extract. - sig { returns(T.nilable(String)) } - attr_reader :instructions - - sig { params(instructions: String).void } - attr_writer :instructions - # Optional maximum link depth from the starting URL (0 = only the starting page). sig { returns(T.nilable(Integer)) } attr_reader :max_depth @@ -685,14 +709,15 @@ module ContextDev sig { params(max_depth: Integer).void } attr_writer :max_depth - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. sig { returns(T.nilable(Integer)) } attr_reader :max_pages sig { params(max_pages: Integer).void } attr_writer :max_pages - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } attr_reader :schema @@ -700,12 +725,16 @@ module ContextDev sig { params(schema: T::Hash[Symbol, T.anything]).void } attr_writer :schema - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl + # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to + # track; each run re-checks exactly those pages, and confirmed content changes are + # judged against the monitor's instructions. The tracked page set is refreshed by + # a periodic re-discovery crawl. sig do params( + instructions: String, url: String, follow_subdomains: T::Boolean, - instructions: String, max_depth: Integer, max_pages: Integer, schema: T::Hash[Symbol, T.anything], @@ -713,16 +742,18 @@ module ContextDev ).returns(T.attached_class) end def self.new( + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + instructions:, # Root URL to extract structured data from. url:, follow_subdomains: nil, - # Optional natural-language instructions guiding what to extract. - instructions: nil, # Optional maximum link depth from the starting URL (0 = only the starting page). max_depth: nil, - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. max_pages: nil, - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. schema: nil, type: :extract @@ -732,10 +763,10 @@ module ContextDev sig do override.returns( { + instructions: String, type: Symbol, url: String, follow_subdomains: T::Boolean, - instructions: String, max_depth: Integer, max_pages: Integer, schema: T::Hash[Symbol, T.anything] @@ -757,6 +788,175 @@ module ContextDev end end + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + module Baseline + extend ContextDev::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsPageBaseline, + ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsSitemapBaseline, + ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsExtractBaseline + ) + end + + class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsPageBaseline, + ContextDev::Internal::AnyHash + ) + end + + # When this baseline was last captured or replaced. + sig { returns(Time) } + attr_accessor :captured_at + + # The page's visible text as last observed. + sig { returns(String) } + attr_accessor :text + + # Current baseline of a `page` monitor: the visible page text as last observed. + sig do + params(captured_at: Time, text: String).returns(T.attached_class) + end + def self.new( + # When this baseline was last captured or replaced. + captured_at:, + # The page's visible text as last observed. + text: + ) + end + + sig { override.returns({ captured_at: Time, text: String }) } + def to_hash + end + end + + class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsSitemapBaseline, + ContextDev::Internal::AnyHash + ) + end + + # When this baseline was last captured or replaced. + sig { returns(Time) } + attr_accessor :captured_at + + # Number of URLs in the baseline. + sig { returns(Integer) } + attr_accessor :url_count + + # The sitemap URLs as last observed (sorted, normalized). + sig { returns(T::Array[String]) } + attr_accessor :urls + + # Current baseline of a `sitemap` monitor: the normalized URL set as last + # observed. + sig do + params( + captured_at: Time, + url_count: Integer, + urls: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # When this baseline was last captured or replaced. + captured_at:, + # Number of URLs in the baseline. + url_count:, + # The sitemap URLs as last observed (sorted, normalized). + urls: + ) + end + + sig do + override.returns( + { captured_at: Time, url_count: Integer, urls: T::Array[String] } + ) + end + def to_hash + end + end + + class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsExtractBaseline, + ContextDev::Internal::AnyHash + ) + end + + # When this baseline was last captured or replaced. + sig { returns(Time) } + attr_accessor :captured_at + + # The extracted structured data, matching the monitor's extraction schema (same + # shape as the /web/extract endpoint's `data`). Refreshed when the monitor + # re-discovers its page set (at most about once a day); `null` when no extraction + # has been captured yet. + sig { returns(T.anything) } + attr_accessor :data + + # The page URLs the monitor tracks and analyzes for changes. + sig { returns(T::Array[String]) } + attr_accessor :urls_analyzed + + # Current baseline of an `extract` monitor: the pages it tracks and the structured + # data as last extracted. + sig do + params( + captured_at: Time, + data: T.anything, + urls_analyzed: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # When this baseline was last captured or replaced. + captured_at:, + # The extracted structured data, matching the monitor's extraction schema (same + # shape as the /web/extract endpoint's `data`). Refreshed when the monitor + # re-discovers its page set (at most about once a day); `null` when no extraction + # has been captured yet. + data:, + # The page URLs the monitor tracks and analyzes for changes. + urls_analyzed: + ) + end + + sig do + override.returns( + { + captured_at: Time, + data: T.anything, + urls_analyzed: T::Array[String] + } + ) + end + def to_hash + end + end + + sig do + override.returns( + T::Array[ + ContextDev::Models::MonitorRetrieveResponse::Baseline::Variants + ] + ) + end + def self.variants + end + end + class LastError < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do diff --git a/rbi/context_dev/models/monitor_update_params.rbi b/rbi/context_dev/models/monitor_update_params.rbi index 395c2703..1bec6147 100644 --- a/rbi/context_dev/models/monitor_update_params.rbi +++ b/rbi/context_dev/models/monitor_update_params.rbi @@ -222,9 +222,6 @@ module ContextDev ) end - sig { returns(String) } - attr_accessor :query - sig { returns(Symbol) } attr_accessor :type @@ -234,21 +231,19 @@ module ContextDev sig { params(confidence_threshold: Float).void } attr_writer :confidence_threshold - # Detect meaning-level changes that match a natural language query. + # Detect meaning-level changes to the extracted data, ignoring cosmetic or + # paraphrase-only differences. What is watched is determined by the extract + # target's `schema` and `instructions`. sig do - params( - query: String, - confidence_threshold: Float, - type: Symbol - ).returns(T.attached_class) + params(confidence_threshold: Float, type: Symbol).returns( + T.attached_class + ) end - def self.new(query:, confidence_threshold: nil, type: :semantic) + def self.new(confidence_threshold: nil, type: :semantic) end sig do - override.returns( - { query: String, type: Symbol, confidence_threshold: Float } - ) + override.returns({ type: Symbol, confidence_threshold: Float }) end def to_hash end @@ -505,8 +500,9 @@ module ContextDev # 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. A new URL set must be observed on two - # consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. sig do params( url: String, @@ -553,6 +549,11 @@ module ContextDev ) end + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + sig { returns(String) } + attr_accessor :instructions + sig { returns(Symbol) } attr_accessor :type @@ -566,13 +567,6 @@ module ContextDev sig { params(follow_subdomains: T::Boolean).void } attr_writer :follow_subdomains - # Optional natural-language instructions guiding what to extract. - sig { returns(T.nilable(String)) } - attr_reader :instructions - - sig { params(instructions: String).void } - attr_writer :instructions - # Optional maximum link depth from the starting URL (0 = only the starting page). sig { returns(T.nilable(Integer)) } attr_reader :max_depth @@ -580,14 +574,15 @@ module ContextDev sig { params(max_depth: Integer).void } attr_writer :max_depth - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. sig { returns(T.nilable(Integer)) } attr_reader :max_pages sig { params(max_pages: Integer).void } attr_writer :max_pages - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } attr_reader :schema @@ -595,12 +590,16 @@ module ContextDev sig { params(schema: T::Hash[Symbol, T.anything]).void } attr_writer :schema - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl + # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to + # track; each run re-checks exactly those pages, and confirmed content changes are + # judged against the monitor's instructions. The tracked page set is refreshed by + # a periodic re-discovery crawl. sig do params( + instructions: String, url: String, follow_subdomains: T::Boolean, - instructions: String, max_depth: Integer, max_pages: Integer, schema: T::Hash[Symbol, T.anything], @@ -608,16 +607,18 @@ module ContextDev ).returns(T.attached_class) end def self.new( + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + instructions:, # Root URL to extract structured data from. url:, follow_subdomains: nil, - # Optional natural-language instructions guiding what to extract. - instructions: nil, # Optional maximum link depth from the starting URL (0 = only the starting page). max_depth: nil, - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. max_pages: nil, - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. schema: nil, type: :extract @@ -627,10 +628,10 @@ module ContextDev sig do override.returns( { + instructions: String, type: Symbol, url: String, follow_subdomains: T::Boolean, - instructions: String, max_depth: Integer, max_pages: Integer, schema: T::Hash[Symbol, T.anything] diff --git a/rbi/context_dev/models/monitor_update_response.rbi b/rbi/context_dev/models/monitor_update_response.rbi index 77be8d5d..3430297d 100644 --- a/rbi/context_dev/models/monitor_update_response.rbi +++ b/rbi/context_dev/models/monitor_update_response.rbi @@ -67,6 +67,19 @@ module ContextDev sig { returns(Time) } attr_accessor :updated_at + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + sig do + returns( + T.nilable( + ContextDev::Models::MonitorUpdateResponse::Baseline::Variants + ) + ) + end + attr_accessor :baseline + sig { returns(T.nilable(Time)) } attr_accessor :last_change_at @@ -137,6 +150,14 @@ module ContextDev ContextDev::Models::MonitorUpdateResponse::Target::Extract::OrHash ), updated_at: Time, + baseline: + T.nilable( + T.any( + ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsPageBaseline::OrHash, + ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsSitemapBaseline::OrHash, + ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsExtractBaseline::OrHash + ) + ), last_change_at: T.nilable(Time), last_error: T.nilable( @@ -173,6 +194,11 @@ module ContextDev # Discriminated union describing what the monitor watches. target:, updated_at:, + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + baseline: nil, last_change_at: nil, # Error from the most recent failed run; null when the last run succeeded. last_error: nil, @@ -199,6 +225,10 @@ module ContextDev ContextDev::Models::MonitorUpdateResponse::Status::TaggedSymbol, target: ContextDev::Models::MonitorUpdateResponse::Target::Variants, updated_at: Time, + baseline: + T.nilable( + ContextDev::Models::MonitorUpdateResponse::Baseline::Variants + ), last_change_at: T.nilable(Time), last_error: T.nilable(ContextDev::Models::MonitorUpdateResponse::LastError), @@ -257,9 +287,6 @@ module ContextDev ) end - sig { returns(String) } - attr_accessor :query - sig { returns(Symbol) } attr_accessor :type @@ -269,21 +296,19 @@ module ContextDev sig { params(confidence_threshold: Float).void } attr_writer :confidence_threshold - # Detect meaning-level changes that match a natural language query. + # Detect meaning-level changes to the extracted data, ignoring cosmetic or + # paraphrase-only differences. What is watched is determined by the extract + # target's `schema` and `instructions`. sig do - params( - query: String, - confidence_threshold: Float, - type: Symbol - ).returns(T.attached_class) + params(confidence_threshold: Float, type: Symbol).returns( + T.attached_class + ) end - def self.new(query:, confidence_threshold: nil, type: :semantic) + def self.new(confidence_threshold: nil, type: :semantic) end sig do - override.returns( - { query: String, type: Symbol, confidence_threshold: Float } - ) + override.returns({ type: Symbol, confidence_threshold: Float }) end def to_hash end @@ -602,8 +627,9 @@ module ContextDev # 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. A new URL set must be observed on two - # consecutive runs before a change is reported, suppressing one-run crawl flaps. + # 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. sig do params( url: String, @@ -650,6 +676,11 @@ module ContextDev ) end + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + sig { returns(String) } + attr_accessor :instructions + sig { returns(Symbol) } attr_accessor :type @@ -663,13 +694,6 @@ module ContextDev sig { params(follow_subdomains: T::Boolean).void } attr_writer :follow_subdomains - # Optional natural-language instructions guiding what to extract. - sig { returns(T.nilable(String)) } - attr_reader :instructions - - sig { params(instructions: String).void } - attr_writer :instructions - # Optional maximum link depth from the starting URL (0 = only the starting page). sig { returns(T.nilable(Integer)) } attr_reader :max_depth @@ -677,14 +701,15 @@ module ContextDev sig { params(max_depth: Integer).void } attr_writer :max_depth - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. sig { returns(T.nilable(Integer)) } attr_reader :max_pages sig { params(max_pages: Integer).void } attr_writer :max_pages - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } attr_reader :schema @@ -692,12 +717,16 @@ module ContextDev sig { params(schema: T::Hash[Symbol, T.anything]).void } attr_writer :schema - # Watch a site's extracted structured data. + # Watch the monitor-relevant pages of a site for meaningful changes. A crawl + # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to + # track; each run re-checks exactly those pages, and confirmed content changes are + # judged against the monitor's instructions. The tracked page set is refreshed by + # a periodic re-discovery crawl. sig do params( + instructions: String, url: String, follow_subdomains: T::Boolean, - instructions: String, max_depth: Integer, max_pages: Integer, schema: T::Hash[Symbol, T.anything], @@ -705,16 +734,18 @@ module ContextDev ).returns(T.attached_class) end def self.new( + # Natural-language instructions guiding which pages and facts to track and which + # changes to report. + instructions:, # Root URL to extract structured data from. url:, follow_subdomains: nil, - # Optional natural-language instructions guiding what to extract. - instructions: nil, # Optional maximum link depth from the starting URL (0 = only the starting page). max_depth: nil, - # Maximum number of pages to analyze during extraction. + # Maximum number of pages to track. max_pages: nil, - # JSON Schema describing the structured data to extract and watch for changes. If + # JSON Schema describing the data you care about. It guides which pages are + # selected for tracking and gives the change judge context on what matters. If # omitted, a default summary + key-points schema is used. schema: nil, type: :extract @@ -724,10 +755,10 @@ module ContextDev sig do override.returns( { + instructions: String, type: Symbol, url: String, follow_subdomains: T::Boolean, - instructions: String, max_depth: Integer, max_pages: Integer, schema: T::Hash[Symbol, T.anything] @@ -749,6 +780,175 @@ module ContextDev end end + # Current baseline: the last observed value the monitor compares new snapshots + # against. Its shape follows `target.type` (page/sitemap/extract). Only populated + # on GET /monitors/{monitor_id}; null until the first baseline run completes (and + # after a target or change_detection update, which resets the baseline). + module Baseline + extend ContextDev::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsPageBaseline, + ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsSitemapBaseline, + ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsExtractBaseline + ) + end + + class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsPageBaseline, + ContextDev::Internal::AnyHash + ) + end + + # When this baseline was last captured or replaced. + sig { returns(Time) } + attr_accessor :captured_at + + # The page's visible text as last observed. + sig { returns(String) } + attr_accessor :text + + # Current baseline of a `page` monitor: the visible page text as last observed. + sig do + params(captured_at: Time, text: String).returns(T.attached_class) + end + def self.new( + # When this baseline was last captured or replaced. + captured_at:, + # The page's visible text as last observed. + text: + ) + end + + sig { override.returns({ captured_at: Time, text: String }) } + def to_hash + end + end + + class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsSitemapBaseline, + ContextDev::Internal::AnyHash + ) + end + + # When this baseline was last captured or replaced. + sig { returns(Time) } + attr_accessor :captured_at + + # Number of URLs in the baseline. + sig { returns(Integer) } + attr_accessor :url_count + + # The sitemap URLs as last observed (sorted, normalized). + sig { returns(T::Array[String]) } + attr_accessor :urls + + # Current baseline of a `sitemap` monitor: the normalized URL set as last + # observed. + sig do + params( + captured_at: Time, + url_count: Integer, + urls: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # When this baseline was last captured or replaced. + captured_at:, + # Number of URLs in the baseline. + url_count:, + # The sitemap URLs as last observed (sorted, normalized). + urls: + ) + end + + sig do + override.returns( + { captured_at: Time, url_count: Integer, urls: T::Array[String] } + ) + end + def to_hash + end + end + + class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsExtractBaseline, + ContextDev::Internal::AnyHash + ) + end + + # When this baseline was last captured or replaced. + sig { returns(Time) } + attr_accessor :captured_at + + # The extracted structured data, matching the monitor's extraction schema (same + # shape as the /web/extract endpoint's `data`). Refreshed when the monitor + # re-discovers its page set (at most about once a day); `null` when no extraction + # has been captured yet. + sig { returns(T.anything) } + attr_accessor :data + + # The page URLs the monitor tracks and analyzes for changes. + sig { returns(T::Array[String]) } + attr_accessor :urls_analyzed + + # Current baseline of an `extract` monitor: the pages it tracks and the structured + # data as last extracted. + sig do + params( + captured_at: Time, + data: T.anything, + urls_analyzed: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # When this baseline was last captured or replaced. + captured_at:, + # The extracted structured data, matching the monitor's extraction schema (same + # shape as the /web/extract endpoint's `data`). Refreshed when the monitor + # re-discovers its page set (at most about once a day); `null` when no extraction + # has been captured yet. + data:, + # The page URLs the monitor tracks and analyzes for changes. + urls_analyzed: + ) + end + + sig do + override.returns( + { + captured_at: Time, + data: T.anything, + urls_analyzed: T::Array[String] + } + ) + end + def to_hash + end + end + + sig do + override.returns( + T::Array[ + ContextDev::Models::MonitorUpdateResponse::Baseline::Variants + ] + ) + end + def self.variants + end + end + class LastError < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do diff --git a/rbi/context_dev/resources/brand.rbi b/rbi/context_dev/resources/brand.rbi index dd150a50..d4e653e1 100644 --- a/rbi/context_dev/resources/brand.rbi +++ b/rbi/context_dev/resources/brand.rbi @@ -5,7 +5,9 @@ module ContextDev class Brand # Retrieve logos, backdrops, colors, industry, description, and more. Provide # exactly one lookup identifier in the request body: a domain, company name, email - # address, stock ticker, or transaction descriptor. + # address, stock ticker, transaction descriptor, or direct URL. Note: + # `by_direct_url` fetches brand data only from the provided URL — not from the + # entire internet. sig do params( body: @@ -14,6 +16,7 @@ module ContextDev ContextDev::BrandRetrieveParams::Body::ByName::OrHash, ContextDev::BrandRetrieveParams::Body::ByEmail::OrHash, ContextDev::BrandRetrieveParams::Body::ByTicker::OrHash, + ContextDev::BrandRetrieveParams::Body::ByDirectURL::OrHash, ContextDev::BrandRetrieveParams::Body::ByTransaction::OrHash ), request_options: ContextDev::RequestOptions::OrHash diff --git a/rbi/context_dev/resources/monitors.rbi b/rbi/context_dev/resources/monitors.rbi index 0485be14..92b6b8bd 100644 --- a/rbi/context_dev/resources/monitors.rbi +++ b/rbi/context_dev/resources/monitors.rbi @@ -131,8 +131,8 @@ module ContextDev limit: nil, # Free-text search term, matched against the fields named in `search_by`. q: nil, - # Comma-separated fields to search with `q`. Defaults to all of them. Note `query` - # only exists on semantic monitors. + # Comma-separated fields to search with `q`. Defaults to all of them. Note + # `instructions` only exists on extract monitors. search_by: nil, # `prefix` for as-you-type prefix matching (default), `exact` for full-token # matching. diff --git a/sig/context_dev/models/brand_retrieve_params.rbs b/sig/context_dev/models/brand_retrieve_params.rbs index 20131a52..0316a417 100644 --- a/sig/context_dev/models/brand_retrieve_params.rbs +++ b/sig/context_dev/models/brand_retrieve_params.rbs @@ -25,6 +25,7 @@ module ContextDev | ContextDev::BrandRetrieveParams::Body::ByName | ContextDev::BrandRetrieveParams::Body::ByEmail | ContextDev::BrandRetrieveParams::Body::ByTicker + | ContextDev::BrandRetrieveParams::Body::ByDirectURL | ContextDev::BrandRetrieveParams::Body::ByTransaction module Body @@ -1248,6 +1249,31 @@ module ContextDev end end + type by_direct_url = + { direct_url: String, type: :by_direct_url, timeout_ms: Integer } + + class ByDirectURL < ContextDev::Internal::Type::BaseModel + attr_accessor direct_url: String + + attr_accessor type: :by_direct_url + + attr_reader timeout_ms: Integer? + + def timeout_ms=: (Integer) -> Integer + + def initialize: ( + direct_url: String, + ?timeout_ms: Integer, + ?type: :by_direct_url + ) -> void + + def to_hash: -> { + direct_url: String, + type: :by_direct_url, + timeout_ms: Integer + } + end + type by_transaction = { transaction_info: String, diff --git a/sig/context_dev/models/monitor_create_params.rbs b/sig/context_dev/models/monitor_create_params.rbs index d171615b..b6e48e4e 100644 --- a/sig/context_dev/models/monitor_create_params.rbs +++ b/sig/context_dev/models/monitor_create_params.rbs @@ -75,12 +75,9 @@ module ContextDev def to_hash: -> { type: :exact } end - type semantic = - { query: String, type: :semantic, confidence_threshold: Float } + type semantic = { type: :semantic, confidence_threshold: Float } class Semantic < ContextDev::Internal::Type::BaseModel - attr_accessor query: String - attr_accessor type: :semantic attr_reader confidence_threshold: Float? @@ -88,16 +85,11 @@ module ContextDev def confidence_threshold=: (Float) -> Float def initialize: ( - query: String, ?confidence_threshold: Float, ?type: :semantic ) -> void - def to_hash: -> { - query: String, - type: :semantic, - confidence_threshold: Float - } + def to_hash: -> { type: :semantic, confidence_threshold: Float } end def self?.variants: -> ::Array[ContextDev::Models::MonitorCreateParams::change_detection] @@ -229,16 +221,18 @@ module ContextDev type extract = { + instructions: String, type: :extract, url: String, follow_subdomains: bool, - instructions: String, max_depth: Integer, max_pages: Integer, schema: ::Hash[Symbol, top] } class Extract < ContextDev::Internal::Type::BaseModel + attr_accessor instructions: String + attr_accessor type: :extract attr_accessor url: String @@ -247,10 +241,6 @@ module ContextDev def follow_subdomains=: (bool) -> bool - attr_reader instructions: String? - - def instructions=: (String) -> String - attr_reader max_depth: Integer? def max_depth=: (Integer) -> Integer @@ -264,9 +254,9 @@ module ContextDev def schema=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] def initialize: ( + instructions: String, url: String, ?follow_subdomains: bool, - ?instructions: String, ?max_depth: Integer, ?max_pages: Integer, ?schema: ::Hash[Symbol, top], @@ -274,10 +264,10 @@ module ContextDev ) -> void def to_hash: -> { + instructions: String, type: :extract, url: String, follow_subdomains: bool, - instructions: String, max_depth: Integer, max_pages: Integer, schema: ::Hash[Symbol, top] diff --git a/sig/context_dev/models/monitor_create_response.rbs b/sig/context_dev/models/monitor_create_response.rbs index 138e72a3..5da4f02d 100644 --- a/sig/context_dev/models/monitor_create_response.rbs +++ b/sig/context_dev/models/monitor_create_response.rbs @@ -11,6 +11,7 @@ module ContextDev status: ContextDev::Models::MonitorCreateResponse::status, target: ContextDev::Models::MonitorCreateResponse::target, updated_at: Time, + baseline: ContextDev::Models::MonitorCreateResponse::baseline?, last_change_at: Time?, last_error: ContextDev::Models::MonitorCreateResponse::LastError?, last_run_at: Time?, @@ -38,6 +39,8 @@ module ContextDev attr_accessor updated_at: Time + attr_accessor baseline: ContextDev::Models::MonitorCreateResponse::baseline? + attr_accessor last_change_at: Time? attr_accessor last_error: ContextDev::Models::MonitorCreateResponse::LastError? @@ -62,6 +65,7 @@ module ContextDev status: ContextDev::Models::MonitorCreateResponse::status, target: ContextDev::Models::MonitorCreateResponse::target, updated_at: Time, + ?baseline: ContextDev::Models::MonitorCreateResponse::baseline?, ?last_change_at: Time?, ?last_error: ContextDev::Models::MonitorCreateResponse::LastError?, ?last_run_at: Time?, @@ -80,6 +84,7 @@ module ContextDev status: ContextDev::Models::MonitorCreateResponse::status, target: ContextDev::Models::MonitorCreateResponse::target, updated_at: Time, + baseline: ContextDev::Models::MonitorCreateResponse::baseline?, last_change_at: Time?, last_error: ContextDev::Models::MonitorCreateResponse::LastError?, last_run_at: Time?, @@ -105,12 +110,9 @@ module ContextDev def to_hash: -> { type: :exact } end - type semantic = - { query: String, type: :semantic, confidence_threshold: Float } + type semantic = { type: :semantic, confidence_threshold: Float } class Semantic < ContextDev::Internal::Type::BaseModel - attr_accessor query: String - attr_accessor type: :semantic attr_reader confidence_threshold: Float? @@ -118,16 +120,11 @@ module ContextDev def confidence_threshold=: (Float) -> Float def initialize: ( - query: String, ?confidence_threshold: Float, ?type: :semantic ) -> void - def to_hash: -> { - query: String, - type: :semantic, - confidence_threshold: Float - } + def to_hash: -> { type: :semantic, confidence_threshold: Float } end def self?.variants: -> ::Array[ContextDev::Models::MonitorCreateResponse::change_detection] @@ -281,16 +278,18 @@ module ContextDev type extract = { + instructions: String, type: :extract, url: String, follow_subdomains: bool, - instructions: String, max_depth: Integer, max_pages: Integer, schema: ::Hash[Symbol, top] } class Extract < ContextDev::Internal::Type::BaseModel + attr_accessor instructions: String + attr_accessor type: :extract attr_accessor url: String @@ -299,10 +298,6 @@ module ContextDev def follow_subdomains=: (bool) -> bool - attr_reader instructions: String? - - def instructions=: (String) -> String - attr_reader max_depth: Integer? def max_depth=: (Integer) -> Integer @@ -316,9 +311,9 @@ module ContextDev def schema=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] def initialize: ( + instructions: String, url: String, ?follow_subdomains: bool, - ?instructions: String, ?max_depth: Integer, ?max_pages: Integer, ?schema: ::Hash[Symbol, top], @@ -326,10 +321,10 @@ module ContextDev ) -> void def to_hash: -> { + instructions: String, type: :extract, url: String, follow_subdomains: bool, - instructions: String, max_depth: Integer, max_pages: Integer, schema: ::Hash[Symbol, top] @@ -339,6 +334,75 @@ module ContextDev def self?.variants: -> ::Array[ContextDev::Models::MonitorCreateResponse::target] end + type baseline = + ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsPageBaseline + | ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsSitemapBaseline + | ContextDev::Models::MonitorCreateResponse::Baseline::MonitorsExtractBaseline + + module Baseline + extend ContextDev::Internal::Type::Union + + type monitors_page_baseline = { captured_at: Time, text: String } + + class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel + attr_accessor captured_at: Time + + attr_accessor text: String + + def initialize: (captured_at: Time, text: String) -> void + + def to_hash: -> { captured_at: Time, text: String } + end + + type monitors_sitemap_baseline = + { captured_at: Time, url_count: Integer, urls: ::Array[String] } + + class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel + attr_accessor captured_at: Time + + attr_accessor url_count: Integer + + attr_accessor urls: ::Array[String] + + def initialize: ( + captured_at: Time, + url_count: Integer, + urls: ::Array[String] + ) -> void + + def to_hash: -> { + captured_at: Time, + url_count: Integer, + urls: ::Array[String] + } + end + + type monitors_extract_baseline = + { captured_at: Time, data: top, urls_analyzed: ::Array[String] } + + class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel + attr_accessor captured_at: Time + + attr_accessor data: top + + attr_accessor urls_analyzed: ::Array[String] + + def initialize: ( + captured_at: Time, + data: top, + urls_analyzed: ::Array[String] + ) -> void + + def to_hash: -> { + captured_at: Time, + data: top, + urls_analyzed: ::Array[String] + } + end + + def self?.variants: -> ::Array[ContextDev::Models::MonitorCreateResponse::baseline] + end + type last_error = { code: String, message: String } class LastError < ContextDev::Internal::Type::BaseModel diff --git a/sig/context_dev/models/monitor_list_params.rbs b/sig/context_dev/models/monitor_list_params.rbs index 2e9543ec..25fc6296 100644 --- a/sig/context_dev/models/monitor_list_params.rbs +++ b/sig/context_dev/models/monitor_list_params.rbs @@ -108,14 +108,14 @@ module ContextDev def self?.values: -> ::Array[ContextDev::Models::MonitorListParams::change_detection_type] end - type search_by = :name | :url | :query | :tags + type search_by = :name | :url | :instructions | :tags module SearchBy extend ContextDev::Internal::Type::Enum NAME: :name URL: :url - QUERY: :query + INSTRUCTIONS: :instructions TAGS: :tags def self?.values: -> ::Array[ContextDev::Models::MonitorListParams::search_by] diff --git a/sig/context_dev/models/monitor_list_response.rbs b/sig/context_dev/models/monitor_list_response.rbs index b15fc375..4a2c304a 100644 --- a/sig/context_dev/models/monitor_list_response.rbs +++ b/sig/context_dev/models/monitor_list_response.rbs @@ -37,6 +37,7 @@ module ContextDev status: ContextDev::Models::MonitorListResponse::Data::status, target: ContextDev::Models::MonitorListResponse::Data::target, updated_at: Time, + baseline: ContextDev::Models::MonitorListResponse::Data::baseline?, last_change_at: Time?, last_error: ContextDev::Models::MonitorListResponse::Data::LastError?, last_run_at: Time?, @@ -64,6 +65,8 @@ module ContextDev attr_accessor updated_at: Time + attr_accessor baseline: ContextDev::Models::MonitorListResponse::Data::baseline? + attr_accessor last_change_at: Time? attr_accessor last_error: ContextDev::Models::MonitorListResponse::Data::LastError? @@ -88,6 +91,7 @@ module ContextDev status: ContextDev::Models::MonitorListResponse::Data::status, target: ContextDev::Models::MonitorListResponse::Data::target, updated_at: Time, + ?baseline: ContextDev::Models::MonitorListResponse::Data::baseline?, ?last_change_at: Time?, ?last_error: ContextDev::Models::MonitorListResponse::Data::LastError?, ?last_run_at: Time?, @@ -106,6 +110,7 @@ module ContextDev status: ContextDev::Models::MonitorListResponse::Data::status, target: ContextDev::Models::MonitorListResponse::Data::target, updated_at: Time, + baseline: ContextDev::Models::MonitorListResponse::Data::baseline?, last_change_at: Time?, last_error: ContextDev::Models::MonitorListResponse::Data::LastError?, last_run_at: Time?, @@ -131,12 +136,9 @@ module ContextDev def to_hash: -> { type: :exact } end - type semantic = - { query: String, type: :semantic, confidence_threshold: Float } + type semantic = { type: :semantic, confidence_threshold: Float } class Semantic < ContextDev::Internal::Type::BaseModel - attr_accessor query: String - attr_accessor type: :semantic attr_reader confidence_threshold: Float? @@ -144,16 +146,11 @@ module ContextDev def confidence_threshold=: (Float) -> Float def initialize: ( - query: String, ?confidence_threshold: Float, ?type: :semantic ) -> void - def to_hash: -> { - query: String, - type: :semantic, - confidence_threshold: Float - } + def to_hash: -> { type: :semantic, confidence_threshold: Float } end def self?.variants: -> ::Array[ContextDev::Models::MonitorListResponse::Data::change_detection] @@ -307,16 +304,18 @@ module ContextDev type extract = { + instructions: String, type: :extract, url: String, follow_subdomains: bool, - instructions: String, max_depth: Integer, max_pages: Integer, schema: ::Hash[Symbol, top] } class Extract < ContextDev::Internal::Type::BaseModel + attr_accessor instructions: String + attr_accessor type: :extract attr_accessor url: String @@ -325,10 +324,6 @@ module ContextDev def follow_subdomains=: (bool) -> bool - attr_reader instructions: String? - - def instructions=: (String) -> String - attr_reader max_depth: Integer? def max_depth=: (Integer) -> Integer @@ -342,9 +337,9 @@ module ContextDev def schema=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] def initialize: ( + instructions: String, url: String, ?follow_subdomains: bool, - ?instructions: String, ?max_depth: Integer, ?max_pages: Integer, ?schema: ::Hash[Symbol, top], @@ -352,10 +347,10 @@ module ContextDev ) -> void def to_hash: -> { + instructions: String, type: :extract, url: String, follow_subdomains: bool, - instructions: String, max_depth: Integer, max_pages: Integer, schema: ::Hash[Symbol, top] @@ -365,6 +360,75 @@ module ContextDev def self?.variants: -> ::Array[ContextDev::Models::MonitorListResponse::Data::target] end + type baseline = + ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsPageBaseline + | ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsSitemapBaseline + | ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline + + module Baseline + extend ContextDev::Internal::Type::Union + + type monitors_page_baseline = { captured_at: Time, text: String } + + class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel + attr_accessor captured_at: Time + + attr_accessor text: String + + def initialize: (captured_at: Time, text: String) -> void + + def to_hash: -> { captured_at: Time, text: String } + end + + type monitors_sitemap_baseline = + { captured_at: Time, url_count: Integer, urls: ::Array[String] } + + class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel + attr_accessor captured_at: Time + + attr_accessor url_count: Integer + + attr_accessor urls: ::Array[String] + + def initialize: ( + captured_at: Time, + url_count: Integer, + urls: ::Array[String] + ) -> void + + def to_hash: -> { + captured_at: Time, + url_count: Integer, + urls: ::Array[String] + } + end + + type monitors_extract_baseline = + { captured_at: Time, data: top, urls_analyzed: ::Array[String] } + + class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel + attr_accessor captured_at: Time + + attr_accessor data: top + + attr_accessor urls_analyzed: ::Array[String] + + def initialize: ( + captured_at: Time, + data: top, + urls_analyzed: ::Array[String] + ) -> void + + def to_hash: -> { + captured_at: Time, + data: top, + urls_analyzed: ::Array[String] + } + end + + def self?.variants: -> ::Array[ContextDev::Models::MonitorListResponse::Data::baseline] + end + type last_error = { code: String, message: String } class LastError < ContextDev::Internal::Type::BaseModel diff --git a/sig/context_dev/models/monitor_retrieve_change_response.rbs b/sig/context_dev/models/monitor_retrieve_change_response.rbs index 036ce95d..fce957ac 100644 --- a/sig/context_dev/models/monitor_retrieve_change_response.rbs +++ b/sig/context_dev/models/monitor_retrieve_change_response.rbs @@ -22,7 +22,6 @@ module ContextDev importance: ContextDev::Models::MonitorRetrieveChangeResponse::importance, matched_url_count: Integer, matched_urls: ::Array[String], - query: String, removed_url_count: Integer, removed_urls: ::Array[String], tags: ::Array[String] @@ -93,10 +92,6 @@ module ContextDev def matched_urls=: (::Array[String]) -> ::Array[String] - attr_reader query: String? - - def query=: (String) -> String - attr_reader removed_url_count: Integer? def removed_url_count=: (Integer) -> Integer @@ -130,7 +125,6 @@ module ContextDev ?importance: ContextDev::Models::MonitorRetrieveChangeResponse::importance, ?matched_url_count: Integer, ?matched_urls: ::Array[String], - ?query: String, ?removed_url_count: Integer, ?removed_urls: ::Array[String], ?tags: ::Array[String] @@ -157,7 +151,6 @@ module ContextDev importance: ContextDev::Models::MonitorRetrieveChangeResponse::importance, matched_url_count: Integer, matched_urls: ::Array[String], - query: String, removed_url_count: Integer, removed_urls: ::Array[String], tags: ::Array[String] diff --git a/sig/context_dev/models/monitor_retrieve_response.rbs b/sig/context_dev/models/monitor_retrieve_response.rbs index 85b0a972..a125a997 100644 --- a/sig/context_dev/models/monitor_retrieve_response.rbs +++ b/sig/context_dev/models/monitor_retrieve_response.rbs @@ -11,6 +11,7 @@ module ContextDev status: ContextDev::Models::MonitorRetrieveResponse::status, target: ContextDev::Models::MonitorRetrieveResponse::target, updated_at: Time, + baseline: ContextDev::Models::MonitorRetrieveResponse::baseline?, last_change_at: Time?, last_error: ContextDev::Models::MonitorRetrieveResponse::LastError?, last_run_at: Time?, @@ -38,6 +39,8 @@ module ContextDev attr_accessor updated_at: Time + attr_accessor baseline: ContextDev::Models::MonitorRetrieveResponse::baseline? + attr_accessor last_change_at: Time? attr_accessor last_error: ContextDev::Models::MonitorRetrieveResponse::LastError? @@ -62,6 +65,7 @@ module ContextDev status: ContextDev::Models::MonitorRetrieveResponse::status, target: ContextDev::Models::MonitorRetrieveResponse::target, updated_at: Time, + ?baseline: ContextDev::Models::MonitorRetrieveResponse::baseline?, ?last_change_at: Time?, ?last_error: ContextDev::Models::MonitorRetrieveResponse::LastError?, ?last_run_at: Time?, @@ -80,6 +84,7 @@ module ContextDev status: ContextDev::Models::MonitorRetrieveResponse::status, target: ContextDev::Models::MonitorRetrieveResponse::target, updated_at: Time, + baseline: ContextDev::Models::MonitorRetrieveResponse::baseline?, last_change_at: Time?, last_error: ContextDev::Models::MonitorRetrieveResponse::LastError?, last_run_at: Time?, @@ -105,12 +110,9 @@ module ContextDev def to_hash: -> { type: :exact } end - type semantic = - { query: String, type: :semantic, confidence_threshold: Float } + type semantic = { type: :semantic, confidence_threshold: Float } class Semantic < ContextDev::Internal::Type::BaseModel - attr_accessor query: String - attr_accessor type: :semantic attr_reader confidence_threshold: Float? @@ -118,16 +120,11 @@ module ContextDev def confidence_threshold=: (Float) -> Float def initialize: ( - query: String, ?confidence_threshold: Float, ?type: :semantic ) -> void - def to_hash: -> { - query: String, - type: :semantic, - confidence_threshold: Float - } + def to_hash: -> { type: :semantic, confidence_threshold: Float } end def self?.variants: -> ::Array[ContextDev::Models::MonitorRetrieveResponse::change_detection] @@ -281,16 +278,18 @@ module ContextDev type extract = { + instructions: String, type: :extract, url: String, follow_subdomains: bool, - instructions: String, max_depth: Integer, max_pages: Integer, schema: ::Hash[Symbol, top] } class Extract < ContextDev::Internal::Type::BaseModel + attr_accessor instructions: String + attr_accessor type: :extract attr_accessor url: String @@ -299,10 +298,6 @@ module ContextDev def follow_subdomains=: (bool) -> bool - attr_reader instructions: String? - - def instructions=: (String) -> String - attr_reader max_depth: Integer? def max_depth=: (Integer) -> Integer @@ -316,9 +311,9 @@ module ContextDev def schema=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] def initialize: ( + instructions: String, url: String, ?follow_subdomains: bool, - ?instructions: String, ?max_depth: Integer, ?max_pages: Integer, ?schema: ::Hash[Symbol, top], @@ -326,10 +321,10 @@ module ContextDev ) -> void def to_hash: -> { + instructions: String, type: :extract, url: String, follow_subdomains: bool, - instructions: String, max_depth: Integer, max_pages: Integer, schema: ::Hash[Symbol, top] @@ -339,6 +334,75 @@ module ContextDev def self?.variants: -> ::Array[ContextDev::Models::MonitorRetrieveResponse::target] end + type baseline = + ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsPageBaseline + | ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsSitemapBaseline + | ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsExtractBaseline + + module Baseline + extend ContextDev::Internal::Type::Union + + type monitors_page_baseline = { captured_at: Time, text: String } + + class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel + attr_accessor captured_at: Time + + attr_accessor text: String + + def initialize: (captured_at: Time, text: String) -> void + + def to_hash: -> { captured_at: Time, text: String } + end + + type monitors_sitemap_baseline = + { captured_at: Time, url_count: Integer, urls: ::Array[String] } + + class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel + attr_accessor captured_at: Time + + attr_accessor url_count: Integer + + attr_accessor urls: ::Array[String] + + def initialize: ( + captured_at: Time, + url_count: Integer, + urls: ::Array[String] + ) -> void + + def to_hash: -> { + captured_at: Time, + url_count: Integer, + urls: ::Array[String] + } + end + + type monitors_extract_baseline = + { captured_at: Time, data: top, urls_analyzed: ::Array[String] } + + class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel + attr_accessor captured_at: Time + + attr_accessor data: top + + attr_accessor urls_analyzed: ::Array[String] + + def initialize: ( + captured_at: Time, + data: top, + urls_analyzed: ::Array[String] + ) -> void + + def to_hash: -> { + captured_at: Time, + data: top, + urls_analyzed: ::Array[String] + } + end + + def self?.variants: -> ::Array[ContextDev::Models::MonitorRetrieveResponse::baseline] + end + type last_error = { code: String, message: String } class LastError < ContextDev::Internal::Type::BaseModel diff --git a/sig/context_dev/models/monitor_update_params.rbs b/sig/context_dev/models/monitor_update_params.rbs index 91d6918e..35cb1462 100644 --- a/sig/context_dev/models/monitor_update_params.rbs +++ b/sig/context_dev/models/monitor_update_params.rbs @@ -94,12 +94,9 @@ module ContextDev def to_hash: -> { type: :exact } end - type semantic = - { query: String, type: :semantic, confidence_threshold: Float } + type semantic = { type: :semantic, confidence_threshold: Float } class Semantic < ContextDev::Internal::Type::BaseModel - attr_accessor query: String - attr_accessor type: :semantic attr_reader confidence_threshold: Float? @@ -107,16 +104,11 @@ module ContextDev def confidence_threshold=: (Float) -> Float def initialize: ( - query: String, ?confidence_threshold: Float, ?type: :semantic ) -> void - def to_hash: -> { - query: String, - type: :semantic, - confidence_threshold: Float - } + def to_hash: -> { type: :semantic, confidence_threshold: Float } end def self?.variants: -> ::Array[ContextDev::Models::MonitorUpdateParams::change_detection] @@ -259,16 +251,18 @@ module ContextDev type extract = { + instructions: String, type: :extract, url: String, follow_subdomains: bool, - instructions: String, max_depth: Integer, max_pages: Integer, schema: ::Hash[Symbol, top] } class Extract < ContextDev::Internal::Type::BaseModel + attr_accessor instructions: String + attr_accessor type: :extract attr_accessor url: String @@ -277,10 +271,6 @@ module ContextDev def follow_subdomains=: (bool) -> bool - attr_reader instructions: String? - - def instructions=: (String) -> String - attr_reader max_depth: Integer? def max_depth=: (Integer) -> Integer @@ -294,9 +284,9 @@ module ContextDev def schema=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] def initialize: ( + instructions: String, url: String, ?follow_subdomains: bool, - ?instructions: String, ?max_depth: Integer, ?max_pages: Integer, ?schema: ::Hash[Symbol, top], @@ -304,10 +294,10 @@ module ContextDev ) -> void def to_hash: -> { + instructions: String, type: :extract, url: String, follow_subdomains: bool, - instructions: String, max_depth: Integer, max_pages: Integer, schema: ::Hash[Symbol, top] diff --git a/sig/context_dev/models/monitor_update_response.rbs b/sig/context_dev/models/monitor_update_response.rbs index 5a63ecd5..e473c21d 100644 --- a/sig/context_dev/models/monitor_update_response.rbs +++ b/sig/context_dev/models/monitor_update_response.rbs @@ -11,6 +11,7 @@ module ContextDev status: ContextDev::Models::MonitorUpdateResponse::status, target: ContextDev::Models::MonitorUpdateResponse::target, updated_at: Time, + baseline: ContextDev::Models::MonitorUpdateResponse::baseline?, last_change_at: Time?, last_error: ContextDev::Models::MonitorUpdateResponse::LastError?, last_run_at: Time?, @@ -38,6 +39,8 @@ module ContextDev attr_accessor updated_at: Time + attr_accessor baseline: ContextDev::Models::MonitorUpdateResponse::baseline? + attr_accessor last_change_at: Time? attr_accessor last_error: ContextDev::Models::MonitorUpdateResponse::LastError? @@ -62,6 +65,7 @@ module ContextDev status: ContextDev::Models::MonitorUpdateResponse::status, target: ContextDev::Models::MonitorUpdateResponse::target, updated_at: Time, + ?baseline: ContextDev::Models::MonitorUpdateResponse::baseline?, ?last_change_at: Time?, ?last_error: ContextDev::Models::MonitorUpdateResponse::LastError?, ?last_run_at: Time?, @@ -80,6 +84,7 @@ module ContextDev status: ContextDev::Models::MonitorUpdateResponse::status, target: ContextDev::Models::MonitorUpdateResponse::target, updated_at: Time, + baseline: ContextDev::Models::MonitorUpdateResponse::baseline?, last_change_at: Time?, last_error: ContextDev::Models::MonitorUpdateResponse::LastError?, last_run_at: Time?, @@ -105,12 +110,9 @@ module ContextDev def to_hash: -> { type: :exact } end - type semantic = - { query: String, type: :semantic, confidence_threshold: Float } + type semantic = { type: :semantic, confidence_threshold: Float } class Semantic < ContextDev::Internal::Type::BaseModel - attr_accessor query: String - attr_accessor type: :semantic attr_reader confidence_threshold: Float? @@ -118,16 +120,11 @@ module ContextDev def confidence_threshold=: (Float) -> Float def initialize: ( - query: String, ?confidence_threshold: Float, ?type: :semantic ) -> void - def to_hash: -> { - query: String, - type: :semantic, - confidence_threshold: Float - } + def to_hash: -> { type: :semantic, confidence_threshold: Float } end def self?.variants: -> ::Array[ContextDev::Models::MonitorUpdateResponse::change_detection] @@ -281,16 +278,18 @@ module ContextDev type extract = { + instructions: String, type: :extract, url: String, follow_subdomains: bool, - instructions: String, max_depth: Integer, max_pages: Integer, schema: ::Hash[Symbol, top] } class Extract < ContextDev::Internal::Type::BaseModel + attr_accessor instructions: String + attr_accessor type: :extract attr_accessor url: String @@ -299,10 +298,6 @@ module ContextDev def follow_subdomains=: (bool) -> bool - attr_reader instructions: String? - - def instructions=: (String) -> String - attr_reader max_depth: Integer? def max_depth=: (Integer) -> Integer @@ -316,9 +311,9 @@ module ContextDev def schema=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] def initialize: ( + instructions: String, url: String, ?follow_subdomains: bool, - ?instructions: String, ?max_depth: Integer, ?max_pages: Integer, ?schema: ::Hash[Symbol, top], @@ -326,10 +321,10 @@ module ContextDev ) -> void def to_hash: -> { + instructions: String, type: :extract, url: String, follow_subdomains: bool, - instructions: String, max_depth: Integer, max_pages: Integer, schema: ::Hash[Symbol, top] @@ -339,6 +334,75 @@ module ContextDev def self?.variants: -> ::Array[ContextDev::Models::MonitorUpdateResponse::target] end + type baseline = + ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsPageBaseline + | ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsSitemapBaseline + | ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsExtractBaseline + + module Baseline + extend ContextDev::Internal::Type::Union + + type monitors_page_baseline = { captured_at: Time, text: String } + + class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel + attr_accessor captured_at: Time + + attr_accessor text: String + + def initialize: (captured_at: Time, text: String) -> void + + def to_hash: -> { captured_at: Time, text: String } + end + + type monitors_sitemap_baseline = + { captured_at: Time, url_count: Integer, urls: ::Array[String] } + + class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel + attr_accessor captured_at: Time + + attr_accessor url_count: Integer + + attr_accessor urls: ::Array[String] + + def initialize: ( + captured_at: Time, + url_count: Integer, + urls: ::Array[String] + ) -> void + + def to_hash: -> { + captured_at: Time, + url_count: Integer, + urls: ::Array[String] + } + end + + type monitors_extract_baseline = + { captured_at: Time, data: top, urls_analyzed: ::Array[String] } + + class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel + attr_accessor captured_at: Time + + attr_accessor data: top + + attr_accessor urls_analyzed: ::Array[String] + + def initialize: ( + captured_at: Time, + data: top, + urls_analyzed: ::Array[String] + ) -> void + + def to_hash: -> { + captured_at: Time, + data: top, + urls_analyzed: ::Array[String] + } + end + + def self?.variants: -> ::Array[ContextDev::Models::MonitorUpdateResponse::baseline] + end + type last_error = { code: String, message: String } class LastError < ContextDev::Internal::Type::BaseModel diff --git a/test/context_dev/resources/monitors_test.rb b/test/context_dev/resources/monitors_test.rb index 14c23d0d..ef45e4b5 100644 --- a/test/context_dev/resources/monitors_test.rb +++ b/test/context_dev/resources/monitors_test.rb @@ -29,6 +29,7 @@ def test_create_required_params status: ContextDev::Models::MonitorCreateResponse::Status, target: ContextDev::Models::MonitorCreateResponse::Target, updated_at: Time, + baseline: ContextDev::Models::MonitorCreateResponse::Baseline | nil, last_change_at: Time | nil, last_error: ContextDev::Models::MonitorCreateResponse::LastError | nil, last_run_at: Time | nil, @@ -59,6 +60,7 @@ def test_retrieve status: ContextDev::Models::MonitorRetrieveResponse::Status, target: ContextDev::Models::MonitorRetrieveResponse::Target, updated_at: Time, + baseline: ContextDev::Models::MonitorRetrieveResponse::Baseline | nil, last_change_at: Time | nil, last_error: ContextDev::Models::MonitorRetrieveResponse::LastError | nil, last_run_at: Time | nil, @@ -89,6 +91,7 @@ def test_update status: ContextDev::Models::MonitorUpdateResponse::Status, target: ContextDev::Models::MonitorUpdateResponse::Target, updated_at: Time, + baseline: ContextDev::Models::MonitorUpdateResponse::Baseline | nil, last_change_at: Time | nil, last_error: ContextDev::Models::MonitorUpdateResponse::LastError | nil, last_run_at: Time | nil, @@ -237,7 +240,6 @@ def test_retrieve_change importance: ContextDev::Models::MonitorRetrieveChangeResponse::Importance | nil, matched_url_count: Integer | nil, matched_urls: ^(ContextDev::Internal::Type::ArrayOf[String]) | nil, - query: String | nil, removed_url_count: Integer | nil, removed_urls: ^(ContextDev::Internal::Type::ArrayOf[String]) | nil, tags: ^(ContextDev::Internal::Type::ArrayOf[String]) | nil