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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +1 -1
- data/lib/context_dev/models/brand_retrieve_params.rb +46 -3
- data/lib/context_dev/models/monitor_create_params.rb +36 -28
- data/lib/context_dev/models/monitor_create_response.rb +158 -29
- data/lib/context_dev/models/monitor_list_account_runs_response.rb +102 -1
- data/lib/context_dev/models/monitor_list_params.rb +4 -4
- data/lib/context_dev/models/monitor_list_response.rb +158 -29
- data/lib/context_dev/models/monitor_list_runs_response.rb +100 -1
- data/lib/context_dev/models/monitor_retrieve_change_response.rb +1 -8
- data/lib/context_dev/models/monitor_retrieve_response.rb +158 -29
- data/lib/context_dev/models/monitor_update_params.rb +36 -28
- data/lib/context_dev/models/monitor_update_response.rb +158 -29
- data/lib/context_dev/resources/brand.rb +4 -2
- data/lib/context_dev/resources/monitors.rb +1 -1
- data/lib/context_dev/version.rb +1 -1
- data/rbi/context_dev/models/brand_retrieve_params.rbi +67 -0
- data/rbi/context_dev/models/monitor_create_params.rbi +44 -33
- data/rbi/context_dev/models/monitor_create_response.rbi +243 -33
- data/rbi/context_dev/models/monitor_list_account_runs_response.rbi +204 -3
- data/rbi/context_dev/models/monitor_list_params.rbi +9 -6
- data/rbi/context_dev/models/monitor_list_response.rbi +247 -33
- data/rbi/context_dev/models/monitor_list_runs_response.rbi +204 -3
- data/rbi/context_dev/models/monitor_retrieve_change_response.rbi +0 -9
- data/rbi/context_dev/models/monitor_retrieve_response.rbi +243 -33
- data/rbi/context_dev/models/monitor_update_params.rbi +44 -33
- data/rbi/context_dev/models/monitor_update_response.rbi +243 -33
- data/rbi/context_dev/resources/brand.rbi +4 -1
- data/rbi/context_dev/resources/monitors.rbi +2 -2
- data/sig/context_dev/models/brand_retrieve_params.rbs +26 -0
- data/sig/context_dev/models/monitor_create_params.rbs +7 -17
- data/sig/context_dev/models/monitor_create_response.rbs +81 -17
- data/sig/context_dev/models/monitor_list_account_runs_response.rbs +74 -3
- data/sig/context_dev/models/monitor_list_params.rbs +2 -2
- data/sig/context_dev/models/monitor_list_response.rbs +81 -17
- data/sig/context_dev/models/monitor_list_runs_response.rbs +74 -3
- data/sig/context_dev/models/monitor_retrieve_change_response.rbs +0 -7
- data/sig/context_dev/models/monitor_retrieve_response.rbs +81 -17
- data/sig/context_dev/models/monitor_update_params.rbs +7 -17
- data/sig/context_dev/models/monitor_update_response.rbs +81 -17
- metadata +2 -2
|
@@ -70,6 +70,19 @@ module ContextDev
|
|
|
70
70
|
sig { returns(Time) }
|
|
71
71
|
attr_accessor :updated_at
|
|
72
72
|
|
|
73
|
+
# Current baseline: the last observed value the monitor compares new snapshots
|
|
74
|
+
# against. Its shape follows `target.type` (page/sitemap/extract). Only populated
|
|
75
|
+
# on GET /monitors/{monitor_id}; null until the first baseline run completes (and
|
|
76
|
+
# after a target or change_detection update, which resets the baseline).
|
|
77
|
+
sig do
|
|
78
|
+
returns(
|
|
79
|
+
T.nilable(
|
|
80
|
+
ContextDev::Models::MonitorRetrieveResponse::Baseline::Variants
|
|
81
|
+
)
|
|
82
|
+
)
|
|
83
|
+
end
|
|
84
|
+
attr_accessor :baseline
|
|
85
|
+
|
|
73
86
|
sig { returns(T.nilable(Time)) }
|
|
74
87
|
attr_accessor :last_change_at
|
|
75
88
|
|
|
@@ -143,6 +156,14 @@ module ContextDev
|
|
|
143
156
|
ContextDev::Models::MonitorRetrieveResponse::Target::Extract::OrHash
|
|
144
157
|
),
|
|
145
158
|
updated_at: Time,
|
|
159
|
+
baseline:
|
|
160
|
+
T.nilable(
|
|
161
|
+
T.any(
|
|
162
|
+
ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsPageBaseline::OrHash,
|
|
163
|
+
ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsSitemapBaseline::OrHash,
|
|
164
|
+
ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsExtractBaseline::OrHash
|
|
165
|
+
)
|
|
166
|
+
),
|
|
146
167
|
last_change_at: T.nilable(Time),
|
|
147
168
|
last_error:
|
|
148
169
|
T.nilable(
|
|
@@ -179,6 +200,11 @@ module ContextDev
|
|
|
179
200
|
# Discriminated union describing what the monitor watches.
|
|
180
201
|
target:,
|
|
181
202
|
updated_at:,
|
|
203
|
+
# Current baseline: the last observed value the monitor compares new snapshots
|
|
204
|
+
# against. Its shape follows `target.type` (page/sitemap/extract). Only populated
|
|
205
|
+
# on GET /monitors/{monitor_id}; null until the first baseline run completes (and
|
|
206
|
+
# after a target or change_detection update, which resets the baseline).
|
|
207
|
+
baseline: nil,
|
|
182
208
|
last_change_at: nil,
|
|
183
209
|
# Error from the most recent failed run; null when the last run succeeded.
|
|
184
210
|
last_error: nil,
|
|
@@ -207,6 +233,10 @@ module ContextDev
|
|
|
207
233
|
target:
|
|
208
234
|
ContextDev::Models::MonitorRetrieveResponse::Target::Variants,
|
|
209
235
|
updated_at: Time,
|
|
236
|
+
baseline:
|
|
237
|
+
T.nilable(
|
|
238
|
+
ContextDev::Models::MonitorRetrieveResponse::Baseline::Variants
|
|
239
|
+
),
|
|
210
240
|
last_change_at: T.nilable(Time),
|
|
211
241
|
last_error:
|
|
212
242
|
T.nilable(ContextDev::Models::MonitorRetrieveResponse::LastError),
|
|
@@ -265,9 +295,6 @@ module ContextDev
|
|
|
265
295
|
)
|
|
266
296
|
end
|
|
267
297
|
|
|
268
|
-
sig { returns(String) }
|
|
269
|
-
attr_accessor :query
|
|
270
|
-
|
|
271
298
|
sig { returns(Symbol) }
|
|
272
299
|
attr_accessor :type
|
|
273
300
|
|
|
@@ -277,21 +304,19 @@ module ContextDev
|
|
|
277
304
|
sig { params(confidence_threshold: Float).void }
|
|
278
305
|
attr_writer :confidence_threshold
|
|
279
306
|
|
|
280
|
-
# Detect meaning-level changes
|
|
307
|
+
# Detect meaning-level changes to tracked page content, ignoring cosmetic or
|
|
308
|
+
# paraphrase-only differences. Which changes are meaningful is judged against the
|
|
309
|
+
# extract target's `instructions` (and `schema`, when provided).
|
|
281
310
|
sig do
|
|
282
|
-
params(
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
type: Symbol
|
|
286
|
-
).returns(T.attached_class)
|
|
311
|
+
params(confidence_threshold: Float, type: Symbol).returns(
|
|
312
|
+
T.attached_class
|
|
313
|
+
)
|
|
287
314
|
end
|
|
288
|
-
def self.new(
|
|
315
|
+
def self.new(confidence_threshold: nil, type: :semantic)
|
|
289
316
|
end
|
|
290
317
|
|
|
291
318
|
sig do
|
|
292
|
-
override.returns(
|
|
293
|
-
{ query: String, type: Symbol, confidence_threshold: Float }
|
|
294
|
-
)
|
|
319
|
+
override.returns({ type: Symbol, confidence_threshold: Float })
|
|
295
320
|
end
|
|
296
321
|
def to_hash
|
|
297
322
|
end
|
|
@@ -610,8 +635,9 @@ module ContextDev
|
|
|
610
635
|
|
|
611
636
|
# Watch a sitemap for URL additions and removals. Crawled URLs are normalized
|
|
612
637
|
# (lowercased host, no trailing slash/fragment) and scoped to the monitored site
|
|
613
|
-
# and its subdomains before comparison.
|
|
614
|
-
#
|
|
638
|
+
# and its subdomains before comparison. On a detected difference the sitemap is
|
|
639
|
+
# re-fetched within the same run and only URLs both observations agree on are
|
|
640
|
+
# reported, suppressing transient crawl flaps.
|
|
615
641
|
sig do
|
|
616
642
|
params(
|
|
617
643
|
url: String,
|
|
@@ -658,6 +684,11 @@ module ContextDev
|
|
|
658
684
|
)
|
|
659
685
|
end
|
|
660
686
|
|
|
687
|
+
# Natural-language instructions guiding which pages and facts to track and which
|
|
688
|
+
# changes to report.
|
|
689
|
+
sig { returns(String) }
|
|
690
|
+
attr_accessor :instructions
|
|
691
|
+
|
|
661
692
|
sig { returns(Symbol) }
|
|
662
693
|
attr_accessor :type
|
|
663
694
|
|
|
@@ -671,13 +702,6 @@ module ContextDev
|
|
|
671
702
|
sig { params(follow_subdomains: T::Boolean).void }
|
|
672
703
|
attr_writer :follow_subdomains
|
|
673
704
|
|
|
674
|
-
# Optional natural-language instructions guiding what to extract.
|
|
675
|
-
sig { returns(T.nilable(String)) }
|
|
676
|
-
attr_reader :instructions
|
|
677
|
-
|
|
678
|
-
sig { params(instructions: String).void }
|
|
679
|
-
attr_writer :instructions
|
|
680
|
-
|
|
681
705
|
# Optional maximum link depth from the starting URL (0 = only the starting page).
|
|
682
706
|
sig { returns(T.nilable(Integer)) }
|
|
683
707
|
attr_reader :max_depth
|
|
@@ -685,27 +709,37 @@ module ContextDev
|
|
|
685
709
|
sig { params(max_depth: Integer).void }
|
|
686
710
|
attr_writer :max_depth
|
|
687
711
|
|
|
688
|
-
# Maximum number of pages to
|
|
712
|
+
# Maximum number of pages to track.
|
|
689
713
|
sig { returns(T.nilable(Integer)) }
|
|
690
714
|
attr_reader :max_pages
|
|
691
715
|
|
|
692
716
|
sig { params(max_pages: Integer).void }
|
|
693
717
|
attr_writer :max_pages
|
|
694
718
|
|
|
695
|
-
# JSON Schema describing the
|
|
696
|
-
#
|
|
719
|
+
# JSON Schema describing the data you care about. It is used three ways: it guides
|
|
720
|
+
# which pages are selected for tracking, it gives the change judge extra context
|
|
721
|
+
# on which changes matter (alongside `instructions`), and it defines the shape of
|
|
722
|
+
# the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
|
|
723
|
+
# about once a day). It is not a response format for changes: change events and
|
|
724
|
+
# webhook payloads always contain diffs, summaries, and evidence excerpts — never
|
|
725
|
+
# data in this schema's shape. If omitted, a default summary + key-points schema
|
|
726
|
+
# is used.
|
|
697
727
|
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
698
728
|
attr_reader :schema
|
|
699
729
|
|
|
700
730
|
sig { params(schema: T::Hash[Symbol, T.anything]).void }
|
|
701
731
|
attr_writer :schema
|
|
702
732
|
|
|
703
|
-
# Watch a site
|
|
733
|
+
# Watch the monitor-relevant pages of a site for meaningful changes. A crawl
|
|
734
|
+
# guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
|
|
735
|
+
# track; each run re-checks exactly those pages, and confirmed content changes are
|
|
736
|
+
# judged for relevance against the monitor's `instructions` (and `schema`, when
|
|
737
|
+
# provided). The tracked page set is refreshed by a periodic re-discovery crawl.
|
|
704
738
|
sig do
|
|
705
739
|
params(
|
|
740
|
+
instructions: String,
|
|
706
741
|
url: String,
|
|
707
742
|
follow_subdomains: T::Boolean,
|
|
708
|
-
instructions: String,
|
|
709
743
|
max_depth: Integer,
|
|
710
744
|
max_pages: Integer,
|
|
711
745
|
schema: T::Hash[Symbol, T.anything],
|
|
@@ -713,17 +747,24 @@ module ContextDev
|
|
|
713
747
|
).returns(T.attached_class)
|
|
714
748
|
end
|
|
715
749
|
def self.new(
|
|
750
|
+
# Natural-language instructions guiding which pages and facts to track and which
|
|
751
|
+
# changes to report.
|
|
752
|
+
instructions:,
|
|
716
753
|
# Root URL to extract structured data from.
|
|
717
754
|
url:,
|
|
718
755
|
follow_subdomains: nil,
|
|
719
|
-
# Optional natural-language instructions guiding what to extract.
|
|
720
|
-
instructions: nil,
|
|
721
756
|
# Optional maximum link depth from the starting URL (0 = only the starting page).
|
|
722
757
|
max_depth: nil,
|
|
723
|
-
# Maximum number of pages to
|
|
758
|
+
# Maximum number of pages to track.
|
|
724
759
|
max_pages: nil,
|
|
725
|
-
# JSON Schema describing the
|
|
726
|
-
#
|
|
760
|
+
# JSON Schema describing the data you care about. It is used three ways: it guides
|
|
761
|
+
# which pages are selected for tracking, it gives the change judge extra context
|
|
762
|
+
# on which changes matter (alongside `instructions`), and it defines the shape of
|
|
763
|
+
# the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
|
|
764
|
+
# about once a day). It is not a response format for changes: change events and
|
|
765
|
+
# webhook payloads always contain diffs, summaries, and evidence excerpts — never
|
|
766
|
+
# data in this schema's shape. If omitted, a default summary + key-points schema
|
|
767
|
+
# is used.
|
|
727
768
|
schema: nil,
|
|
728
769
|
type: :extract
|
|
729
770
|
)
|
|
@@ -732,10 +773,10 @@ module ContextDev
|
|
|
732
773
|
sig do
|
|
733
774
|
override.returns(
|
|
734
775
|
{
|
|
776
|
+
instructions: String,
|
|
735
777
|
type: Symbol,
|
|
736
778
|
url: String,
|
|
737
779
|
follow_subdomains: T::Boolean,
|
|
738
|
-
instructions: String,
|
|
739
780
|
max_depth: Integer,
|
|
740
781
|
max_pages: Integer,
|
|
741
782
|
schema: T::Hash[Symbol, T.anything]
|
|
@@ -757,6 +798,175 @@ module ContextDev
|
|
|
757
798
|
end
|
|
758
799
|
end
|
|
759
800
|
|
|
801
|
+
# Current baseline: the last observed value the monitor compares new snapshots
|
|
802
|
+
# against. Its shape follows `target.type` (page/sitemap/extract). Only populated
|
|
803
|
+
# on GET /monitors/{monitor_id}; null until the first baseline run completes (and
|
|
804
|
+
# after a target or change_detection update, which resets the baseline).
|
|
805
|
+
module Baseline
|
|
806
|
+
extend ContextDev::Internal::Type::Union
|
|
807
|
+
|
|
808
|
+
Variants =
|
|
809
|
+
T.type_alias do
|
|
810
|
+
T.any(
|
|
811
|
+
ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsPageBaseline,
|
|
812
|
+
ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsSitemapBaseline,
|
|
813
|
+
ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsExtractBaseline
|
|
814
|
+
)
|
|
815
|
+
end
|
|
816
|
+
|
|
817
|
+
class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel
|
|
818
|
+
OrHash =
|
|
819
|
+
T.type_alias do
|
|
820
|
+
T.any(
|
|
821
|
+
ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsPageBaseline,
|
|
822
|
+
ContextDev::Internal::AnyHash
|
|
823
|
+
)
|
|
824
|
+
end
|
|
825
|
+
|
|
826
|
+
# When this baseline was last captured or replaced.
|
|
827
|
+
sig { returns(Time) }
|
|
828
|
+
attr_accessor :captured_at
|
|
829
|
+
|
|
830
|
+
# The page's visible text as last observed.
|
|
831
|
+
sig { returns(String) }
|
|
832
|
+
attr_accessor :text
|
|
833
|
+
|
|
834
|
+
# Current baseline of a `page` monitor: the visible page text as last observed.
|
|
835
|
+
sig do
|
|
836
|
+
params(captured_at: Time, text: String).returns(T.attached_class)
|
|
837
|
+
end
|
|
838
|
+
def self.new(
|
|
839
|
+
# When this baseline was last captured or replaced.
|
|
840
|
+
captured_at:,
|
|
841
|
+
# The page's visible text as last observed.
|
|
842
|
+
text:
|
|
843
|
+
)
|
|
844
|
+
end
|
|
845
|
+
|
|
846
|
+
sig { override.returns({ captured_at: Time, text: String }) }
|
|
847
|
+
def to_hash
|
|
848
|
+
end
|
|
849
|
+
end
|
|
850
|
+
|
|
851
|
+
class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel
|
|
852
|
+
OrHash =
|
|
853
|
+
T.type_alias do
|
|
854
|
+
T.any(
|
|
855
|
+
ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsSitemapBaseline,
|
|
856
|
+
ContextDev::Internal::AnyHash
|
|
857
|
+
)
|
|
858
|
+
end
|
|
859
|
+
|
|
860
|
+
# When this baseline was last captured or replaced.
|
|
861
|
+
sig { returns(Time) }
|
|
862
|
+
attr_accessor :captured_at
|
|
863
|
+
|
|
864
|
+
# Number of URLs in the baseline.
|
|
865
|
+
sig { returns(Integer) }
|
|
866
|
+
attr_accessor :url_count
|
|
867
|
+
|
|
868
|
+
# The sitemap URLs as last observed (sorted, normalized).
|
|
869
|
+
sig { returns(T::Array[String]) }
|
|
870
|
+
attr_accessor :urls
|
|
871
|
+
|
|
872
|
+
# Current baseline of a `sitemap` monitor: the normalized URL set as last
|
|
873
|
+
# observed.
|
|
874
|
+
sig do
|
|
875
|
+
params(
|
|
876
|
+
captured_at: Time,
|
|
877
|
+
url_count: Integer,
|
|
878
|
+
urls: T::Array[String]
|
|
879
|
+
).returns(T.attached_class)
|
|
880
|
+
end
|
|
881
|
+
def self.new(
|
|
882
|
+
# When this baseline was last captured or replaced.
|
|
883
|
+
captured_at:,
|
|
884
|
+
# Number of URLs in the baseline.
|
|
885
|
+
url_count:,
|
|
886
|
+
# The sitemap URLs as last observed (sorted, normalized).
|
|
887
|
+
urls:
|
|
888
|
+
)
|
|
889
|
+
end
|
|
890
|
+
|
|
891
|
+
sig do
|
|
892
|
+
override.returns(
|
|
893
|
+
{ captured_at: Time, url_count: Integer, urls: T::Array[String] }
|
|
894
|
+
)
|
|
895
|
+
end
|
|
896
|
+
def to_hash
|
|
897
|
+
end
|
|
898
|
+
end
|
|
899
|
+
|
|
900
|
+
class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel
|
|
901
|
+
OrHash =
|
|
902
|
+
T.type_alias do
|
|
903
|
+
T.any(
|
|
904
|
+
ContextDev::Models::MonitorRetrieveResponse::Baseline::MonitorsExtractBaseline,
|
|
905
|
+
ContextDev::Internal::AnyHash
|
|
906
|
+
)
|
|
907
|
+
end
|
|
908
|
+
|
|
909
|
+
# When this baseline was last captured or replaced.
|
|
910
|
+
sig { returns(Time) }
|
|
911
|
+
attr_accessor :captured_at
|
|
912
|
+
|
|
913
|
+
# The extracted structured data, matching the monitor's extraction schema (same
|
|
914
|
+
# shape as the /web/extract endpoint's `data`). Refreshed when the monitor
|
|
915
|
+
# re-discovers its page set (at most about once a day); `null` when no extraction
|
|
916
|
+
# has been captured yet.
|
|
917
|
+
sig { returns(T.anything) }
|
|
918
|
+
attr_accessor :data
|
|
919
|
+
|
|
920
|
+
# The page URLs the monitor tracks and analyzes for changes.
|
|
921
|
+
sig { returns(T::Array[String]) }
|
|
922
|
+
attr_accessor :urls_analyzed
|
|
923
|
+
|
|
924
|
+
# Current baseline of an `extract` monitor: the pages it tracks and the structured
|
|
925
|
+
# data as last extracted.
|
|
926
|
+
sig do
|
|
927
|
+
params(
|
|
928
|
+
captured_at: Time,
|
|
929
|
+
data: T.anything,
|
|
930
|
+
urls_analyzed: T::Array[String]
|
|
931
|
+
).returns(T.attached_class)
|
|
932
|
+
end
|
|
933
|
+
def self.new(
|
|
934
|
+
# When this baseline was last captured or replaced.
|
|
935
|
+
captured_at:,
|
|
936
|
+
# The extracted structured data, matching the monitor's extraction schema (same
|
|
937
|
+
# shape as the /web/extract endpoint's `data`). Refreshed when the monitor
|
|
938
|
+
# re-discovers its page set (at most about once a day); `null` when no extraction
|
|
939
|
+
# has been captured yet.
|
|
940
|
+
data:,
|
|
941
|
+
# The page URLs the monitor tracks and analyzes for changes.
|
|
942
|
+
urls_analyzed:
|
|
943
|
+
)
|
|
944
|
+
end
|
|
945
|
+
|
|
946
|
+
sig do
|
|
947
|
+
override.returns(
|
|
948
|
+
{
|
|
949
|
+
captured_at: Time,
|
|
950
|
+
data: T.anything,
|
|
951
|
+
urls_analyzed: T::Array[String]
|
|
952
|
+
}
|
|
953
|
+
)
|
|
954
|
+
end
|
|
955
|
+
def to_hash
|
|
956
|
+
end
|
|
957
|
+
end
|
|
958
|
+
|
|
959
|
+
sig do
|
|
960
|
+
override.returns(
|
|
961
|
+
T::Array[
|
|
962
|
+
ContextDev::Models::MonitorRetrieveResponse::Baseline::Variants
|
|
963
|
+
]
|
|
964
|
+
)
|
|
965
|
+
end
|
|
966
|
+
def self.variants
|
|
967
|
+
end
|
|
968
|
+
end
|
|
969
|
+
|
|
760
970
|
class LastError < ContextDev::Internal::Type::BaseModel
|
|
761
971
|
OrHash =
|
|
762
972
|
T.type_alias do
|
|
@@ -222,9 +222,6 @@ module ContextDev
|
|
|
222
222
|
)
|
|
223
223
|
end
|
|
224
224
|
|
|
225
|
-
sig { returns(String) }
|
|
226
|
-
attr_accessor :query
|
|
227
|
-
|
|
228
225
|
sig { returns(Symbol) }
|
|
229
226
|
attr_accessor :type
|
|
230
227
|
|
|
@@ -234,21 +231,19 @@ module ContextDev
|
|
|
234
231
|
sig { params(confidence_threshold: Float).void }
|
|
235
232
|
attr_writer :confidence_threshold
|
|
236
233
|
|
|
237
|
-
# Detect meaning-level changes
|
|
234
|
+
# Detect meaning-level changes to tracked page content, ignoring cosmetic or
|
|
235
|
+
# paraphrase-only differences. Which changes are meaningful is judged against the
|
|
236
|
+
# extract target's `instructions` (and `schema`, when provided).
|
|
238
237
|
sig do
|
|
239
|
-
params(
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
type: Symbol
|
|
243
|
-
).returns(T.attached_class)
|
|
238
|
+
params(confidence_threshold: Float, type: Symbol).returns(
|
|
239
|
+
T.attached_class
|
|
240
|
+
)
|
|
244
241
|
end
|
|
245
|
-
def self.new(
|
|
242
|
+
def self.new(confidence_threshold: nil, type: :semantic)
|
|
246
243
|
end
|
|
247
244
|
|
|
248
245
|
sig do
|
|
249
|
-
override.returns(
|
|
250
|
-
{ query: String, type: Symbol, confidence_threshold: Float }
|
|
251
|
-
)
|
|
246
|
+
override.returns({ type: Symbol, confidence_threshold: Float })
|
|
252
247
|
end
|
|
253
248
|
def to_hash
|
|
254
249
|
end
|
|
@@ -505,8 +500,9 @@ module ContextDev
|
|
|
505
500
|
|
|
506
501
|
# Watch a sitemap for URL additions and removals. Crawled URLs are normalized
|
|
507
502
|
# (lowercased host, no trailing slash/fragment) and scoped to the monitored site
|
|
508
|
-
# and its subdomains before comparison.
|
|
509
|
-
#
|
|
503
|
+
# and its subdomains before comparison. On a detected difference the sitemap is
|
|
504
|
+
# re-fetched within the same run and only URLs both observations agree on are
|
|
505
|
+
# reported, suppressing transient crawl flaps.
|
|
510
506
|
sig do
|
|
511
507
|
params(
|
|
512
508
|
url: String,
|
|
@@ -553,6 +549,11 @@ module ContextDev
|
|
|
553
549
|
)
|
|
554
550
|
end
|
|
555
551
|
|
|
552
|
+
# Natural-language instructions guiding which pages and facts to track and which
|
|
553
|
+
# changes to report.
|
|
554
|
+
sig { returns(String) }
|
|
555
|
+
attr_accessor :instructions
|
|
556
|
+
|
|
556
557
|
sig { returns(Symbol) }
|
|
557
558
|
attr_accessor :type
|
|
558
559
|
|
|
@@ -566,13 +567,6 @@ module ContextDev
|
|
|
566
567
|
sig { params(follow_subdomains: T::Boolean).void }
|
|
567
568
|
attr_writer :follow_subdomains
|
|
568
569
|
|
|
569
|
-
# Optional natural-language instructions guiding what to extract.
|
|
570
|
-
sig { returns(T.nilable(String)) }
|
|
571
|
-
attr_reader :instructions
|
|
572
|
-
|
|
573
|
-
sig { params(instructions: String).void }
|
|
574
|
-
attr_writer :instructions
|
|
575
|
-
|
|
576
570
|
# Optional maximum link depth from the starting URL (0 = only the starting page).
|
|
577
571
|
sig { returns(T.nilable(Integer)) }
|
|
578
572
|
attr_reader :max_depth
|
|
@@ -580,27 +574,37 @@ module ContextDev
|
|
|
580
574
|
sig { params(max_depth: Integer).void }
|
|
581
575
|
attr_writer :max_depth
|
|
582
576
|
|
|
583
|
-
# Maximum number of pages to
|
|
577
|
+
# Maximum number of pages to track.
|
|
584
578
|
sig { returns(T.nilable(Integer)) }
|
|
585
579
|
attr_reader :max_pages
|
|
586
580
|
|
|
587
581
|
sig { params(max_pages: Integer).void }
|
|
588
582
|
attr_writer :max_pages
|
|
589
583
|
|
|
590
|
-
# JSON Schema describing the
|
|
591
|
-
#
|
|
584
|
+
# JSON Schema describing the data you care about. It is used three ways: it guides
|
|
585
|
+
# which pages are selected for tracking, it gives the change judge extra context
|
|
586
|
+
# on which changes matter (alongside `instructions`), and it defines the shape of
|
|
587
|
+
# the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
|
|
588
|
+
# about once a day). It is not a response format for changes: change events and
|
|
589
|
+
# webhook payloads always contain diffs, summaries, and evidence excerpts — never
|
|
590
|
+
# data in this schema's shape. If omitted, a default summary + key-points schema
|
|
591
|
+
# is used.
|
|
592
592
|
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
593
593
|
attr_reader :schema
|
|
594
594
|
|
|
595
595
|
sig { params(schema: T::Hash[Symbol, T.anything]).void }
|
|
596
596
|
attr_writer :schema
|
|
597
597
|
|
|
598
|
-
# Watch a site
|
|
598
|
+
# Watch the monitor-relevant pages of a site for meaningful changes. A crawl
|
|
599
|
+
# guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
|
|
600
|
+
# track; each run re-checks exactly those pages, and confirmed content changes are
|
|
601
|
+
# judged for relevance against the monitor's `instructions` (and `schema`, when
|
|
602
|
+
# provided). The tracked page set is refreshed by a periodic re-discovery crawl.
|
|
599
603
|
sig do
|
|
600
604
|
params(
|
|
605
|
+
instructions: String,
|
|
601
606
|
url: String,
|
|
602
607
|
follow_subdomains: T::Boolean,
|
|
603
|
-
instructions: String,
|
|
604
608
|
max_depth: Integer,
|
|
605
609
|
max_pages: Integer,
|
|
606
610
|
schema: T::Hash[Symbol, T.anything],
|
|
@@ -608,17 +612,24 @@ module ContextDev
|
|
|
608
612
|
).returns(T.attached_class)
|
|
609
613
|
end
|
|
610
614
|
def self.new(
|
|
615
|
+
# Natural-language instructions guiding which pages and facts to track and which
|
|
616
|
+
# changes to report.
|
|
617
|
+
instructions:,
|
|
611
618
|
# Root URL to extract structured data from.
|
|
612
619
|
url:,
|
|
613
620
|
follow_subdomains: nil,
|
|
614
|
-
# Optional natural-language instructions guiding what to extract.
|
|
615
|
-
instructions: nil,
|
|
616
621
|
# Optional maximum link depth from the starting URL (0 = only the starting page).
|
|
617
622
|
max_depth: nil,
|
|
618
|
-
# Maximum number of pages to
|
|
623
|
+
# Maximum number of pages to track.
|
|
619
624
|
max_pages: nil,
|
|
620
|
-
# JSON Schema describing the
|
|
621
|
-
#
|
|
625
|
+
# JSON Schema describing the data you care about. It is used three ways: it guides
|
|
626
|
+
# which pages are selected for tracking, it gives the change judge extra context
|
|
627
|
+
# on which changes matter (alongside `instructions`), and it defines the shape of
|
|
628
|
+
# the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
|
|
629
|
+
# about once a day). It is not a response format for changes: change events and
|
|
630
|
+
# webhook payloads always contain diffs, summaries, and evidence excerpts — never
|
|
631
|
+
# data in this schema's shape. If omitted, a default summary + key-points schema
|
|
632
|
+
# is used.
|
|
622
633
|
schema: nil,
|
|
623
634
|
type: :extract
|
|
624
635
|
)
|
|
@@ -627,10 +638,10 @@ module ContextDev
|
|
|
627
638
|
sig do
|
|
628
639
|
override.returns(
|
|
629
640
|
{
|
|
641
|
+
instructions: String,
|
|
630
642
|
type: Symbol,
|
|
631
643
|
url: String,
|
|
632
644
|
follow_subdomains: T::Boolean,
|
|
633
|
-
instructions: String,
|
|
634
645
|
max_depth: Integer,
|
|
635
646
|
max_pages: Integer,
|
|
636
647
|
schema: T::Hash[Symbol, T.anything]
|