context.dev 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/models/brand_retrieve_params.rb +46 -3
  5. data/lib/context_dev/models/monitor_create_params.rb +36 -28
  6. data/lib/context_dev/models/monitor_create_response.rb +158 -29
  7. data/lib/context_dev/models/monitor_list_account_runs_response.rb +102 -1
  8. data/lib/context_dev/models/monitor_list_params.rb +4 -4
  9. data/lib/context_dev/models/monitor_list_response.rb +158 -29
  10. data/lib/context_dev/models/monitor_list_runs_response.rb +100 -1
  11. data/lib/context_dev/models/monitor_retrieve_change_response.rb +1 -8
  12. data/lib/context_dev/models/monitor_retrieve_response.rb +158 -29
  13. data/lib/context_dev/models/monitor_update_params.rb +36 -28
  14. data/lib/context_dev/models/monitor_update_response.rb +158 -29
  15. data/lib/context_dev/resources/brand.rb +4 -2
  16. data/lib/context_dev/resources/monitors.rb +1 -1
  17. data/lib/context_dev/version.rb +1 -1
  18. data/rbi/context_dev/models/brand_retrieve_params.rbi +67 -0
  19. data/rbi/context_dev/models/monitor_create_params.rbi +44 -33
  20. data/rbi/context_dev/models/monitor_create_response.rbi +243 -33
  21. data/rbi/context_dev/models/monitor_list_account_runs_response.rbi +204 -3
  22. data/rbi/context_dev/models/monitor_list_params.rbi +9 -6
  23. data/rbi/context_dev/models/monitor_list_response.rbi +247 -33
  24. data/rbi/context_dev/models/monitor_list_runs_response.rbi +204 -3
  25. data/rbi/context_dev/models/monitor_retrieve_change_response.rbi +0 -9
  26. data/rbi/context_dev/models/monitor_retrieve_response.rbi +243 -33
  27. data/rbi/context_dev/models/monitor_update_params.rbi +44 -33
  28. data/rbi/context_dev/models/monitor_update_response.rbi +243 -33
  29. data/rbi/context_dev/resources/brand.rbi +4 -1
  30. data/rbi/context_dev/resources/monitors.rbi +2 -2
  31. data/sig/context_dev/models/brand_retrieve_params.rbs +26 -0
  32. data/sig/context_dev/models/monitor_create_params.rbs +7 -17
  33. data/sig/context_dev/models/monitor_create_response.rbs +81 -17
  34. data/sig/context_dev/models/monitor_list_account_runs_response.rbs +74 -3
  35. data/sig/context_dev/models/monitor_list_params.rbs +2 -2
  36. data/sig/context_dev/models/monitor_list_response.rbs +81 -17
  37. data/sig/context_dev/models/monitor_list_runs_response.rbs +74 -3
  38. data/sig/context_dev/models/monitor_retrieve_change_response.rbs +0 -7
  39. data/sig/context_dev/models/monitor_retrieve_response.rbs +81 -17
  40. data/sig/context_dev/models/monitor_update_params.rbs +7 -17
  41. data/sig/context_dev/models/monitor_update_response.rbs +81 -17
  42. metadata +2 -2
@@ -61,6 +61,15 @@ module ContextDev
61
61
  # @return [Time]
62
62
  required :updated_at, Time
63
63
 
64
+ # @!attribute baseline
65
+ # Current baseline: the last observed value the monitor compares new snapshots
66
+ # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
67
+ # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
68
+ # after a target or change_detection update, which resets the baseline).
69
+ #
70
+ # @return [ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsExtractBaseline, nil]
71
+ optional :baseline, union: -> { ContextDev::Models::MonitorUpdateResponse::Baseline }, nil?: true
72
+
64
73
  # @!attribute last_change_at
65
74
  #
66
75
  # @return [Time, nil]
@@ -94,7 +103,7 @@ module ContextDev
94
103
  # @return [ContextDev::Models::MonitorUpdateResponse::Webhook, nil]
95
104
  optional :webhook, -> { ContextDev::Models::MonitorUpdateResponse::Webhook }, nil?: true
96
105
 
97
- # @!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)
106
+ # @!method initialize(id:, change_detection:, created_at:, mode:, name:, schedule:, status:, target:, updated_at:, baseline: nil, last_change_at: nil, last_error: nil, last_run_at: nil, next_run_at: nil, tags: nil, webhook: nil)
98
107
  # Some parameter documentations has been truncated, see
