context.dev 2.1.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.
@@ -153,7 +153,7 @@ module ContextDev
153
153
  # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
154
154
  variant :exact, -> { ContextDev::Models::MonitorUpdateResponse::ChangeDetection::Exact }
155
155
 
156
- # 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`.
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).
157
157
  variant :semantic, -> { ContextDev::Models::MonitorUpdateResponse::ChangeDetection::Semantic }
158
158
 
159
159
  class Exact < ContextDev::Internal::Type::BaseModel
@@ -181,9 +181,9 @@ module ContextDev
181
181
  optional :confidence_threshold, Float
182
182
 
183
183
  # @!method initialize(confidence_threshold: nil, type: :semantic)
184
- # Detect meaning-level changes to the extracted data, ignoring cosmetic or
185
- # paraphrase-only differences. What is watched is determined by the extract
186
- # target's `schema` and `instructions`.
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).
187
187
  #
188
188
  # @param confidence_threshold [Float]
189
189
  # @param type [Symbol, :semantic]
@@ -295,7 +295,7 @@ module ContextDev
295
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.
296
296
  variant :sitemap, -> { ContextDev::Models::MonitorUpdateResponse::Target::Sitemap }
297
297
 
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 against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl.
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.
299
299
  variant :extract, -> { ContextDev::Models::MonitorUpdateResponse::Target::Extract }
300
300
 
301
301
  class Page < ContextDev::Internal::Type::BaseModel
@@ -410,9 +410,14 @@ module ContextDev
410
410
  optional :max_pages, Integer
411
411
 
412
412
  # @!attribute schema
413
- # JSON Schema describing the data you care about. It guides which pages are
414
- # selected for tracking and gives the change judge context on what matters. If
415
- # 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.
416
421
  #
417
422
  # @return [Hash{Symbol=>Object}, nil]
418
423
  optional :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown]
@@ -424,8 +429,8 @@ module ContextDev
424
429
  # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
425
430
  # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
426
431
  # track; each run re-checks exactly those pages, and confirmed content changes are
427
- # judged against the monitor's instructions. The tracked page set is refreshed by
428
- # a periodic re-discovery crawl.
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.
429
434
  #
430
435
  # @param instructions [String] Natural-language instructions guiding which pages and facts to track and which c
431
436
  #
@@ -437,7 +442,7 @@ module ContextDev
437
442
  #
438
443
  # @param max_pages [Integer] Maximum number of pages to track.
439
444
  #
440
- # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It guides which pages are select
445
+ # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It is used three ways: it guides
441
446
  #
442
447
  # @param type [Symbol, :extract]
443
448
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ContextDev
4
- VERSION = "2.1.0"
4
+ VERSION = "2.2.0"
5
5
  end
@@ -195,9 +195,9 @@ module ContextDev
195
195
  sig { params(confidence_threshold: Float).void }
196
196
  attr_writer :confidence_threshold
197
197
 
198
- # Detect meaning-level changes to the extracted data, ignoring cosmetic or
199
- # paraphrase-only differences. What is watched is determined by the extract
200
- # target's `schema` and `instructions`.
198
+ # Detect meaning-level changes to tracked page content, ignoring cosmetic or
199
+ # paraphrase-only differences. Which changes are meaningful is judged against the
200
+ # extract target's `instructions` (and `schema`, when provided).
201
201
  sig do
