context.dev 2.0.0 → 2.1.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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -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 +30 -27
  6. data/lib/context_dev/models/monitor_create_response.rb +152 -28
  7. data/lib/context_dev/models/monitor_list_params.rb +4 -4
  8. data/lib/context_dev/models/monitor_list_response.rb +152 -28
  9. data/lib/context_dev/models/monitor_retrieve_change_response.rb +1 -8
  10. data/lib/context_dev/models/monitor_retrieve_response.rb +152 -28
  11. data/lib/context_dev/models/monitor_update_params.rb +30 -27
  12. data/lib/context_dev/models/monitor_update_response.rb +152 -28
  13. data/lib/context_dev/resources/brand.rb +4 -2
  14. data/lib/context_dev/resources/monitors.rb +1 -1
  15. data/lib/context_dev/version.rb +1 -1
  16. data/rbi/context_dev/models/brand_retrieve_params.rbi +67 -0
  17. data/rbi/context_dev/models/monitor_create_params.rbi +32 -31
  18. data/rbi/context_dev/models/monitor_create_response.rbi +231 -31
  19. data/rbi/context_dev/models/monitor_list_params.rbi +9 -6
  20. data/rbi/context_dev/models/monitor_list_response.rbi +235 -31
  21. data/rbi/context_dev/models/monitor_retrieve_change_response.rbi +0 -9
  22. data/rbi/context_dev/models/monitor_retrieve_response.rbi +231 -31
  23. data/rbi/context_dev/models/monitor_update_params.rbi +32 -31
  24. data/rbi/context_dev/models/monitor_update_response.rbi +231 -31
  25. data/rbi/context_dev/resources/brand.rbi +4 -1
  26. data/rbi/context_dev/resources/monitors.rbi +2 -2
  27. data/sig/context_dev/models/brand_retrieve_params.rbs +26 -0
  28. data/sig/context_dev/models/monitor_create_params.rbs +7 -17
  29. data/sig/context_dev/models/monitor_create_response.rbs +81 -17
  30. data/sig/context_dev/models/monitor_list_params.rbs +2 -2
  31. data/sig/context_dev/models/monitor_list_response.rbs +81 -17
  32. data/sig/context_dev/models/monitor_retrieve_change_response.rbs +0 -7
  33. data/sig/context_dev/models/monitor_retrieve_response.rbs +81 -17
  34. data/sig/context_dev/models/monitor_update_params.rbs +7 -17
  35. data/sig/context_dev/models/monitor_update_response.rbs +81 -17
  36. metadata +2 -2
@@ -114,6 +114,19 @@ module ContextDev
114
114
  sig { returns(Time) }
115
115
  attr_accessor :updated_at
116
116
 
117
+ # Current baseline: the last observed value the monitor compares new snapshots
118
+ # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
119
+ # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
120
+ # after a target or change_detection update, which resets the baseline).
121
+ sig do
122
+ returns(
123
+ T.nilable(
124
+ ContextDev::Models::MonitorListResponse::Data::Baseline::Variants
125
+ )
126
+ )
127
+ end
128
+ attr_accessor :baseline
129
+
117
130
  sig { returns(T.nilable(Time)) }
118
131
  attr_accessor :last_change_at
119
132
 
@@ -190,6 +203,14 @@ module ContextDev
190
203
  ContextDev::Models::MonitorListResponse::Data::Target::Extract::OrHash
191
204
  ),
192
205
  updated_at: Time,
206
+ baseline:
207
+ T.nilable(
208
+ T.any(
209
+ ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsPageBaseline::OrHash,
210
+ ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsSitemapBaseline::OrHash,
211
+ ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline::OrHash
212
+ )
213
+ ),
193
214
  last_change_at: T.nilable(Time),
194
215
  last_error:
195
216
  T.nilable(
@@ -226,6 +247,11 @@ module ContextDev
226
247
  # Discriminated union describing what the monitor watches.
227
248
  target:,
228
249
  updated_at:,
250
+ # Current baseline: the last observed value the monitor compares new snapshots
251
+ # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
252
+ # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
253
+ # after a target or change_detection update, which resets the baseline).
254
+ baseline: nil,
229
255
  last_change_at: nil,
230
256
  # Error from the most recent failed run; null when the last run succeeded.
231
257
  last_error: nil,
@@ -254,6 +280,10 @@ module ContextDev
254
280
  target:
255
281
  ContextDev::Models::MonitorListResponse::Data::Target::Variants,
256
282
  updated_at: Time,
283
+ baseline:
284
+ T.nilable(
285
+ ContextDev::Models::MonitorListResponse::Data::Baseline::Variants
286
+ ),
257
287
  last_change_at: T.nilable(Time),
258
288
  last_error:
259
289
  T.nilable(
@@ -316,9 +346,6 @@ module ContextDev
316
346
  )
317
347
  end
318
348
 
319
- sig { returns(String) }
320
- attr_accessor :query
321
-
322
349
  sig { returns(Symbol) }
323
350
  attr_accessor :type
324
351
 
@@ -328,21 +355,19 @@ module ContextDev
328
355
  sig { params(confidence_threshold: Float).void }
329
356
  attr_writer :confidence_threshold
330
357
 
331
- # Detect meaning-level changes that match a natural language query.
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`.
332
361
  sig do
333
- params(
334
- query: String,
335
- confidence_threshold: Float,
336
- type: Symbol
337
- ).returns(T.attached_class)
362
+ params(confidence_threshold: Float, type: Symbol).returns(
363
+ T.attached_class
364
+ )
338
365
  end
339
- def self.new(query:, confidence_threshold: nil, type: :semantic)
366
+ def self.new(confidence_threshold: nil, type: :semantic)
340
367
  end
341
368
 
342
369
  sig do
343
- override.returns(
344
- { query: String, type: Symbol, confidence_threshold: Float }
345
- )
370
+ override.returns({ type: Symbol, confidence_threshold: Float })
346
371
  end
347
372
  def to_hash
348
373
  end
@@ -664,8 +689,9 @@ module ContextDev
664
689
 
665
690
  # Watch a sitemap for URL additions and removals. Crawled URLs are normalized
666
691
  # (lowercased host, no trailing slash/fragment) and scoped to the monitored site
667
- # and its subdomains before comparison. A new URL set must be observed on two
668
- # consecutive runs before a change is reported, suppressing one-run crawl flaps.
692
+ # and its subdomains before comparison. On a detected difference the sitemap is
693
+ # re-fetched within the same run and only URLs both observations agree on are
694
+ # reported, suppressing transient crawl flaps.
669
695
  sig do
670
696
  params(
671
697
  url: String,
@@ -712,6 +738,11 @@ module ContextDev
712
738
  )
713
739
  end
714
740
 
741
+ # Natural-language instructions guiding which pages and facts to track and which
742
+ # changes to report.
743
+ sig { returns(String) }
744
+ attr_accessor :instructions
745
+
715
746
  sig { returns(Symbol) }
716
747
  attr_accessor :type
717
748
 
@@ -725,13 +756,6 @@ module ContextDev
725
756
  sig { params(follow_subdomains: T::Boolean).void }
726
757
  attr_writer :follow_subdomains
727
758
 
728
- # Optional natural-language instructions guiding what to extract.
729
- sig { returns(T.nilable(String)) }
730
- attr_reader :instructions
731
-
732
- sig { params(instructions: String).void }
733
- attr_writer :instructions
734
-
735
759
  # Optional maximum link depth from the starting URL (0 = only the starting page).
736
760
  sig { returns(T.nilable(Integer)) }
737
761
  attr_reader :max_depth
@@ -739,14 +763,15 @@ module ContextDev
739
763
  sig { params(max_depth: Integer).void }
740
764
  attr_writer :max_depth
741
765
 
742
- # Maximum number of pages to analyze during extraction.
766
+ # Maximum number of pages to track.
743
767
  sig { returns(T.nilable(Integer)) }
744
768
  attr_reader :max_pages
745
769
 
746
770
  sig { params(max_pages: Integer).void }
747
771
  attr_writer :max_pages
748
772
 
749
- # JSON Schema describing the structured data to extract and watch for changes. If
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
750
775
  # omitted, a default summary + key-points schema is used.
751
776
  sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
752
777
  attr_reader :schema
@@ -754,12 +779,16 @@ module ContextDev
754
779
  sig { params(schema: T::Hash[Symbol, T.anything]).void }
755
780
  attr_writer :schema
756
781
 
757
- # Watch a site's extracted structured data.
782
+ # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
783
+ # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
784
+ # 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.
758
787
  sig do
759
788
  params(
789
+ instructions: String,
760
790
  url: String,
761
791
  follow_subdomains: T::Boolean,
762
- instructions: String,
763
792
  max_depth: Integer,
764
793
  max_pages: Integer,
765
794
  schema: T::Hash[Symbol, T.anything],
@@ -767,16 +796,18 @@ module ContextDev
767
796
  ).returns(T.attached_class)
768
797
  end
769
798
  def self.new(
799
+ # Natural-language instructions guiding which pages and facts to track and which
800
+ # changes to report.
801
+ instructions:,
770
802
  # Root URL to extract structured data from.
771
803
  url:,
772
804
  follow_subdomains: nil,
773
- # Optional natural-language instructions guiding what to extract.
774
- instructions: nil,
775
805
  # Optional maximum link depth from the starting URL (0 = only the starting page).
776
806
  max_depth: nil,
777
- # Maximum number of pages to analyze during extraction.
807
+ # Maximum number of pages to track.
778
808
  max_pages: nil,
779
- # JSON Schema describing the structured data to extract and watch for changes. If
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
780
811
  # omitted, a default summary + key-points schema is used.
781
812
  schema: nil,
782
813
  type: :extract
@@ -786,10 +817,10 @@ module ContextDev
786
817
  sig do
787
818
  override.returns(
788
819
  {
820
+ instructions: String,
789
821
  type: Symbol,
790
822
  url: String,
791
823
  follow_subdomains: T::Boolean,
792
- instructions: String,
793
824
  max_depth: Integer,
794
825
  max_pages: Integer,
795
826
  schema: T::Hash[Symbol, T.anything]
@@ -811,6 +842,179 @@ module ContextDev
811
842
  end
812
843
  end
813
844
 
845
+ # Current baseline: the last observed value the monitor compares new snapshots
846
+ # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
847
+ # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
848
+ # after a target or change_detection update, which resets the baseline).
849
+ module Baseline
850
+ extend ContextDev::Internal::Type::Union
851
+
852
+ Variants =
853
+ T.type_alias do
854
+ T.any(
855
+ ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsPageBaseline,
856
+ ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsSitemapBaseline,
857
+ ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline
858
+ )
859
+ end
860
+
861
+ class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel
862
+ OrHash =
863
+ T.type_alias do
864
+ T.any(
865
+ ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsPageBaseline,
866
+ ContextDev::Internal::AnyHash
867
+ )
868
+ end
869
+
870
+ # When this baseline was last captured or replaced.
871
+ sig { returns(Time) }
872
+ attr_accessor :captured_at
873
+
874
+ # The page's visible text as last observed.
875
+ sig { returns(String) }
876
+ attr_accessor :text
877
+
878
+ # Current baseline of a `page` monitor: the visible page text as last observed.
879
+ sig do
880
+ params(captured_at: Time, text: String).returns(T.attached_class)
881
+ end
882
+ def self.new(
883
+ # When this baseline was last captured or replaced.
884
+ captured_at:,
885
+ # The page's visible text as last observed.
886
+ text:
887
+ )
888
+ end
889
+
890
+ sig { override.returns({ captured_at: Time, text: String }) }
891
+ def to_hash
892
+ end
893
+ end
894
+
895
+ class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel
896
+ OrHash =
897
+ T.type_alias do
898
+ T.any(
899
+ ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsSitemapBaseline,
900
+ ContextDev::Internal::AnyHash
901
+ )
902
+ end
903
+
904
+ # When this baseline was last captured or replaced.
905
+ sig { returns(Time) }
906
+ attr_accessor :captured_at
907
+
908
+ # Number of URLs in the baseline.
909
+ sig { returns(Integer) }
910
+ attr_accessor :url_count
911
+
912
+ # The sitemap URLs as last observed (sorted, normalized).
913
+ sig { returns(T::Array[String]) }
914
+ attr_accessor :urls
915
+
916
+ # Current baseline of a `sitemap` monitor: the normalized URL set as last
917
+ # observed.
918
+ sig do
919
+ params(
920
+ captured_at: Time,
921
+ url_count: Integer,
922
+ urls: T::Array[String]
923
+ ).returns(T.attached_class)
924
+ end
925
+ def self.new(
926
+ # When this baseline was last captured or replaced.
927
+ captured_at:,
928
+ # Number of URLs in the baseline.
929
+ url_count:,
930
+ # The sitemap URLs as last observed (sorted, normalized).
931
+ urls:
932
+ )
933
+ end
934
+
935
+ sig do
936
+ override.returns(
937
+ {
938
+ captured_at: Time,
939
+ url_count: Integer,
940
+ urls: T::Array[String]
941
+ }
942
+ )
943
+ end
944
+ def to_hash
945
+ end
946
+ end
947
+
948
+ class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel
949
+ OrHash =
950
+ T.type_alias do
951
+ T.any(
952
+ ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline,
953
+ ContextDev::Internal::AnyHash
954
+ )
955
+ end
956
+
957
+ # When this baseline was last captured or replaced.
958
+ sig { returns(Time) }
959
+ attr_accessor :captured_at
960
+
961
+ # The extracted structured data, matching the monitor's extraction schema (same
962
+ # shape as the /web/extract endpoint's `data`). Refreshed when the monitor
963
+ # re-discovers its page set (at most about once a day); `null` when no extraction
964
+ # has been captured yet.
965
+ sig { returns(T.anything) }
966
+ attr_accessor :data
967
+
968
+ # The page URLs the monitor tracks and analyzes for changes.
969
+ sig { returns(T::Array[String]) }
970
+ attr_accessor :urls_analyzed
971
+
972
+ # Current baseline of an `extract` monitor: the pages it tracks and the structured
973
+ # data as last extracted.
974
+ sig do
975
+ params(
976
+ captured_at: Time,
977
+ data: T.anything,
978
+ urls_analyzed: T::Array[String]
979
+ ).returns(T.attached_class)
980
+ end
981
+ def self.new(
982
+ # When this baseline was last captured or replaced.
983
+ captured_at:,
984
+ # The extracted structured data, matching the monitor's extraction schema (same
985
+ # shape as the /web/extract endpoint's `data`). Refreshed when the monitor
986
+ # re-discovers its page set (at most about once a day); `null` when no extraction
987
+ # has been captured yet.
988
+ data:,
989
+ # The page URLs the monitor tracks and analyzes for changes.
990
+ urls_analyzed:
991
+ )
992
+ end
993
+
994
+ sig do
995
+ override.returns(
996
+ {
997
+ captured_at: Time,
998
+ data: T.anything,
999
+ urls_analyzed: T::Array[String]
1000
+ }
1001
+ )
1002
+ end
1003
+ def to_hash
1004
+ end
1005
+ end
1006
+
1007
+ sig do
1008
+ override.returns(
1009
+ T::Array[
1010
+ ContextDev::Models::MonitorListResponse::Data::Baseline::Variants
1011
+ ]
1012
+ )
1013
+ end
1014
+ def self.variants
1015
+ end
1016
+ end
1017
+
814
1018
  class LastError < ContextDev::Internal::Type::BaseModel
815
1019
  OrHash =
816
1020
  T.type_alias do
@@ -145,12 +145,6 @@ module ContextDev
145
145
  sig { params(matched_urls: T::Array[String]).void }
146
146
  attr_writer :matched_urls
147
147
 
148
- sig { returns(T.nilable(String)) }
149
- attr_reader :query
150
-
151
- sig { params(query: String).void }
152
- attr_writer :query
153
-
154
148
  sig { returns(T.nilable(Integer)) }
155
149
  attr_reader :removed_url_count
156
150
 
@@ -205,7 +199,6 @@ module ContextDev
205
199
  ContextDev::Models::MonitorRetrieveChangeResponse::Importance::OrSymbol,
206
200
  matched_url_count: Integer,
207
201
  matched_urls: T::Array[String],
208
- query: String,
209
202
  removed_url_count: Integer,
210
203
  removed_urls: T::Array[String],
211
204
  tags: T::Array[String]
@@ -238,7 +231,6 @@ module ContextDev
238
231
  matched_url_count: nil,
239
232
  # At most 500 URLs are included; the corresponding count field is always exact.
240
233
  matched_urls: nil,
241
- query: nil,
242
234
  removed_url_count: nil,
243
235
  # At most 500 URLs are included; the corresponding count field is always exact.
244
236
  removed_urls: nil,
@@ -277,7 +269,6 @@ module ContextDev
277
269
  ContextDev::Models::MonitorRetrieveChangeResponse::Importance::TaggedSymbol,
278
270
  matched_url_count: Integer,
279
271
  matched_urls: T::Array[String],
280
- query: String,
281
272
  removed_url_count: Integer,
282
273
  removed_urls: T::Array[String],
283
274
  tags: T::Array[String]