99
108
  # {ContextDev::Models::MonitorUpdateResponse} for more details.
100
109
  #
@@ -119,6 +128,8 @@ module ContextDev
119
128
  #
120
129
  # @param updated_at [Time]
121
130
  #
131
+ # @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
132
+ #
122
133
  # @param last_change_at [Time, nil]
123
134
  #
124
135
  # @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 ContextDev
142
153
  # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
143
154
  variant :exact, -> { ContextDev::Models::MonitorUpdateResponse::ChangeDetection::Exact }
144
155
 
145
- # Detect meaning-level changes that match a natural language query.
156
+ # Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided).
146
157
  variant :semantic, -> { ContextDev::Models::MonitorUpdateResponse::ChangeDetection::Semantic }
147
158
 
148
159
  class Exact < ContextDev::Internal::Type::BaseModel
@@ -159,11 +170,6 @@ module ContextDev
159
170
  end
160
171
 
161
172
  class Semantic < ContextDev::Internal::Type::BaseModel
162
- # @!attribute query
163
- #
164
- # @return [String]
165
- required :query, String
166
-
167
173
  # @!attribute type
168
174
  #
169
175
  # @return [Symbol, :semantic]
@@ -174,10 +180,11 @@ module ContextDev
174
180
  # @return [Float, nil]
175
181
  optional :confidence_threshold, Float
176
182
 
177
- # @!method initialize(query:, confidence_threshold: nil, type: :semantic)
178
- # Detect meaning-level changes that match a natural language query.
183
+ # @!method initialize(confidence_threshold: nil, type: :semantic)
184
+ # Detect meaning-level changes to tracked page content, ignoring cosmetic or
185
+ # paraphrase-only differences. Which changes are meaningful is judged against the
186
+ # extract target's `instructions` (and `schema`, when provided).
179
187
  #
180
- # @param query [String]
181
188
  # @param confidence_threshold [Float]
182
189
  # @param type [Symbol, :semantic]
183
190
  end
@@ -285,10 +292,10 @@ module ContextDev
285
292
  # Watch a single web page.
286
293
  variant :page, -> { ContextDev::Models::MonitorUpdateResponse::Target::Page }
287
294
 
288
- # 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.
295
+ # 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.
289
296
  variant :sitemap, -> { ContextDev::Models::MonitorUpdateResponse::Target::Sitemap }
290
297
 
291
- # Watch a site's extracted structured data.
298
+ # Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged for relevance against the monitor's `instructions` (and `schema`, when provided). The tracked page set is refreshed by a periodic re-discovery crawl.
292
299
  variant :extract, -> { ContextDev::Models::MonitorUpdateResponse::Target::Extract }
293
300
 
294
301
  class Page < ContextDev::Internal::Type::BaseModel
@@ -351,8 +358,9 @@ module ContextDev
351
358
  # @!method initialize(url:, exclude: nil, include: nil, max_urls: nil, type: :sitemap)
352
359
  # Watch a sitemap for URL additions and removals. Crawled URLs are normalized
353
360
  # (lowercased host, no trailing slash/fragment) and scoped to the monitored site
354
- # and its subdomains before comparison. A new URL set must be observed on two
355
- # consecutive runs before a change is reported, suppressing one-run crawl flaps.
361
+ # and its subdomains before comparison. On a detected difference the sitemap is
362
+ # re-fetched within the same run and only URLs both observations agree on are
363
+ # reported, suppressing transient crawl flaps.
356
364
  #
357
365
  # @param url [String] Sitemap URL to monitor.
358
366
  #
@@ -366,6 +374,13 @@ module ContextDev
366
374
  end
367
375
 
368
376
  class Extract < ContextDev::Internal::Type::BaseModel
377
+ # @!attribute instructions
378
+ # Natural-language instructions guiding which pages and facts to track and which
379
+ # changes to report.
380
+ #
381
+ # @return [String]
382
+ required :instructions, String
383
+
369
384
  # @!attribute type
370
385
  #
371
386
  # @return [Symbol, :extract]
@@ -382,12 +397,6 @@ module ContextDev
382
397
  # @return [Boolean, nil]