202
202
  params(confidence_threshold: Float, type: Symbol).returns(
203
203
  T.attached_class
@@ -522,9 +522,14 @@ module ContextDev
522
522
  sig { params(max_pages: Integer).void }
523
523
  attr_writer :max_pages
524
524
 
525
- # JSON Schema describing the data you care about. It guides which pages are
526
- # selected for tracking and gives the change judge context on what matters. If
527
- # 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.
528
533
  sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
529
534
  attr_reader :schema
530
535
 
@@ -534,8 +539,8 @@ module ContextDev
534
539
  # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
535
540
  # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
536
541
  # track; each run re-checks exactly those pages, and confirmed content changes are
537
- # judged against the monitor's instructions. The tracked page set is refreshed by
538
- # a periodic re-discovery crawl.
542
+ # judged for relevance against the monitor's `instructions` (and `schema`, when
543
+ # provided). The tracked page set is refreshed by a periodic re-discovery crawl.
539
544
  sig do
540
545
  params(
541
546
  instructions: String,
@@ -558,9 +563,14 @@ module ContextDev
558
563
  max_depth: nil,
559
564
  # Maximum number of pages to track.
560
565
  max_pages: nil,
561
- # JSON Schema describing the data you care about. It guides which pages are
562
- # selected for tracking and gives the change judge context on what matters. If
563
- # 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.
564
574
  schema: nil,
565
575
  type: :extract
566
576
  )
@@ -296,9 +296,9 @@ module ContextDev
296
296
  sig { params(confidence_threshold: Float).void }
297
297
  attr_writer :confidence_threshold
298
298
 
299
- # Detect meaning-level changes to the extracted data, ignoring cosmetic or
300
- # paraphrase-only differences. What is watched is determined by the extract
301
- # target's `schema` and `instructions`.
299
+ # Detect meaning-level changes to tracked page content, ignoring cosmetic or
300
+ # paraphrase-only differences. Which changes are meaningful is judged against the
301
+ # extract target's `instructions` (and `schema`, when provided).
302
302
  sig do
303
303
  params(confidence_threshold: Float, type: Symbol).returns(
304
304
  T.attached_class
@@ -708,9 +708,14 @@ module ContextDev
708
708
  sig { params(max_pages: Integer).void }
709
709
  attr_writer :max_pages
710
710
 
711
- # JSON Schema describing the data you care about. It guides which pages are
712
- # selected for tracking and gives the change judge context on what matters. If
713
- # omitted, a default summary + key-points schema is used.
711
+ # JSON Schema describing the data you care about. It is used three ways: it guides
712
+ # which pages are selected for tracking, it gives the change judge extra context
713
+ # on which changes matter (alongside `instructions`), and it defines the shape of
714
+ # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
715
+ # about once a day). It is not a response format for changes: change events and
716
+ # webhook payloads always contain diffs, summaries, and evidence excerpts — never
717
+ # data in this schema's shape. If omitted, a default summary + key-points schema
718
+ # is used.
714
719
  sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
715
720
  attr_reader :schema
716
721
 
@@ -720,8 +725,8 @@ module ContextDev
720
725
  # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
721
726
  # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
722
727
  # track; each run re-checks exactly those pages, and confirmed content changes are
723
- # judged against the monitor's instructions. The tracked page set is refreshed by
724
- # a periodic re-discovery crawl.
728
+ # judged for relevance against the monitor's `instructions` (and `schema`, when
729
+ # provided). The tracked page set is refreshed by a periodic re-discovery crawl.
725
730
  sig do
726
731
  params(
727
732
  instructions: String,
@@ -744,9 +749,14 @@ module ContextDev
744
749
  max_depth: nil,
745
750
  # Maximum number of pages to track.
746
751
  max_pages: nil,
747
- # JSON Schema describing the data you care about. It guides which pages are
748
- # selected for tracking and gives the change judge context on what matters. If
749
- # omitted, a default summary + key-points schema is used.
752
+ # JSON Schema describing the data you care about. It is used three ways: it guides
753
+ # which pages are selected for tracking, it gives the change judge extra context
754
+ # on which changes matter (alongside `instructions`), and it defines the shape of
755
+ # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
756
+ # about once a day). It is not a response format for changes: change events and
757
+ # webhook payloads always contain diffs, summaries, and evidence excerpts — never
758
+ # data in this schema's shape. If omitted, a default summary + key-points schema
759
+ # is used.
750
760
  schema: nil,
751
761
  type: :extract
752
762
  )
@@ -148,6 +148,26 @@ module ContextDev
148
148
  sig { returns(T.nilable(Time)) }
149
149
  attr_accessor :started_at
150
150
 
151
+ # The webhook delivery attempted for a change detected by this run. Omitted when
152
+ # no webhook was attempted, including historical runs created before delivery
153
+ # tracking was added.
154
+ sig do
155
+ returns(
156
+ T.nilable(
157
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery
158
+ )
159
+ )
160
+ end
161
+ attr_reader :webhook_delivery
162
+
163
+ sig do
164
+ params(
165
+ webhook_delivery:
166
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery::OrHash
167
+ ).void
168
+ end
169
+ attr_writer :webhook_delivery
170
+
151
171
  sig do
152
172
  params(
153
173
  id: String,
@@ -173,7 +193,9 @@ module ContextDev
173
193
  T.nilable(
174
194
  ContextDev::Models::MonitorListAccountRunsResponse::Data::SkipReason::OrSymbol
175
195
  ),
176
- started_at: T.nilable(Time)
196
+ started_at: T.nilable(Time),
197
+ webhook_delivery:
198
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery::OrHash
177
199
  ).returns(T.attached_class)
178
200
  end
179
201
  def self.new(
@@ -197,7 +219,11 @@ module ContextDev
197
219
  error: nil,
198
220
  # Why a skipped run never executed; null unless status is `skipped`.
199
221
  skip_reason: nil,
200
- started_at: nil
222
+ started_at: nil,
223
+ # The webhook delivery attempted for a change detected by this run. Omitted when
224
+ # no webhook was attempted, including historical runs created before delivery
225
+ # tracking was added.
226
+ webhook_delivery: nil
201
227
  )
202
228
  end
203
229
 
@@ -227,7 +253,9 @@ module ContextDev
227
253
  T.nilable(
228
254
  ContextDev::Models::MonitorListAccountRunsResponse::Data::SkipReason::TaggedSymbol
229
255
  ),
230
- started_at: T.nilable(Time)
256
+ started_at: T.nilable(Time),
257
+ webhook_delivery:
258
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery
231
259
  }
232
260
  )
