context.dev 2.1.0 → 2.3.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 +23 -0
- data/README.md +1 -1
- data/lib/context_dev/client.rb +7 -2
- data/lib/context_dev/internal/type/base_model.rb +5 -5
- data/lib/context_dev/models/monitor_create_params.rb +44 -14
- data/lib/context_dev/models/monitor_create_response.rb +112 -15
- data/lib/context_dev/models/monitor_list_account_runs_response.rb +23 -1
- data/lib/context_dev/models/monitor_list_response.rb +116 -15
- data/lib/context_dev/models/monitor_list_runs_response.rb +23 -1
- data/lib/context_dev/models/monitor_retrieve_change_response.rb +10 -10
- data/lib/context_dev/models/monitor_retrieve_response.rb +113 -15
- data/lib/context_dev/models/monitor_update_params.rb +44 -14
- data/lib/context_dev/models/monitor_update_response.rb +112 -15
- data/lib/context_dev/models/parse_handle_params.rb +110 -0
- data/lib/context_dev/models/parse_handle_response.rb +132 -0
- data/lib/context_dev/models/web_web_crawl_md_params.rb +16 -6
- data/lib/context_dev/models/web_web_scrape_html_params.rb +16 -6
- data/lib/context_dev/models/web_web_scrape_md_params.rb +16 -6
- data/lib/context_dev/models/web_web_scrape_md_response.rb +11 -1
- data/lib/context_dev/models/webhook_delivery.rb +109 -0
- data/lib/context_dev/models.rb +4 -0
- data/lib/context_dev/resources/monitors.rb +3 -2
- data/lib/context_dev/resources/parse.rb +63 -0
- data/lib/context_dev/resources/web.rb +19 -4
- data/lib/context_dev/version.rb +1 -1
- data/lib/context_dev.rb +4 -0
- data/rbi/context_dev/client.rbi +6 -2
- data/rbi/context_dev/models/monitor_create_params.rbi +106 -16
- data/rbi/context_dev/models/monitor_create_response.rbi +255 -17
- data/rbi/context_dev/models/monitor_list_account_runs_response.rbi +39 -3
- data/rbi/context_dev/models/monitor_list_response.rbi +256 -16
- data/rbi/context_dev/models/monitor_list_runs_response.rbi +39 -3
- data/rbi/context_dev/models/monitor_retrieve_change_response.rbi +12 -15
- data/rbi/context_dev/models/monitor_retrieve_response.rbi +255 -17
- data/rbi/context_dev/models/monitor_update_params.rbi +106 -16
- data/rbi/context_dev/models/monitor_update_response.rbi +255 -17
- data/rbi/context_dev/models/parse_handle_params.rbi +163 -0
- data/rbi/context_dev/models/parse_handle_response.rbi +377 -0
- data/rbi/context_dev/models/web_web_crawl_md_params.rbi +26 -7
- data/rbi/context_dev/models/web_web_scrape_html_params.rbi +26 -7
- data/rbi/context_dev/models/web_web_scrape_md_params.rbi +26 -7
- data/rbi/context_dev/models/web_web_scrape_md_response.rbi +12 -0
- data/rbi/context_dev/models/webhook_delivery.rbi +172 -0
- data/rbi/context_dev/models.rbi +4 -0
- data/rbi/context_dev/resources/monitors.rbi +3 -2
- data/rbi/context_dev/resources/parse.rbi +65 -0
- data/rbi/context_dev/resources/web.rbi +22 -7
- data/sig/context_dev/client.rbs +2 -0
- data/sig/context_dev/models/monitor_create_params.rbs +32 -3
- data/sig/context_dev/models/monitor_create_response.rbs +85 -6
- data/sig/context_dev/models/monitor_list_account_runs_response.rbs +21 -3
- data/sig/context_dev/models/monitor_list_response.rbs +85 -6
- data/sig/context_dev/models/monitor_list_runs_response.rbs +21 -3
- data/sig/context_dev/models/monitor_retrieve_change_response.rbs +8 -10
- data/sig/context_dev/models/monitor_retrieve_response.rbs +85 -6
- data/sig/context_dev/models/monitor_update_params.rbs +32 -3
- data/sig/context_dev/models/monitor_update_response.rbs +85 -6
- data/sig/context_dev/models/parse_handle_params.rbs +96 -0
- data/sig/context_dev/models/parse_handle_response.rbs +159 -0
- data/sig/context_dev/models/web_web_crawl_md_params.rbs +13 -2
- data/sig/context_dev/models/web_web_scrape_html_params.rbs +13 -2
- data/sig/context_dev/models/web_web_scrape_md_params.rbs +13 -2
- data/sig/context_dev/models/web_web_scrape_md_response.rbs +5 -0
- data/sig/context_dev/models/webhook_delivery.rbs +81 -0
- data/sig/context_dev/models.rbs +4 -0
- data/sig/context_dev/resources/parse.rbs +22 -0
- metadata +14 -2
|
@@ -133,6 +133,26 @@ module ContextDev
|
|
|
133
133
|
end
|
|
134
134
|
attr_writer :webhook
|
|
135
135
|
|
|
136
|
+
# Present while webhook deliveries are failing consecutively; null when deliveries
|
|
137
|
+
# are healthy or no webhook is configured. Cleared on the next successful delivery
|
|
138
|
+
# and when the webhook URL changes.
|
|
139
|
+
sig do
|
|
140
|
+
returns(
|
|
141
|
+
T.nilable(ContextDev::Models::MonitorRetrieveResponse::WebhookFailure)
|
|
142
|
+
)
|
|
143
|
+
end
|
|
144
|
+
attr_reader :webhook_failure
|
|
145
|
+
|
|
146
|
+
sig do
|
|
147
|
+
params(
|
|
148
|
+
webhook_failure:
|
|
149
|
+
T.nilable(
|
|
150
|
+
ContextDev::Models::MonitorRetrieveResponse::WebhookFailure::OrHash
|
|
151
|
+
)
|
|
152
|
+
).void
|
|
153
|
+
end
|
|
154
|
+
attr_writer :webhook_failure
|
|
155
|
+
|
|
136
156
|
# A web monitor. `mode` is the constant `web`; behavior is described by `target`
|
|
137
157
|
# (page/sitemap/extract) and `change_detection` (exact/semantic).
|
|
138
158
|
sig do
|
|
@@ -175,6 +195,10 @@ module ContextDev
|
|
|
175
195
|
webhook:
|
|
176
196
|
T.nilable(
|
|
177
197
|
ContextDev::Models::MonitorRetrieveResponse::Webhook::OrHash
|
|
198
|
+
),
|
|
199
|
+
webhook_failure:
|
|
200
|
+
T.nilable(
|
|
201
|
+
ContextDev::Models::MonitorRetrieveResponse::WebhookFailure::OrHash
|
|
178
202
|
)
|
|
179
203
|
).returns(T.attached_class)
|
|
180
204
|
end
|
|
@@ -213,7 +237,11 @@ module ContextDev
|
|
|
213
237
|
next_run_at: nil,
|
|
214
238
|
# User-defined tags for grouping and filtering monitors and their changes.
|
|
215
239
|
tags: nil,
|
|
216
|
-
webhook: nil
|
|
240
|
+
webhook: nil,
|
|
241
|
+
# Present while webhook deliveries are failing consecutively; null when deliveries
|
|
242
|
+
# are healthy or no webhook is configured. Cleared on the next successful delivery
|
|
243
|
+
# and when the webhook URL changes.
|
|
244
|
+
webhook_failure: nil
|
|
217
245
|
)
|
|
218
246
|
end
|
|
219
247
|
|
|
@@ -244,7 +272,11 @@ module ContextDev
|
|
|
244
272
|
next_run_at: T.nilable(Time),
|
|
245
273
|
tags: T::Array[String],
|
|
246
274
|
webhook:
|
|
247
|
-
T.nilable(ContextDev::Models::MonitorRetrieveResponse::Webhook)
|
|
275
|
+
T.nilable(ContextDev::Models::MonitorRetrieveResponse::Webhook),
|
|
276
|
+
webhook_failure:
|
|
277
|
+
T.nilable(
|
|
278
|
+
ContextDev::Models::MonitorRetrieveResponse::WebhookFailure
|
|
279
|
+
)
|
|
248
280
|
}
|
|
249
281
|
)
|
|
250
282
|
end
|
|
@@ -304,9 +336,9 @@ module ContextDev
|
|
|
304
336
|
sig { params(confidence_threshold: Float).void }
|
|
305
337
|
attr_writer :confidence_threshold
|
|
306
338
|
|
|
307
|
-
# Detect meaning-level changes to
|
|
308
|
-
# paraphrase-only differences.
|
|
309
|
-
# target's `
|
|
339
|
+
# Detect meaning-level changes to tracked page content, ignoring cosmetic or
|
|
340
|
+
# paraphrase-only differences. Which changes are meaningful is judged against the
|
|
341
|
+
# extract target's `instructions` (and `schema`, when provided).
|
|
310
342
|
sig do
|
|
311
343
|
params(confidence_threshold: Float, type: Symbol).returns(
|
|
312
344
|
T.attached_class
|
|
@@ -716,9 +748,14 @@ module ContextDev
|
|
|
716
748
|
sig { params(max_pages: Integer).void }
|
|
717
749
|
attr_writer :max_pages
|
|
718
750
|
|
|
719
|
-
# JSON Schema describing the data you care about. It
|
|
720
|
-
# selected for tracking
|
|
721
|
-
#
|
|
751
|
+
# JSON Schema describing the data you care about. It is used three ways: it guides
|
|
752
|
+
# which pages are selected for tracking, it gives the change judge extra context
|
|
753
|
+
# on which changes matter (alongside `instructions`), and it defines the shape of
|
|
754
|
+
# the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
|
|
755
|
+
# about once a day). It is not a response format for changes: change events and
|
|
756
|
+
# webhook payloads always contain diffs, summaries, and evidence excerpts — never
|
|
757
|
+
# data in this schema's shape. If omitted, a default summary + key-points schema
|
|
758
|
+
# is used.
|
|
722
759
|
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
723
760
|
attr_reader :schema
|
|
724
761
|
|
|
@@ -728,8 +765,8 @@ module ContextDev
|
|
|
728
765
|
# Watch the monitor-relevant pages of a site for meaningful changes. A crawl
|
|
729
766
|
# guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
|
|
730
767
|
# track; each run re-checks exactly those pages, and confirmed content changes are
|
|
731
|
-
# judged against the monitor's instructions
|
|
732
|
-
# a periodic re-discovery crawl.
|
|
768
|
+
# judged for relevance against the monitor's `instructions` (and `schema`, when
|
|
769
|
+
# provided). The tracked page set is refreshed by a periodic re-discovery crawl.
|
|
733
770
|
sig do
|
|
734
771
|
params(
|
|
735
772
|
instructions: String,
|
|
@@ -752,9 +789,14 @@ module ContextDev
|
|
|
752
789
|
max_depth: nil,
|
|
753
790
|
# Maximum number of pages to track.
|
|
754
791
|
max_pages: nil,
|
|
755
|
-
# JSON Schema describing the data you care about. It
|
|
756
|
-
# selected for tracking
|
|
757
|
-
#
|
|
792
|
+
# JSON Schema describing the data you care about. It is used three ways: it guides
|
|
793
|
+
# which pages are selected for tracking, it gives the change judge extra context
|
|
794
|
+
# on which changes matter (alongside `instructions`), and it defines the shape of
|
|
795
|
+
# the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
|
|
796
|
+
# about once a day). It is not a response format for changes: change events and
|
|
797
|
+
# webhook payloads always contain diffs, summaries, and evidence excerpts — never
|
|
798
|
+
# data in this schema's shape. If omitted, a default summary + key-points schema
|
|
799
|
+
# is used.
|
|
758
800
|
schema: nil,
|
|
759
801
|
type: :extract
|
|
760
802
|
)
|
|
@@ -991,10 +1033,35 @@ module ContextDev
|
|
|
991
1033
|
)
|
|
992
1034
|
end
|
|
993
1035
|
|
|
994
|
-
# Webhook URL
|
|
1036
|
+
# Webhook URL events are delivered to.
|
|
995
1037
|
sig { returns(String) }
|
|
996
1038
|
attr_accessor :url
|
|
997
1039
|
|
|
1040
|
+
# Events delivered to this endpoint. `change.detected` fires only when a run
|
|
1041
|
+
# detects a change; `run.completed` fires on every completed run — including runs
|
|
1042
|
+
# that detected no change — and embeds the change when one was detected. Defaults
|
|
1043
|
+
# to `["change.detected"]` when omitted.
|
|
1044
|
+
sig do
|
|
1045
|
+
returns(
|
|
1046
|
+
T.nilable(
|
|
1047
|
+
T::Array[
|
|
1048
|
+
ContextDev::Models::MonitorRetrieveResponse::Webhook::Event::TaggedSymbol
|
|
1049
|
+
]
|
|
1050
|
+
)
|
|
1051
|
+
)
|
|
1052
|
+
end
|
|
1053
|
+
attr_reader :events
|
|
1054
|
+
|
|
1055
|
+
sig do
|
|
1056
|
+
params(
|
|
1057
|
+
events:
|
|
1058
|
+
T::Array[
|
|
1059
|
+
ContextDev::Models::MonitorRetrieveResponse::Webhook::Event::OrSymbol
|
|
1060
|
+
]
|
|
1061
|
+
).void
|
|
1062
|
+
end
|
|
1063
|
+
attr_writer :events
|
|
1064
|
+
|
|
998
1065
|
# Signing secret used to verify webhook authenticity. Each delivery includes an
|
|
999
1066
|
# `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
|
|
1000
1067
|
# `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
|
|
@@ -1006,10 +1073,24 @@ module ContextDev
|
|
|
1006
1073
|
sig { params(secret: String).void }
|
|
1007
1074
|
attr_writer :secret
|
|
1008
1075
|
|
|
1009
|
-
sig
|
|
1076
|
+
sig do
|
|
1077
|
+
params(
|
|
1078
|
+
url: String,
|
|
1079
|
+
events:
|
|
1080
|
+
T::Array[
|
|
1081
|
+
ContextDev::Models::MonitorRetrieveResponse::Webhook::Event::OrSymbol
|
|
1082
|
+
],
|
|
1083
|
+
secret: String
|
|
1084
|
+
).returns(T.attached_class)
|
|
1085
|
+
end
|
|
1010
1086
|
def self.new(
|
|
1011
|
-
# Webhook URL
|
|
1087
|
+
# Webhook URL events are delivered to.
|
|
1012
1088
|
url:,
|
|
1089
|
+
# Events delivered to this endpoint. `change.detected` fires only when a run
|
|
1090
|
+
# detects a change; `run.completed` fires on every completed run — including runs
|
|
1091
|
+
# that detected no change — and embeds the change when one was detected. Defaults
|
|
1092
|
+
# to `["change.detected"]` when omitted.
|
|
1093
|
+
events: nil,
|
|
1013
1094
|
# Signing secret used to verify webhook authenticity. Each delivery includes an
|
|
1014
1095
|
# `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
|
|
1015
1096
|
# `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
|
|
@@ -1019,9 +1100,166 @@ module ContextDev
|
|
|
1019
1100
|
)
|
|
1020
1101
|
end
|
|
1021
1102
|
|
|
1022
|
-
sig
|
|
1103
|
+
sig do
|
|
1104
|
+
override.returns(
|
|
1105
|
+
{
|
|
1106
|
+
url: String,
|
|
1107
|
+
events:
|
|
1108
|
+
T::Array[
|
|
1109
|
+
ContextDev::Models::MonitorRetrieveResponse::Webhook::Event::TaggedSymbol
|
|
1110
|
+
],
|
|
1111
|
+
secret: String
|
|
1112
|
+
}
|
|
1113
|
+
)
|
|
1114
|
+
end
|
|
1115
|
+
def to_hash
|
|
1116
|
+
end
|
|
1117
|
+
|
|
1118
|
+
module Event
|
|
1119
|
+
extend ContextDev::Internal::Type::Enum
|
|
1120
|
+
|
|
1121
|
+
TaggedSymbol =
|
|
1122
|
+
T.type_alias do
|
|
1123
|
+
T.all(
|
|
1124
|
+
Symbol,
|
|
1125
|
+
ContextDev::Models::MonitorRetrieveResponse::Webhook::Event
|
|
1126
|
+
)
|
|
1127
|
+
end
|
|
1128
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
1129
|
+
|
|
1130
|
+
CHANGE_DETECTED =
|
|
1131
|
+
T.let(
|
|
1132
|
+
:"change.detected",
|
|
1133
|
+
ContextDev::Models::MonitorRetrieveResponse::Webhook::Event::TaggedSymbol
|
|
1134
|
+
)
|
|
1135
|
+
RUN_COMPLETED =
|
|
1136
|
+
T.let(
|
|
1137
|
+
:"run.completed",
|
|
1138
|
+
ContextDev::Models::MonitorRetrieveResponse::Webhook::Event::TaggedSymbol
|
|
1139
|
+
)
|
|
1140
|
+
|
|
1141
|
+
sig do
|
|
1142
|
+
override.returns(
|
|
1143
|
+
T::Array[
|
|
1144
|
+
ContextDev::Models::MonitorRetrieveResponse::Webhook::Event::TaggedSymbol
|
|
1145
|
+
]
|
|
1146
|
+
)
|
|
1147
|
+
end
|
|
1148
|
+
def self.values
|
|
1149
|
+
end
|
|
1150
|
+
end
|
|
1151
|
+
end
|
|
1152
|
+
|
|
1153
|
+
class WebhookFailure < ContextDev::Internal::Type::BaseModel
|
|
1154
|
+
OrHash =
|
|
1155
|
+
T.type_alias do
|
|
1156
|
+
T.any(
|
|
1157
|
+
ContextDev::Models::MonitorRetrieveResponse::WebhookFailure,
|
|
1158
|
+
ContextDev::Internal::AnyHash
|
|
1159
|
+
)
|
|
1160
|
+
end
|
|
1161
|
+
|
|
1162
|
+
# Number of consecutive delivery attempts that did not succeed.
|
|
1163
|
+
sig { returns(Integer) }
|
|
1164
|
+
attr_accessor :consecutive_failures
|
|
1165
|
+
|
|
1166
|
+
sig { returns(Time) }
|
|
1167
|
+
attr_accessor :last_failed_at
|
|
1168
|
+
|
|
1169
|
+
# Human-readable description of the most recent failure.
|
|
1170
|
+
sig { returns(String) }
|
|
1171
|
+
attr_accessor :last_message
|
|
1172
|
+
|
|
1173
|
+
# Outcome of the most recent failed delivery. rejected means a non-2xx response;
|
|
1174
|
+
# failed means no HTTP response was received; skipped_unsafe_url means the URL
|
|
1175
|
+
# failed the public-endpoint safety check.
|
|
1176
|
+
sig do
|
|
1177
|
+
returns(
|
|
1178
|
+
ContextDev::Models::MonitorRetrieveResponse::WebhookFailure::LastStatus::TaggedSymbol
|
|
1179
|
+
)
|
|
1180
|
+
end
|
|
1181
|
+
attr_accessor :last_status
|
|
1182
|
+
|
|
1183
|
+
# Present while webhook deliveries are failing consecutively; null when deliveries
|
|
1184
|
+
# are healthy or no webhook is configured. Cleared on the next successful delivery
|
|
1185
|
+
# and when the webhook URL changes.
|
|
1186
|
+
sig do
|
|
1187
|
+
params(
|
|
1188
|
+
consecutive_failures: Integer,
|
|
1189
|
+
last_failed_at: Time,
|
|
1190
|
+
last_message: String,
|
|
1191
|
+
last_status:
|
|
1192
|
+
ContextDev::Models::MonitorRetrieveResponse::WebhookFailure::LastStatus::OrSymbol
|
|
1193
|
+
).returns(T.attached_class)
|
|
1194
|
+
end
|
|
1195
|
+
def self.new(
|
|
1196
|
+
# Number of consecutive delivery attempts that did not succeed.
|
|
1197
|
+
consecutive_failures:,
|
|
1198
|
+
last_failed_at:,
|
|
1199
|
+
# Human-readable description of the most recent failure.
|
|
1200
|
+
last_message:,
|
|
1201
|
+
# Outcome of the most recent failed delivery. rejected means a non-2xx response;
|
|
1202
|
+
# failed means no HTTP response was received; skipped_unsafe_url means the URL
|
|
1203
|
+
# failed the public-endpoint safety check.
|
|
1204
|
+
last_status:
|
|
1205
|
+
)
|
|
1206
|
+
end
|
|
1207
|
+
|
|
1208
|
+
sig do
|
|
1209
|
+
override.returns(
|
|
1210
|
+
{
|
|
1211
|
+
consecutive_failures: Integer,
|
|
1212
|
+
last_failed_at: Time,
|
|
1213
|
+
last_message: String,
|
|
1214
|
+
last_status:
|
|
1215
|
+
ContextDev::Models::MonitorRetrieveResponse::WebhookFailure::LastStatus::TaggedSymbol
|
|
1216
|
+
}
|
|
1217
|
+
)
|
|
1218
|
+
end
|
|
1023
1219
|
def to_hash
|
|
1024
1220
|
end
|
|
1221
|
+
|
|
1222
|
+
# Outcome of the most recent failed delivery. rejected means a non-2xx response;
|
|
1223
|
+
# failed means no HTTP response was received; skipped_unsafe_url means the URL
|
|
1224
|
+
# failed the public-endpoint safety check.
|
|
1225
|
+
module LastStatus
|
|
1226
|
+
extend ContextDev::Internal::Type::Enum
|
|
1227
|
+
|
|
1228
|
+
TaggedSymbol =
|
|
1229
|
+
T.type_alias do
|
|
1230
|
+
T.all(
|
|
1231
|
+
Symbol,
|
|
1232
|
+
ContextDev::Models::MonitorRetrieveResponse::WebhookFailure::LastStatus
|
|
1233
|
+
)
|
|
1234
|
+
end
|
|
1235
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
1236
|
+
|
|
1237
|
+
REJECTED =
|
|
1238
|
+
T.let(
|
|
1239
|
+
:rejected,
|
|
1240
|
+
ContextDev::Models::MonitorRetrieveResponse::WebhookFailure::LastStatus::TaggedSymbol
|
|
1241
|
+
)
|
|
1242
|
+
FAILED =
|
|
1243
|
+
T.let(
|
|
1244
|
+
:failed,
|
|
1245
|
+
ContextDev::Models::MonitorRetrieveResponse::WebhookFailure::LastStatus::TaggedSymbol
|
|
1246
|
+
)
|
|
1247
|
+
SKIPPED_UNSAFE_URL =
|
|
1248
|
+
T.let(
|
|
1249
|
+
:skipped_unsafe_url,
|
|
1250
|
+
ContextDev::Models::MonitorRetrieveResponse::WebhookFailure::LastStatus::TaggedSymbol
|
|
1251
|
+
)
|
|
1252
|
+
|
|
1253
|
+
sig do
|
|
1254
|
+
override.returns(
|
|
1255
|
+
T::Array[
|
|
1256
|
+
ContextDev::Models::MonitorRetrieveResponse::WebhookFailure::LastStatus::TaggedSymbol
|
|
1257
|
+
]
|
|
1258
|
+
)
|
|
1259
|
+
end
|
|
1260
|
+
def self.values
|
|
1261
|
+
end
|
|
1262
|
+
end
|
|
1025
1263
|
end
|
|
1026
1264
|
end
|
|
1027
1265
|
end
|
|
@@ -231,9 +231,9 @@ module ContextDev
|
|
|
231
231
|
sig { params(confidence_threshold: Float).void }
|
|
232
232
|
attr_writer :confidence_threshold
|
|
233
233
|
|
|
234
|
-
# Detect meaning-level changes to
|
|
235
|
-
# paraphrase-only differences.
|
|
236
|
-
# target's `
|
|
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).
|
|
237
237
|
sig do
|
|
238
238
|
params(confidence_threshold: Float, type: Symbol).returns(
|
|
239
239
|
T.attached_class
|
|
@@ -581,9 +581,14 @@ module ContextDev
|
|
|
581
581
|
sig { params(max_pages: Integer).void }
|
|
582
582
|
attr_writer :max_pages
|
|
583
583
|
|
|
584
|
-
# JSON Schema describing the data you care about. It
|
|
585
|
-
# selected for tracking
|
|
586
|
-
#
|
|
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.
|
|
587
592
|
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
588
593
|
attr_reader :schema
|
|
589
594
|
|
|
@@ -593,8 +598,8 @@ module ContextDev
|
|
|
593
598
|
# Watch the monitor-relevant pages of a site for meaningful changes. A crawl
|
|
594
599
|
# guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
|
|
595
600
|
# track; each run re-checks exactly those pages, and confirmed content changes are
|
|
596
|
-
# judged against the monitor's instructions
|
|
597
|
-
# a periodic re-discovery crawl.
|
|
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.
|
|
598
603
|
sig do
|
|
599
604
|
params(
|
|
600
605
|
instructions: String,
|
|
@@ -617,9 +622,14 @@ module ContextDev
|
|
|
617
622
|
max_depth: nil,
|
|
618
623
|
# Maximum number of pages to track.
|
|
619
624
|
max_pages: nil,
|
|
620
|
-
# JSON Schema describing the data you care about. It
|
|
621
|
-
# selected for tracking
|
|
622
|
-
#
|
|
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.
|
|
623
633
|
schema: nil,
|
|
624
634
|
type: :extract
|
|
625
635
|
)
|
|
@@ -660,21 +670,101 @@ module ContextDev
|
|
|
660
670
|
)
|
|
661
671
|
end
|
|
662
672
|
|
|
663
|
-
# Webhook URL
|
|
673
|
+
# Webhook URL events are delivered to.
|
|
664
674
|
sig { returns(String) }
|
|
665
675
|
attr_accessor :url
|
|
666
676
|
|
|
677
|
+
# Events delivered to this endpoint. `change.detected` fires only when a run
|
|
678
|
+
# detects a change; `run.completed` fires on every completed run — including runs
|
|
679
|
+
# that detected no change — and embeds the change when one was detected. Defaults
|
|
680
|
+
# to `["change.detected"]` when omitted.
|
|
681
|
+
sig do
|
|
682
|
+
returns(
|
|
683
|
+
T.nilable(
|
|
684
|
+
T::Array[
|
|
685
|
+
ContextDev::MonitorUpdateParams::Webhook::Event::OrSymbol
|
|
686
|
+
]
|
|
687
|
+
)
|
|
688
|
+
)
|
|
689
|
+
end
|
|
690
|
+
attr_reader :events
|
|
691
|
+
|
|
692
|
+
sig do
|
|
693
|
+
params(
|
|
694
|
+
events:
|
|
695
|
+
T::Array[
|
|
696
|
+
ContextDev::MonitorUpdateParams::Webhook::Event::OrSymbol
|
|
697
|
+
]
|
|
698
|
+
).void
|
|
699
|
+
end
|
|
700
|
+
attr_writer :events
|
|
701
|
+
|
|
667
702
|
# Set to null to remove the webhook.
|
|
668
|
-
sig
|
|
703
|
+
sig do
|
|
704
|
+
params(
|
|
705
|
+
url: String,
|
|
706
|
+
events:
|
|
707
|
+
T::Array[
|
|
708
|
+
ContextDev::MonitorUpdateParams::Webhook::Event::OrSymbol
|
|
709
|
+
]
|
|
710
|
+
).returns(T.attached_class)
|
|
711
|
+
end
|
|
669
712
|
def self.new(
|
|
670
|
-
# Webhook URL
|
|
671
|
-
url
|
|
713
|
+
# Webhook URL events are delivered to.
|
|
714
|
+
url:,
|
|
715
|
+
# Events delivered to this endpoint. `change.detected` fires only when a run
|
|
716
|
+
# detects a change; `run.completed` fires on every completed run — including runs
|
|
717
|
+
# that detected no change — and embeds the change when one was detected. Defaults
|
|
718
|
+
# to `["change.detected"]` when omitted.
|
|
719
|
+
events: nil
|
|
672
720
|
)
|
|
673
721
|
end
|
|
674
722
|
|
|
675
|
-
sig
|
|
723
|
+
sig do
|
|
724
|
+
override.returns(
|
|
725
|
+
{
|
|
726
|
+
url: String,
|
|
727
|
+
events:
|
|
728
|
+
T::Array[
|
|
729
|
+
ContextDev::MonitorUpdateParams::Webhook::Event::OrSymbol
|
|
730
|
+
],
|
|
731
|
+
secret: String
|
|
732
|
+
}
|
|
733
|
+
)
|
|
734
|
+
end
|
|
676
735
|
def to_hash
|
|
677
736
|
end
|
|
737
|
+
|
|
738
|
+
module Event
|
|
739
|
+
extend ContextDev::Internal::Type::Enum
|
|
740
|
+
|
|
741
|
+
TaggedSymbol =
|
|
742
|
+
T.type_alias do
|
|
743
|
+
T.all(Symbol, ContextDev::MonitorUpdateParams::Webhook::Event)
|
|
744
|
+
end
|
|
745
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
746
|
+
|
|
747
|
+
CHANGE_DETECTED =
|
|
748
|
+
T.let(
|
|
749
|
+
:"change.detected",
|
|
750
|
+
ContextDev::MonitorUpdateParams::Webhook::Event::TaggedSymbol
|
|
751
|
+
)
|
|
752
|
+
RUN_COMPLETED =
|
|
753
|
+
T.let(
|
|
754
|
+
:"run.completed",
|
|
755
|
+
ContextDev::MonitorUpdateParams::Webhook::Event::TaggedSymbol
|
|
756
|
+
)
|
|
757
|
+
|
|
758
|
+
sig do
|
|
759
|
+
override.returns(
|
|
760
|
+
T::Array[
|
|
761
|
+
ContextDev::MonitorUpdateParams::Webhook::Event::TaggedSymbol
|
|
762
|
+
]
|
|
763
|
+
)
|
|
764
|
+
end
|
|
765
|
+
def self.values
|
|
766
|
+
end
|
|
767
|
+
end
|
|
678
768
|
end
|
|
679
769
|
end
|
|
680
770
|
end
|