383
398
  optional :follow_subdomains, ContextDev::Internal::Type::Boolean
384
399
 
385
- # @!attribute instructions
386
- # Optional natural-language instructions guiding what to extract.
387
- #
388
- # @return [String, nil]
389
- optional :instructions, String
390
-
391
400
  # @!attribute max_depth
392
401
  # Optional maximum link depth from the starting URL (0 = only the starting page).
393
402
  #
@@ -395,35 +404,45 @@ module ContextDev
395
404
  optional :max_depth, Integer
396
405
 
397
406
  # @!attribute max_pages
398
- # Maximum number of pages to analyze during extraction.
407
+ # Maximum number of pages to track.
399
408
  #
400
409
  # @return [Integer, nil]
401
410
  optional :max_pages, Integer
402
411
 
403
412
  # @!attribute schema
404
- # JSON Schema describing the structured data to extract and watch for changes. If
405
- # omitted, a default summary + key-points schema is used.
413
+ # JSON Schema describing the data you care about. It is used three ways: it guides
414
+ # which pages are selected for tracking, it gives the change judge extra context
415
+ # on which changes matter (alongside `instructions`), and it defines the shape of
416
+ # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
417
+ # about once a day). It is not a response format for changes: change events and
418
+ # webhook payloads always contain diffs, summaries, and evidence excerpts — never
419
+ # data in this schema's shape. If omitted, a default summary + key-points schema
420
+ # is used.
406
421
  #
407
422
  # @return [Hash{Symbol=>Object}, nil]
408
423
  optional :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown]
409
424
 
410
- # @!method initialize(url:, follow_subdomains: nil, instructions: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract)
425
+ # @!method initialize(instructions:, url:, follow_subdomains: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract)
411
426
  # Some parameter documentations has been truncated, see
412
427
  # {ContextDev::Models::MonitorUpdateResponse::Target::Extract} for more details.
413
428
  #
414
- # Watch a site's extracted structured data.
429
+ # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
430
+ # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
431
+ # track; each run re-checks exactly those pages, and confirmed content changes are
432
+ # judged for relevance against the monitor's `instructions` (and `schema`, when
433
+ # provided). The tracked page set is refreshed by a periodic re-discovery crawl.
434
+ #
435
+ # @param instructions [String] Natural-language instructions guiding which pages and facts to track and which c
415
436
  #
416
437
  # @param url [String] Root URL to extract structured data from.
417
438
  #
418
439
  # @param follow_subdomains [Boolean]
419
440
  #
420
- # @param instructions [String] Optional natural-language instructions guiding what to extract.
421
- #
422
441
  # @param max_depth [Integer] Optional maximum link depth from the starting URL (0 = only the starting page).
423
442
  #
424
- # @param max_pages [Integer] Maximum number of pages to analyze during extraction.
443
+ # @param max_pages [Integer] Maximum number of pages to track.
425
444
  #
426
- # @param schema [Hash{Symbol=>Object}] JSON Schema describing the structured data to extract and watch for changes. If
445
+ # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It is used three ways: it guides
427
446
  #
428
447
  # @param type [Symbol, :extract]
429
448
  end
@@ -432,6 +451,116 @@ module ContextDev
432
451
  # @return [Array(ContextDev::Models::MonitorUpdateResponse::Target::Page, ContextDev::Models::MonitorUpdateResponse::Target::Sitemap, ContextDev::Models::MonitorUpdateResponse::Target::Extract)]
433
452
  end
434
453
 