233
261
  end
@@ -458,6 +486,179 @@ module ContextDev
458
486
  def self.values
459
487
  end
460
488
  end
489
+
490
+ class WebhookDelivery < ContextDev::Internal::Type::BaseModel
491
+ OrHash =
492
+ T.type_alias do
493
+ T.any(
494
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery,
495
+ ContextDev::Internal::AnyHash
496
+ )
497
+ end
498
+
499
+ sig { returns(Time) }
500
+ attr_accessor :attempted_at
501
+
502
+ sig do
503
+ returns(
504
+ T.nilable(
505
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery::Error
506
+ )
507
+ )
508
+ end
509
+ attr_reader :error
510
+
511
+ sig do
512
+ params(
513
+ error:
514
+ T.nilable(
515
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery::Error::OrHash
516
+ )
517
+ ).void
518
+ end
519
+ attr_writer :error
520
+
521
+ # Identifier sent in the X-Context-Id header.
522
+ sig { returns(String) }
523
+ attr_accessor :event_id
524
+
525
+ # The endpoint's final HTTP response status, or null when no response was
526
+ # received.
527
+ sig { returns(T.nilable(Integer)) }
528
+ attr_accessor :http_status
529
+
530
+ # Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
531
+ # response; failed means no HTTP response was received; skipped_unsafe_url means
532
+ # the URL failed the public-endpoint safety check.
533
+ sig do
534
+ returns(
535
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery::Status::TaggedSymbol
536
+ )
537
+ end
538
+ attr_accessor :status
539
+
540
+ # The webhook delivery attempted for a change detected by this run. Omitted when
541
+ # no webhook was attempted, including historical runs created before delivery
542
+ # tracking was added.
543
+ sig do
544
+ params(
545
+ attempted_at: Time,
546
+ error:
547
+ T.nilable(
548
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery::Error::OrHash
549
+ ),
550
+ event_id: String,
551
+ http_status: T.nilable(Integer),
552
+ status:
553
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery::Status::OrSymbol
554
+ ).returns(T.attached_class)
555
+ end
556
+ def self.new(
557
+ attempted_at:,
558
+ error:,
559
+ # Identifier sent in the X-Context-Id header.
560
+ event_id:,
561
+ # The endpoint's final HTTP response status, or null when no response was
562
+ # received.
563
+ http_status:,
564
+ # Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
565
+ # response; failed means no HTTP response was received; skipped_unsafe_url means
566
+ # the URL failed the public-endpoint safety check.
567
+ status:
568
+ )
569
+ end
570
+
571
+ sig do
572
+ override.returns(
573
+ {
574
+ attempted_at: Time,
575
+ error:
576
+ T.nilable(
577
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery::Error
578
+ ),
579
+ event_id: String,
580
+ http_status: T.nilable(Integer),
581
+ status:
582
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery::Status::TaggedSymbol
583
+ }
584
+ )
585
+ end
586
+ def to_hash
587
+ end
588
+
589
+ class Error < ContextDev::Internal::Type::BaseModel
590
+ OrHash =
591
+ T.type_alias do
592
+ T.any(
593
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery::Error,
594
+ ContextDev::Internal::AnyHash
595
+ )
596
+ end
597
+
598
+ sig { returns(String) }
599
+ attr_accessor :code
600
+
601
+ sig { returns(String) }
602
+ attr_accessor :message
603
+
604
+ sig do
605
+ params(code: String, message: String).returns(T.attached_class)
606
+ end
607
+ def self.new(code:, message:)
608
+ end
609
+
610
+ sig { override.returns({ code: String, message: String }) }
611
+ def to_hash
612
+ end
613
+ end
614
+
615
+ # Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
616
+ # response; failed means no HTTP response was received; skipped_unsafe_url means
617
+ # the URL failed the public-endpoint safety check.
618
+ module Status
619
+ extend ContextDev::Internal::Type::Enum
620
+
621
+ TaggedSymbol =
622
+ T.type_alias do
623
+ T.all(
624
+ Symbol,
625
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery::Status
626
+ )
627
+ end
628
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
629
+
630
+ DELIVERED =
631
+ T.let(
632
+ :delivered,
633
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery::Status::TaggedSymbol
634
+ )
635
+ REJECTED =
636
+ T.let(
637
+ :rejected,
638
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery::Status::TaggedSymbol
639
+ )
640
+ FAILED =
641
+ T.let(
642
+ :failed,
643
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery::Status::TaggedSymbol
644
+ )
645
+ SKIPPED_UNSAFE_URL =
646
+ T.let(
647
+ :skipped_unsafe_url,
648
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery::Status::TaggedSymbol
649
+ )
650
+
651
+ sig do
652
+ override.returns(
653
+ T::Array[
654
+ ContextDev::Models::MonitorListAccountRunsResponse::Data::WebhookDelivery::Status::TaggedSymbol
655
+ ]
656
+ )
657
+ end
658
+ def self.values
659
+ end
660
+ end
661
+ end
461
662
  end