454
+ # Current baseline: the last observed value the monitor compares new snapshots
455
+ # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
456
+ # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
457
+ # after a target or change_detection update, which resets the baseline).
458
+ #
459
+ # @see ContextDev::Models::MonitorUpdateResponse#baseline
460
+ module Baseline
461
+ extend ContextDev::Internal::Type::Union
462
+
463
+ # Current baseline of a `page` monitor: the visible page text as last observed.
464
+ variant -> { ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsPageBaseline }
465
+
466
+ # Current baseline of a `sitemap` monitor: the normalized URL set as last observed.
467
+ variant -> { ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsSitemapBaseline }
468
+
469
+ # Current baseline of an `extract` monitor: the pages it tracks and the structured data as last extracted.
470
+ variant -> { ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsExtractBaseline }
471
+
472
+ class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel
473
+ # @!attribute captured_at
474
+ # When this baseline was last captured or replaced.
475
+ #
476
+ # @return [Time]
477
+ required :captured_at, Time
478
+
479
+ # @!attribute text
480
+ # The page's visible text as last observed.
481
+ #
482
+ # @return [String]
483
+ required :text, String
484
+
485
+ # @!method initialize(captured_at:, text:)
486
+ # Current baseline of a `page` monitor: the visible page text as last observed.
487
+ #
488
+ # @param captured_at [Time] When this baseline was last captured or replaced.
489
+ #
490
+ # @param text [String] The page's visible text as last observed.
491
+ end
492
+
493
+ class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel
494
+ # @!attribute captured_at
495
+ # When this baseline was last captured or replaced.
496
+ #
497
+ # @return [Time]
498
+ required :captured_at, Time
499
+
500
+ # @!attribute url_count
501
+ # Number of URLs in the baseline.
502
+ #
503
+ # @return [Integer]
504
+ required :url_count, Integer
505
+
506
+ # @!attribute urls
507
+ # The sitemap URLs as last observed (sorted, normalized).
508
+ #
509
+ # @return [Array<String>]
510
+ required :urls, ContextDev::Internal::Type::ArrayOf[String]
511
+
512
+ # @!method initialize(captured_at:, url_count:, urls:)
513
+ # Current baseline of a `sitemap` monitor: the normalized URL set as last
514
+ # observed.
515
+ #
516
+ # @param captured_at [Time] When this baseline was last captured or replaced.
517
+ #
518
+ # @param url_count [Integer] Number of URLs in the baseline.
519
+ #
520
+ # @param urls [Array<String>] The sitemap URLs as last observed (sorted, normalized).
521
+ end
522
+
523
+ class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel
524
+ # @!attribute captured_at
525
+ # When this baseline was last captured or replaced.
526
+ #
527
+ # @return [Time]
528
+ required :captured_at, Time
529
+
530
+ # @!attribute data
531
+ # The extracted structured data, matching the monitor's extraction schema (same
532
+ # shape as the /web/extract endpoint's `data`). Refreshed when the monitor
533
+ # re-discovers its page set (at most about once a day); `null` when no extraction
534
+ # has been captured yet.
535
+ #
536
+ # @return [Object]
537
+ required :data, ContextDev::Internal::Type::Unknown
538
+
539
+ # @!attribute urls_analyzed
540
+ # The page URLs the monitor tracks and analyzes for changes.
541
+ #
542
+ # @return [Array<String>]
543
+ required :urls_analyzed, ContextDev::Internal::Type::ArrayOf[String]
544
+
545
+ # @!method initialize(captured_at:, data:, urls_analyzed:)
546
+ # Some parameter documentations has been truncated, see
547
+ # {ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsExtractBaseline}
548
+ # for more details.
549
+ #
550
+ # Current baseline of an `extract` monitor: the pages it tracks and the structured
551
+ # data as last extracted.
552
+ #
553
+ # @param captured_at [Time] When this baseline was last captured or replaced.
554
+ #
555
+ # @param data [Object] The extracted structured data, matching the monitor's extraction schema (same sh
556
+ #
557
+ # @param urls_analyzed [Array<String>] The page URLs the monitor tracks and analyzes for changes.
558
+ end
559
+
560
+ # @!method self.variants
561
+ # @return [Array(ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorUpdateResponse::Baseline::MonitorsExtractBaseline)]
562
+ end
563
+
435
564
  # @see ContextDev::Models::MonitorUpdateResponse#last_error
436
565
  class LastError < ContextDev::Internal::Type::BaseModel
437
566
  # @!attribute code
@@ -5,11 +5,13 @@ module ContextDev
5
5
  class Brand
6
6
  # Retrieve logos, backdrops, colors, industry, description, and more. Provide
7
7
  # exactly one lookup identifier in the request body: a domain, company name, email
8
- # address, stock ticker, or transaction descriptor.
8
+ # address, stock ticker, transaction descriptor, or direct URL. Note:
9
+ # `by_direct_url` fetches brand data only from the provided URL — not from the
10
+ # entire internet.
9
11
  #
10
12
  # @overload retrieve(body:, request_options: {})
11
13
  #
12
- # @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.
14
+ # @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.
13
15
  #
14
16
  # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
15
17
  #
@@ -122,7 +122,7 @@ module ContextDev
122
122
  #
123
123
  # @param q [String] Free-text search term, matched against the fields named in `search_by`.
124
124
  #
125
- # @param search_by [Array<Symbol, ContextDev::Models::MonitorListParams::SearchBy>] Comma-separated fields to search with `q`. Defaults to all of them. Note `query`
125
+ # @param search_by [Array<Symbol, ContextDev::Models::MonitorListParams::SearchBy>] Comma-separated fields to search with `q`. Defaults to all of them. Note `instru
126
126
  #
127
127
  # @param search_type [Symbol, ContextDev::Models::MonitorListParams::SearchType] `prefix` for as-you-type prefix matching (default), `exact` for full-token match
128
128
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ContextDev
4
- VERSION = "2.0.0"
4
+ VERSION = "2.2.0"
5
5
  end
@@ -19,6 +19,7 @@ module ContextDev
19
19
  ContextDev::BrandRetrieveParams::Body::ByName,
20
20
  ContextDev::BrandRetrieveParams::Body::ByEmail,
21
21
  ContextDev::BrandRetrieveParams::Body::ByTicker,
22
+ ContextDev::BrandRetrieveParams::Body::ByDirectURL,
22
23
  ContextDev::BrandRetrieveParams::Body::ByTransaction
23
24
  )
24
25
  )
@@ -33,6 +34,7 @@ module ContextDev
33
34
  ContextDev::BrandRetrieveParams::Body::ByName::OrHash,
34
35
  ContextDev::BrandRetrieveParams::Body::ByEmail::OrHash,
35
36
  ContextDev::BrandRetrieveParams::Body::ByTicker::OrHash,
37
+ ContextDev::BrandRetrieveParams::Body::ByDirectURL::OrHash,
36
38
  ContextDev::BrandRetrieveParams::Body::ByTransaction::OrHash
37
39
  ),
38
40
  request_options: ContextDev::RequestOptions::OrHash
@@ -54,6 +56,7 @@ module ContextDev
54
56
  ContextDev::BrandRetrieveParams::Body::ByName,
55
57
  ContextDev::BrandRetrieveParams::Body::ByEmail,
56
58
  ContextDev::BrandRetrieveParams::Body::ByTicker,
59
+ ContextDev::BrandRetrieveParams::Body::ByDirectURL,
57
60
  ContextDev::BrandRetrieveParams::Body::ByTransaction
58
61
  ),
59
62
  request_options: ContextDev::RequestOptions
@@ -74,6 +77,7 @@ module ContextDev
74
77
  ContextDev::BrandRetrieveParams::Body::ByName,
75
78
  ContextDev::BrandRetrieveParams::Body::ByEmail,
76
79
  ContextDev::BrandRetrieveParams::Body::ByTicker,
80
+ ContextDev::BrandRetrieveParams::Body::ByDirectURL,
77
81
  ContextDev::BrandRetrieveParams::Body::ByTransaction
78
82
  )
79
83
  end
@@ -3054,6 +3058,69 @@ module ContextDev
3054
3058
  end
3055
3059
  end
3056
3060
 