462
663
  end
463
664
  end
@@ -355,9 +355,9 @@ module ContextDev
355
355
  sig { params(confidence_threshold: Float).void }
356
356
  attr_writer :confidence_threshold
357
357
 
358
- # Detect meaning-level changes to the extracted data, ignoring cosmetic or
359
- # paraphrase-only differences. What is watched is determined by the extract
360
- # target's `schema` and `instructions`.
358
+ # Detect meaning-level changes to tracked page content, ignoring cosmetic or
359
+ # paraphrase-only differences. Which changes are meaningful is judged against the
360
+ # extract target's `instructions` (and `schema`, when provided).
361
361
  sig do
362
362
  params(confidence_threshold: Float, type: Symbol).returns(
363
363
  T.attached_class
@@ -770,9 +770,14 @@ module ContextDev
770
770
  sig { params(max_pages: Integer).void }
771
771
  attr_writer :max_pages
772
772
 
773
- # JSON Schema describing the data you care about. It guides which pages are
774
- # selected for tracking and gives the change judge context on what matters. If
775
- # omitted, a default summary + key-points schema is used.
773
+ # JSON Schema describing the data you care about. It is used three ways: it guides
774
+ # which pages are selected for tracking, it gives the change judge extra context
775
+ # on which changes matter (alongside `instructions`), and it defines the shape of
776
+ # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
777
+ # about once a day). It is not a response format for changes: change events and
778
+ # webhook payloads always contain diffs, summaries, and evidence excerpts — never
779
+ # data in this schema's shape. If omitted, a default summary + key-points schema
780
+ # is used.
776
781
  sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
777
782
  attr_reader :schema
778
783
 
@@ -782,8 +787,8 @@ module ContextDev
782
787
  # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
783
788
  # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
784
789
  # track; each run re-checks exactly those pages, and confirmed content changes are
785
- # judged against the monitor's instructions. The tracked page set is refreshed by
786
- # a periodic re-discovery crawl.
790
+ # judged for relevance against the monitor's `instructions` (and `schema`, when
791
+ # provided). The tracked page set is refreshed by a periodic re-discovery crawl.
787
792
  sig do
788
793
  params(
789
794
  instructions: String,
@@ -806,9 +811,14 @@ module ContextDev
806
811
  max_depth: nil,
807
812
  # Maximum number of pages to track.
808
813
  max_pages: nil,
809
- # JSON Schema describing the data you care about. It guides which pages are
810
- # selected for tracking and gives the change judge context on what matters. If
811
- # omitted, a default summary + key-points schema is used.
814
+ # JSON Schema describing the data you care about. It is used three ways: it guides
815
+ # which pages are selected for tracking, it gives the change judge extra context
816
+ # on which changes matter (alongside `instructions`), and it defines the shape of
817
+ # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
818
+ # about once a day). It is not a response format for changes: change events and
819
+ # webhook payloads always contain diffs, summaries, and evidence excerpts — never
820
+ # data in this schema's shape. If omitted, a default summary + key-points schema
821
+ # is used.
812
822
  schema: nil,
813
823
  type: :extract
814
824
  )