3061
+ class ByDirectURL < ContextDev::Internal::Type::BaseModel
3062
+ OrHash =
3063
+ T.type_alias do
3064
+ T.any(
3065
+ ContextDev::BrandRetrieveParams::Body::ByDirectURL,
3066
+ ContextDev::Internal::AnyHash
3067
+ )
3068
+ end
3069
+
3070
+ # Full http(s) URL to fetch brand data from (e.g.,
3071
+ # 'https://stripe.com/enterprise'). Only this URL is fetched — not the entire
3072
+ # internet.
3073
+ sig { returns(String) }
3074
+ attr_accessor :direct_url
3075
+
3076
+ # Discriminator for direct-URL-based brand retrieval.
3077
+ sig { returns(Symbol) }
3078
+ attr_accessor :type
3079
+
3080
+ # Optional timeout in milliseconds for the request. If the request takes longer
3081
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
3082
+ # value is 300000ms (5 minutes).
3083
+ sig { returns(T.nilable(Integer)) }
3084
+ attr_reader :timeout_ms
3085
+
3086
+ sig { params(timeout_ms: Integer).void }
3087
+ attr_writer :timeout_ms
3088
+
3089
+ # Retrieve brand data by fetching the provided URL directly. Note: if you use
3090
+ # this, brand data is fetched only from the provided URL — not from the entire
3091
+ # internet — so results are limited to what that single page contains. No domain
3092
+ # resolution, database lookup, or cross-source enrichment is performed. Cannot be
3093
+ # combined with domain, name, email, or ticker.
3094
+ sig do
3095
+ params(
3096
+ direct_url: String,
3097
+ timeout_ms: Integer,
3098
+ type: Symbol
3099
+ ).returns(T.attached_class)
3100
+ end
3101
+ def self.new(
3102
+ # Full http(s) URL to fetch brand data from (e.g.,
3103
+ # 'https://stripe.com/enterprise'). Only this URL is fetched — not the entire
3104
+ # internet.
3105
+ direct_url:,
3106
+ # Optional timeout in milliseconds for the request. If the request takes longer
3107
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
3108
+ # value is 300000ms (5 minutes).
3109
+ timeout_ms: nil,
3110
+ # Discriminator for direct-URL-based brand retrieval.
3111
+ type: :by_direct_url
3112
+ )
3113
+ end
3114
+
3115
+ sig do
3116
+ override.returns(
3117
+ { direct_url: String, type: Symbol, timeout_ms: Integer }
3118
+ )
3119
+ end
3120
+ def to_hash
3121
+ end
3122
+ end
3123
+
3057
3124
  class ByTransaction < ContextDev::Internal::Type::BaseModel
3058
3125
  OrHash =
3059
3126
  T.type_alias do
@@ -186,9 +186,6 @@ module ContextDev
186
186
  )
187
187
  end
188
188
 
189
- sig { returns(String) }
190
- attr_accessor :query
191
-
192
189
  sig { returns(Symbol) }
193
190
  attr_accessor :type
194
191
 
@@ -198,21 +195,19 @@ module ContextDev
198
195
  sig { params(confidence_threshold: Float).void }
199
196
  attr_writer :confidence_threshold
200
197
 
201
- # Detect meaning-level changes that match a natural language query.
198
+ # Detect meaning-level changes to tracked page content, ignoring cosmetic or
199
+ # paraphrase-only differences. Which changes are meaningful is judged against the
200
+ # extract target's `instructions` (and `schema`, when provided).
202
201
  sig do
203
- params(
204
- query: String,
205
- confidence_threshold: Float,
206
- type: Symbol
207
- ).returns(T.attached_class)
202
+ params(confidence_threshold: Float, type: Symbol).returns(
203
+ T.attached_class
204
+ )
208
205
  end
209
- def self.new(query:, confidence_threshold: nil, type: :semantic)
206
+ def self.new(confidence_threshold: nil, type: :semantic)
210
207
  end
211
208
 
212
209
  sig do
213
- override.returns(
214
- { query: String, type: Symbol, confidence_threshold: Float }
215
- )
210
+ override.returns({ type: Symbol, confidence_threshold: Float })
216
211
  end
217
212
  def to_hash
218
213
  end
@@ -446,8 +441,9 @@ module ContextDev
446
441
 
447
442
  # Watch a sitemap for URL additions and removals. Crawled URLs are normalized
448
443
  # (lowercased host, no trailing slash/fragment) and scoped to the monitored site
449
- # and its subdomains before comparison. A new URL set must be observed on two
450
- # consecutive runs before a change is reported, suppressing one-run crawl flaps.
444
+ # and its subdomains before comparison. On a detected difference the sitemap is
445
+ # re-fetched within the same run and only URLs both observations agree on are
446
+ # reported, suppressing transient crawl flaps.
451
447
  sig do
452
448
  params(
453
449
  url: String,
@@ -494,6 +490,11 @@ module ContextDev
494
490
  )
495
491
  end
496
492
 
493
+ # Natural-language instructions guiding which pages and facts to track and which
494
+ # changes to report.
495
+ sig { returns(String) }
496
+ attr_accessor :instructions
497
+
497
498
  sig { returns(Symbol) }
498
499
  attr_accessor :type
499
500
 
@@ -507,13 +508,6 @@ module ContextDev
507
508
  sig { params(follow_subdomains: T::Boolean).void }
508
509
  attr_writer :follow_subdomains
509
510
 
510
- # Optional natural-language instructions guiding what to extract.
511
- sig { returns(T.nilable(String)) }
512
- attr_reader :instructions
513
-
514
- sig { params(instructions: String).void }
515
- attr_writer :instructions
516
-
517
511
  # Optional maximum link depth from the starting URL (0 = only the starting page).
518
512
  sig { returns(T.nilable(Integer)) }
519
513
  attr_reader :max_depth
@@ -521,27 +515,37 @@ module ContextDev
521
515
  sig { params(max_depth: Integer).void }
522
516
  attr_writer :max_depth
523
517
 
524
- # Maximum number of pages to analyze during extraction.
518
+ # Maximum number of pages to track.
525
519
  sig { returns(T.nilable(Integer)) }
526
520
  attr_reader :max_pages
527
521
 
528
522
  sig { params(max_pages: Integer).void }
529
523
  attr_writer :max_pages
530
524
 
531
- # JSON Schema describing the structured data to extract and watch for changes. If
532
- # omitted, a default summary + key-points schema is used.
525
+ # JSON Schema describing the data you care about. It is used three ways: it guides
526
+ # which pages are selected for tracking, it gives the change judge extra context
527
+ # on which changes matter (alongside `instructions`), and it defines the shape of
528
+ # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
529
+ # about once a day). It is not a response format for changes: change events and
530
+ # webhook payloads always contain diffs, summaries, and evidence excerpts — never
531
+ # data in this schema's shape. If omitted, a default summary + key-points schema
532
+ # is used.
533
533
  sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
534
534
  attr_reader :schema
535
535
 
536
536
  sig { params(schema: T::Hash[Symbol, T.anything]).void }
537
537
  attr_writer :schema
538
538
 
539
- # Watch a site's extracted structured data.
539
+ # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
540
+ # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
541
+ # track; each run re-checks exactly those pages, and confirmed content changes are
542
+ # judged for relevance against the monitor's `instructions` (and `schema`, when
543
+ # provided). The tracked page set is refreshed by a periodic re-discovery crawl.
540
544
  sig do
541
545
  params(
546
+ instructions: String,
542
547
  url: String,
543
548
  follow_subdomains: T::Boolean,
544
- instructions: String,
545
549
  max_depth: Integer,
546
550
  max_pages: Integer,
547
551
  schema: T::Hash[Symbol, T.anything],
@@ -549,17 +553,24 @@ module ContextDev
549
553
  ).returns(T.attached_class)
550
554
  end
551
555
  def self.new(
556
+ # Natural-language instructions guiding which pages and facts to track and which
557
+ # changes to report.
558
+ instructions:,
552
559
  # Root URL to extract structured data from.
553
560
  url:,
554
561
  follow_subdomains: nil,
555
- # Optional natural-language instructions guiding what to extract.
556
- instructions: nil,
557
562
  # Optional maximum link depth from the starting URL (0 = only the starting page).
558
563
  max_depth: nil,
559
- # Maximum number of pages to analyze during extraction.
564
+ # Maximum number of pages to track.
560
565
  max_pages: nil,
561
- # JSON Schema describing the structured data to extract and watch for changes. If
562
- # omitted, a default summary + key-points schema is used.
566
+ # JSON Schema describing the data you care about. It is used three ways: it guides
567
+ # which pages are selected for tracking, it gives the change judge extra context
568
+ # on which changes matter (alongside `instructions`), and it defines the shape of
569
+ # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
570
+ # about once a day). It is not a response format for changes: change events and
571
+ # webhook payloads always contain diffs, summaries, and evidence excerpts — never
572
+ # data in this schema's shape. If omitted, a default summary + key-points schema
573
+ # is used.
563
574
  schema: nil,
564
575
  type: :extract
565
576
  )
@@ -568,10 +579,10 @@ module ContextDev
568
579
  sig do
569
580
  override.returns(
570
581
  {
582
+ instructions: String,
571
583
  type: Symbol,
572
584
  url: String,
573
585
  follow_subdomains: T::Boolean,
574
- instructions: String,
575
586
  max_depth: Integer,
576
587
  max_pages: Integer,
577
588
  schema: T::Hash[Symbol, T.anything]