@debugbundle/cli 1.29.0 → 1.30.1
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.
- package/dist/main.cjs +465 -68
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -52486,6 +52486,13 @@ function isSensitiveKey(key, sensitiveKeys) {
|
|
|
52486
52486
|
}
|
|
52487
52487
|
return false;
|
|
52488
52488
|
}
|
|
52489
|
+
function isExactSensitiveKey(key, exactKeys) {
|
|
52490
|
+
if (exactKeys.length === 0) {
|
|
52491
|
+
return false;
|
|
52492
|
+
}
|
|
52493
|
+
const normalized = key.trim().toLowerCase();
|
|
52494
|
+
return exactKeys.some((candidate) => candidate.trim().toLowerCase() === normalized);
|
|
52495
|
+
}
|
|
52489
52496
|
|
|
52490
52497
|
// ../../packages/redaction/src/telemetry-text.ts
|
|
52491
52498
|
var REDACTED = "[REDACTED]";
|
|
@@ -52526,7 +52533,8 @@ function isValidCard(value) {
|
|
|
52526
52533
|
}
|
|
52527
52534
|
return sum % 10 === 0;
|
|
52528
52535
|
}
|
|
52529
|
-
function scrubUrl(raw,
|
|
52536
|
+
function scrubUrl(raw, additionalKeys, exactKeys) {
|
|
52537
|
+
const broadKeys = [...DEFAULT_SENSITIVE_KEYS, ...additionalKeys];
|
|
52530
52538
|
try {
|
|
52531
52539
|
const url2 = new URL(raw);
|
|
52532
52540
|
if (url2.username || url2.password) {
|
|
@@ -52535,10 +52543,10 @@ function scrubUrl(raw, keys) {
|
|
|
52535
52543
|
}
|
|
52536
52544
|
const nextQuery = new URLSearchParams();
|
|
52537
52545
|
for (const [key, value] of url2.searchParams) {
|
|
52538
|
-
if (key.length > 128 || scrubCredentialText(key,
|
|
52546
|
+
if (key.length > 128 || scrubCredentialText(key, additionalKeys, false, exactKeys) !== key) continue;
|
|
52539
52547
|
nextQuery.append(
|
|
52540
52548
|
key,
|
|
52541
|
-
isSensitiveKey(key,
|
|
52549
|
+
isSensitiveKey(key, broadKeys) || isExactSensitiveKey(key, exactKeys) || scrubCredentialText(value, additionalKeys, false, exactKeys) !== value ? REDACTED : value
|
|
52542
52550
|
);
|
|
52543
52551
|
}
|
|
52544
52552
|
url2.search = nextQuery.toString();
|
|
@@ -52548,8 +52556,7 @@ function scrubUrl(raw, keys) {
|
|
|
52548
52556
|
return REDACTED;
|
|
52549
52557
|
}
|
|
52550
52558
|
}
|
|
52551
|
-
function scrubCredentialText(input3, additionalKeys, scanUrls = true) {
|
|
52552
|
-
const keys = [...DEFAULT_SENSITIVE_KEYS, ...additionalKeys];
|
|
52559
|
+
function scrubCredentialText(input3, additionalKeys, scanUrls = true, exactKeys = []) {
|
|
52553
52560
|
if (PEM_START.test(input3) && !PEM_COMPLETE.test(input3)) return REDACTED;
|
|
52554
52561
|
let output3 = input3;
|
|
52555
52562
|
if (/(?:password|token|secret|authorization|cookie)%3[ad]/i.test(output3)) {
|
|
@@ -52572,11 +52579,23 @@ function scrubCredentialText(input3, additionalKeys, scanUrls = true) {
|
|
|
52572
52579
|
output3 = output3.replace(named, "$1$2[REDACTED]");
|
|
52573
52580
|
}
|
|
52574
52581
|
}
|
|
52582
|
+
if (exactKeys.length > 0) {
|
|
52583
|
+
for (const key of exactKeys) {
|
|
52584
|
+
const trimmed = key.trim();
|
|
52585
|
+
if (trimmed.length === 0) continue;
|
|
52586
|
+
const escaped = trimmed.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
52587
|
+
const named = new RegExp(
|
|
52588
|
+
`(?<![A-Za-z0-9_-])(${escaped})(?![A-Za-z0-9_-])(["']?\\s*[:=]\\s*)(?:"[^"]*"|'[^']*'|[^\\s&,;]+)`,
|
|
52589
|
+
"gi"
|
|
52590
|
+
);
|
|
52591
|
+
output3 = output3.replace(named, "$1$2[REDACTED]");
|
|
52592
|
+
}
|
|
52593
|
+
}
|
|
52575
52594
|
output3 = output3.replace(CARD, (candidate) => isValidCard(candidate) ? REDACTED : candidate);
|
|
52576
52595
|
if (!scanUrls) return output3;
|
|
52577
52596
|
return output3.replace(URL_TEXT, (matched) => {
|
|
52578
52597
|
const trailing = matched.match(/[).,;]+$/)?.[0] ?? "";
|
|
52579
|
-
return scrubUrl(matched.slice(0, matched.length - trailing.length),
|
|
52598
|
+
return scrubUrl(matched.slice(0, matched.length - trailing.length), additionalKeys, exactKeys) + trailing;
|
|
52580
52599
|
});
|
|
52581
52600
|
}
|
|
52582
52601
|
|
|
@@ -52616,7 +52635,7 @@ function sanitizeString(value, state2, allowStructured) {
|
|
|
52616
52635
|
if (error62 instanceof BudgetExceeded) throw error62;
|
|
52617
52636
|
}
|
|
52618
52637
|
}
|
|
52619
|
-
const result = scrubCredentialText(value, state2.extra);
|
|
52638
|
+
const result = scrubCredentialText(value, state2.extra, true, state2.exact);
|
|
52620
52639
|
if (result !== value) state2.redactionCount += 1;
|
|
52621
52640
|
if ((value.startsWith("{") || value.startsWith("[")) && result === value && /(?:password|token|secret|authorization|cookie)["']?\s*[:=]/i.test(value)) {
|
|
52622
52641
|
return mask(state2);
|
|
@@ -52655,14 +52674,14 @@ function sanitizeValue(value, state2, depth, allowStructured) {
|
|
|
52655
52674
|
}
|
|
52656
52675
|
state2.textBytes += byteLength(key);
|
|
52657
52676
|
if (state2.textBytes > state2.maxTotalBytes) throw new BudgetExceeded();
|
|
52658
|
-
const safeKey = scrubCredentialText(key, state2.extra);
|
|
52677
|
+
const safeKey = scrubCredentialText(key, state2.extra, true, state2.exact);
|
|
52659
52678
|
if (safeKey !== key) {
|
|
52660
52679
|
state2.redactionCount += 1;
|
|
52661
52680
|
continue;
|
|
52662
52681
|
}
|
|
52663
52682
|
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
52664
52683
|
if (descriptor === void 0 || !("value" in descriptor)) throw new TypeError("unsafe_input");
|
|
52665
|
-
const safeValue = isSensitiveKey(key, state2.keys) ? mask(state2) : sanitizeValue(descriptor.value, state2, depth + 1, allowStructured);
|
|
52684
|
+
const safeValue = isSensitiveKey(key, state2.keys) || isExactSensitiveKey(key, state2.exact) ? mask(state2) : sanitizeValue(descriptor.value, state2, depth + 1, allowStructured);
|
|
52666
52685
|
Object.defineProperty(result, key, {
|
|
52667
52686
|
value: safeValue,
|
|
52668
52687
|
enumerable: true,
|
|
@@ -52678,7 +52697,8 @@ function sanitizeValue(value, state2, depth, allowStructured) {
|
|
|
52678
52697
|
function sanitizeTelemetry(value, options = {}) {
|
|
52679
52698
|
try {
|
|
52680
52699
|
const extra = options.additionalKeys ?? [];
|
|
52681
|
-
|
|
52700
|
+
const exact = options.exactKeys ?? [];
|
|
52701
|
+
if (extra.length + exact.length > 128 || extra.some((key) => typeof key !== "string" || key.length > 64 || !key.trim()) || exact.some((key) => typeof key !== "string" || key.length > 64 || !key.trim())) {
|
|
52682
52702
|
return { ok: false, reason: "unsafe_input" };
|
|
52683
52703
|
}
|
|
52684
52704
|
const maxTotalBytes = options.maxTotalBytes ?? MAX_TOTAL_BYTES;
|
|
@@ -52692,6 +52712,7 @@ function sanitizeTelemetry(value, options = {}) {
|
|
|
52692
52712
|
seen: /* @__PURE__ */ new WeakSet(),
|
|
52693
52713
|
keys: [...DEFAULT_SENSITIVE_KEYS, ...extra],
|
|
52694
52714
|
extra,
|
|
52715
|
+
exact,
|
|
52695
52716
|
maxTotalBytes
|
|
52696
52717
|
};
|
|
52697
52718
|
const sanitized = sanitizeValue(value, state2, 0, true);
|
|
@@ -52705,7 +52726,7 @@ function sanitizeTelemetry(value, options = {}) {
|
|
|
52705
52726
|
}
|
|
52706
52727
|
|
|
52707
52728
|
// ../../packages/redaction/src/index.ts
|
|
52708
|
-
function redactInternal(value, path3, sensitiveKeys, replacement, touchedPaths, seen) {
|
|
52729
|
+
function redactInternal(value, path3, sensitiveKeys, exactKeys, replacement, touchedPaths, seen) {
|
|
52709
52730
|
if (Array.isArray(value)) {
|
|
52710
52731
|
if (seen.has(value)) {
|
|
52711
52732
|
return "[Circular]";
|
|
@@ -52716,6 +52737,7 @@ function redactInternal(value, path3, sensitiveKeys, replacement, touchedPaths,
|
|
|
52716
52737
|
entry,
|
|
52717
52738
|
path3.length === 0 ? `[${index}]` : `${path3}[${index}]`,
|
|
52718
52739
|
sensitiveKeys,
|
|
52740
|
+
exactKeys,
|
|
52719
52741
|
replacement,
|
|
52720
52742
|
touchedPaths,
|
|
52721
52743
|
seen
|
|
@@ -52734,7 +52756,7 @@ function redactInternal(value, path3, sensitiveKeys, replacement, touchedPaths,
|
|
|
52734
52756
|
const output3 = {};
|
|
52735
52757
|
for (const [key, nestedValue] of Object.entries(value)) {
|
|
52736
52758
|
const nextPath = path3.length === 0 ? key : `${path3}.${key}`;
|
|
52737
|
-
if (isSensitiveKey(key, sensitiveKeys)) {
|
|
52759
|
+
if (isSensitiveKey(key, sensitiveKeys) || isExactSensitiveKey(key, exactKeys)) {
|
|
52738
52760
|
output3[key] = replacement;
|
|
52739
52761
|
touchedPaths.push(nextPath);
|
|
52740
52762
|
continue;
|
|
@@ -52743,6 +52765,7 @@ function redactInternal(value, path3, sensitiveKeys, replacement, touchedPaths,
|
|
|
52743
52765
|
nestedValue,
|
|
52744
52766
|
nextPath,
|
|
52745
52767
|
sensitiveKeys,
|
|
52768
|
+
exactKeys,
|
|
52746
52769
|
replacement,
|
|
52747
52770
|
touchedPaths,
|
|
52748
52771
|
seen
|
|
@@ -52755,12 +52778,14 @@ function redact(payload, options) {
|
|
|
52755
52778
|
const sensitiveKeys = options?.sensitiveKeys?.map((key) => key.trim().toLowerCase()) ?? [
|
|
52756
52779
|
...DEFAULT_SENSITIVE_KEYS
|
|
52757
52780
|
];
|
|
52781
|
+
const exactKeys = options?.exactKeys?.map((key) => key.trim().toLowerCase()) ?? [];
|
|
52758
52782
|
const replacement = options?.replacement ?? "[REDACTED]";
|
|
52759
52783
|
const touchedPaths = [];
|
|
52760
52784
|
const redacted = redactInternal(
|
|
52761
52785
|
payload,
|
|
52762
52786
|
"",
|
|
52763
52787
|
sensitiveKeys,
|
|
52788
|
+
exactKeys,
|
|
52764
52789
|
replacement,
|
|
52765
52790
|
touchedPaths,
|
|
52766
52791
|
/* @__PURE__ */ new WeakSet()
|
|
@@ -56157,12 +56182,19 @@ var CAPTURE_RULE_RUNTIME_VALUES = [
|
|
|
56157
56182
|
"java",
|
|
56158
56183
|
"go",
|
|
56159
56184
|
"ruby",
|
|
56185
|
+
"dotnet",
|
|
56186
|
+
"rust",
|
|
56187
|
+
"android",
|
|
56188
|
+
"swift",
|
|
56189
|
+
"react-native",
|
|
56160
56190
|
"unknown"
|
|
56161
56191
|
];
|
|
56162
|
-
var CaptureRuleActionValues = ["demote", "sample", "drop"];
|
|
56192
|
+
var CaptureRuleActionValues = ["demote", "sample", "drop", "threshold", "allow"];
|
|
56163
56193
|
var CaptureRuleActionSchema = external_exports.enum(CaptureRuleActionValues);
|
|
56164
56194
|
var CaptureRuleSampleEventClassValues = ["preserve", "context"];
|
|
56165
56195
|
var CaptureRuleSampleEventClassSchema = external_exports.enum(CaptureRuleSampleEventClassValues);
|
|
56196
|
+
var CaptureRuleThresholdGroupByValues = ["resource", "fingerprint"];
|
|
56197
|
+
var CaptureRuleThresholdGroupBySchema = external_exports.enum(CaptureRuleThresholdGroupByValues);
|
|
56166
56198
|
var CaptureRuleRuntimeSchema = external_exports.enum(CAPTURE_RULE_RUNTIME_VALUES);
|
|
56167
56199
|
var CaptureRuleEventTypeSchema = external_exports.enum(CAPTURE_RULE_EVENT_TYPES);
|
|
56168
56200
|
var BrowserEventKindSchema = external_exports.enum(["window_error", "resource_error"]);
|
|
@@ -56244,6 +56276,29 @@ var UrlMatcherSchema = external_exports.object({
|
|
|
56244
56276
|
message: "URL matchers must include at least one host or path constraint."
|
|
56245
56277
|
}
|
|
56246
56278
|
);
|
|
56279
|
+
var ExactUrlMatcherSchema = external_exports.object({
|
|
56280
|
+
host: external_exports.string().trim().min(1).max(255),
|
|
56281
|
+
path_equals: external_exports.string().trim().min(1).max(1024)
|
|
56282
|
+
}).strict().transform((value) => ({
|
|
56283
|
+
host: value.host.toLowerCase(),
|
|
56284
|
+
path_equals: value.path_equals.startsWith("/") ? value.path_equals : `/${value.path_equals}`
|
|
56285
|
+
}));
|
|
56286
|
+
function normalizeExactUrlMatchers(values) {
|
|
56287
|
+
if (values === void 0) {
|
|
56288
|
+
return void 0;
|
|
56289
|
+
}
|
|
56290
|
+
const seen = /* @__PURE__ */ new Set();
|
|
56291
|
+
const normalized = [];
|
|
56292
|
+
for (const entry of values) {
|
|
56293
|
+
const key = `${entry.host}\0${entry.path_equals}`;
|
|
56294
|
+
if (seen.has(key)) {
|
|
56295
|
+
continue;
|
|
56296
|
+
}
|
|
56297
|
+
seen.add(key);
|
|
56298
|
+
normalized.push(entry);
|
|
56299
|
+
}
|
|
56300
|
+
return normalized;
|
|
56301
|
+
}
|
|
56247
56302
|
var StatusRangeSchema = external_exports.object({
|
|
56248
56303
|
start: external_exports.number().int().min(100).max(599),
|
|
56249
56304
|
end: external_exports.number().int().min(100).max(599)
|
|
@@ -56286,6 +56341,7 @@ var CaptureRuleMatcherSchema = external_exports.object({
|
|
|
56286
56341
|
client_kind: CaptureRuleClientKindSchema.optional(),
|
|
56287
56342
|
bot_family: external_exports.string().min(1).max(120).optional(),
|
|
56288
56343
|
resource_url: UrlMatcherSchema.optional(),
|
|
56344
|
+
resource_urls: external_exports.array(ExactUrlMatcherSchema).min(1).max(10).optional(),
|
|
56289
56345
|
request_url: UrlMatcherSchema.optional(),
|
|
56290
56346
|
status_codes: external_exports.array(external_exports.number().int().min(100).max(599)).min(1).optional(),
|
|
56291
56347
|
status_ranges: external_exports.array(StatusRangeSchema).min(1).optional(),
|
|
@@ -56301,6 +56357,7 @@ var CaptureRuleMatcherSchema = external_exports.object({
|
|
|
56301
56357
|
const messageEquals = normalizeOptionalTrimmedString(value.message_equals);
|
|
56302
56358
|
const botFamily = normalizeOptionalTrimmedString(value.bot_family);
|
|
56303
56359
|
const browserTargetTagName = normalizeOptionalTrimmedString(value.browser_target_tag_name);
|
|
56360
|
+
const resourceUrls = normalizeExactUrlMatchers(value.resource_urls);
|
|
56304
56361
|
const statusCodes = normalizeNumberArray(value.status_codes);
|
|
56305
56362
|
if (eventTypes !== void 0) {
|
|
56306
56363
|
normalized.event_types = eventTypes;
|
|
@@ -56353,6 +56410,9 @@ var CaptureRuleMatcherSchema = external_exports.object({
|
|
|
56353
56410
|
if (value.resource_url !== void 0) {
|
|
56354
56411
|
normalized.resource_url = value.resource_url;
|
|
56355
56412
|
}
|
|
56413
|
+
if (resourceUrls !== void 0) {
|
|
56414
|
+
normalized.resource_urls = resourceUrls;
|
|
56415
|
+
}
|
|
56356
56416
|
if (value.request_url !== void 0) {
|
|
56357
56417
|
normalized.request_url = value.request_url;
|
|
56358
56418
|
}
|
|
@@ -56384,6 +56444,7 @@ var CaptureRuleMatcherSchema = external_exports.object({
|
|
|
56384
56444
|
"client_kind",
|
|
56385
56445
|
"bot_family",
|
|
56386
56446
|
"resource_url",
|
|
56447
|
+
"resource_urls",
|
|
56387
56448
|
"request_url",
|
|
56388
56449
|
"status_codes",
|
|
56389
56450
|
"status_ranges",
|
|
@@ -56395,8 +56456,15 @@ var CaptureRuleMatcherSchema = external_exports.object({
|
|
|
56395
56456
|
message: "Capture rules must include at least one narrowing field beyond event_types."
|
|
56396
56457
|
});
|
|
56397
56458
|
}
|
|
56459
|
+
if (hasValue(value.resource_url) && hasValue(value.resource_urls)) {
|
|
56460
|
+
context.addIssue({
|
|
56461
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56462
|
+
path: ["resource_urls"],
|
|
56463
|
+
message: "Capture rules cannot combine resource_url and resource_urls."
|
|
56464
|
+
});
|
|
56465
|
+
}
|
|
56398
56466
|
if (value.browser_event_kind === "resource_error") {
|
|
56399
|
-
const hasResourceConstraint = hasValue(value.resource_url) || hasValue(value.fingerprint);
|
|
56467
|
+
const hasResourceConstraint = hasValue(value.resource_url) || hasValue(value.resource_urls) || hasValue(value.fingerprint);
|
|
56400
56468
|
if (!hasResourceConstraint) {
|
|
56401
56469
|
context.addIssue({
|
|
56402
56470
|
code: external_exports.ZodIssueCode.custom,
|
|
@@ -56413,42 +56481,112 @@ var CaptureRuleCoreObjectSchema = external_exports.object({
|
|
|
56413
56481
|
matcher: CaptureRuleMatcherSchema,
|
|
56414
56482
|
sample_rate: external_exports.number().min(0).max(1).nullable(),
|
|
56415
56483
|
sample_event_class: CaptureRuleSampleEventClassSchema.nullable(),
|
|
56484
|
+
threshold_count: external_exports.number().int().min(2).max(1e3).nullable().optional(),
|
|
56485
|
+
threshold_window_seconds: external_exports.number().int().min(60).max(86400).nullable().optional(),
|
|
56486
|
+
threshold_group_by: CaptureRuleThresholdGroupBySchema.nullable().optional(),
|
|
56416
56487
|
created_by_user_id: external_exports.string().min(1).max(120).nullable(),
|
|
56417
56488
|
created_from_incident_id: external_exports.string().min(1).max(120).nullable(),
|
|
56418
56489
|
created_from_event_id: external_exports.string().min(1).max(120).nullable(),
|
|
56419
56490
|
expires_at: external_exports.string().datetime().nullable()
|
|
56420
56491
|
});
|
|
56492
|
+
function validateResourceThresholdMatcher(matcher, context) {
|
|
56493
|
+
if (matcher === void 0) {
|
|
56494
|
+
return;
|
|
56495
|
+
}
|
|
56496
|
+
const allowsFrontendException = matcher.event_types === void 0 || matcher.event_types.includes("frontend_exception");
|
|
56497
|
+
if (matcher.browser_event_kind !== "resource_error" || !allowsFrontendException) {
|
|
56498
|
+
context.addIssue({
|
|
56499
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56500
|
+
path: ["threshold_group_by"],
|
|
56501
|
+
message: "Resource threshold grouping requires a browser resource_error matcher."
|
|
56502
|
+
});
|
|
56503
|
+
}
|
|
56504
|
+
}
|
|
56421
56505
|
function addCaptureRuleActionValidation(schema) {
|
|
56422
56506
|
return schema.superRefine((value, context) => {
|
|
56423
|
-
|
|
56424
|
-
|
|
56507
|
+
const action = value["action"];
|
|
56508
|
+
const sampleRate = value["sample_rate"];
|
|
56509
|
+
const sampleEventClass = value["sample_event_class"];
|
|
56510
|
+
const thresholdCount = value["threshold_count"];
|
|
56511
|
+
const thresholdWindowSeconds = value["threshold_window_seconds"];
|
|
56512
|
+
const thresholdGroupBy = value["threshold_group_by"];
|
|
56513
|
+
const matcher = value["matcher"];
|
|
56514
|
+
if (action === "sample") {
|
|
56515
|
+
if (sampleRate === null || sampleRate === void 0) {
|
|
56425
56516
|
context.addIssue({
|
|
56426
56517
|
code: external_exports.ZodIssueCode.custom,
|
|
56427
56518
|
path: ["sample_rate"],
|
|
56428
56519
|
message: "Sample rules require sample_rate."
|
|
56429
56520
|
});
|
|
56430
56521
|
}
|
|
56431
|
-
if (
|
|
56522
|
+
if (sampleEventClass === null || sampleEventClass === void 0) {
|
|
56432
56523
|
context.addIssue({
|
|
56433
56524
|
code: external_exports.ZodIssueCode.custom,
|
|
56434
56525
|
path: ["sample_event_class"],
|
|
56435
56526
|
message: "Sample rules require sample_event_class."
|
|
56436
56527
|
});
|
|
56437
56528
|
}
|
|
56529
|
+
} else {
|
|
56530
|
+
if (hasValue(sampleRate)) {
|
|
56531
|
+
context.addIssue({
|
|
56532
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56533
|
+
path: ["sample_rate"],
|
|
56534
|
+
message: "Only sample rules can set sample_rate."
|
|
56535
|
+
});
|
|
56536
|
+
}
|
|
56537
|
+
if (hasValue(sampleEventClass)) {
|
|
56538
|
+
context.addIssue({
|
|
56539
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56540
|
+
path: ["sample_event_class"],
|
|
56541
|
+
message: "Only sample rules can set sample_event_class."
|
|
56542
|
+
});
|
|
56543
|
+
}
|
|
56544
|
+
}
|
|
56545
|
+
if (action === "threshold") {
|
|
56546
|
+
if (!hasValue(thresholdCount)) {
|
|
56547
|
+
context.addIssue({
|
|
56548
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56549
|
+
path: ["threshold_count"],
|
|
56550
|
+
message: "Threshold rules require threshold_count."
|
|
56551
|
+
});
|
|
56552
|
+
}
|
|
56553
|
+
if (!hasValue(thresholdWindowSeconds)) {
|
|
56554
|
+
context.addIssue({
|
|
56555
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56556
|
+
path: ["threshold_window_seconds"],
|
|
56557
|
+
message: "Threshold rules require threshold_window_seconds."
|
|
56558
|
+
});
|
|
56559
|
+
}
|
|
56560
|
+
if (!hasValue(thresholdGroupBy)) {
|
|
56561
|
+
context.addIssue({
|
|
56562
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56563
|
+
path: ["threshold_group_by"],
|
|
56564
|
+
message: "Threshold rules require threshold_group_by."
|
|
56565
|
+
});
|
|
56566
|
+
} else if (thresholdGroupBy === "resource") {
|
|
56567
|
+
validateResourceThresholdMatcher(matcher, context);
|
|
56568
|
+
}
|
|
56438
56569
|
return;
|
|
56439
56570
|
}
|
|
56440
|
-
if (
|
|
56571
|
+
if (hasValue(thresholdCount)) {
|
|
56441
56572
|
context.addIssue({
|
|
56442
56573
|
code: external_exports.ZodIssueCode.custom,
|
|
56443
|
-
path: ["
|
|
56444
|
-
message: "Only
|
|
56574
|
+
path: ["threshold_count"],
|
|
56575
|
+
message: "Only threshold rules can set threshold_count."
|
|
56445
56576
|
});
|
|
56446
56577
|
}
|
|
56447
|
-
if (
|
|
56578
|
+
if (hasValue(thresholdWindowSeconds)) {
|
|
56448
56579
|
context.addIssue({
|
|
56449
56580
|
code: external_exports.ZodIssueCode.custom,
|
|
56450
|
-
path: ["
|
|
56451
|
-
message: "Only
|
|
56581
|
+
path: ["threshold_window_seconds"],
|
|
56582
|
+
message: "Only threshold rules can set threshold_window_seconds."
|
|
56583
|
+
});
|
|
56584
|
+
}
|
|
56585
|
+
if (hasValue(thresholdGroupBy)) {
|
|
56586
|
+
context.addIssue({
|
|
56587
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56588
|
+
path: ["threshold_group_by"],
|
|
56589
|
+
message: "Only threshold rules can set threshold_group_by."
|
|
56452
56590
|
});
|
|
56453
56591
|
}
|
|
56454
56592
|
});
|
|
@@ -56473,6 +56611,9 @@ var CaptureRuleCreateSchema = external_exports.object({
|
|
|
56473
56611
|
matcher: CaptureRuleMatcherSchema,
|
|
56474
56612
|
sample_rate: external_exports.number().min(0).max(1).nullable().optional(),
|
|
56475
56613
|
sample_event_class: CaptureRuleSampleEventClassSchema.nullable().optional(),
|
|
56614
|
+
threshold_count: external_exports.number().int().min(2).max(1e3).nullable().optional(),
|
|
56615
|
+
threshold_window_seconds: external_exports.number().int().min(60).max(86400).nullable().optional(),
|
|
56616
|
+
threshold_group_by: CaptureRuleThresholdGroupBySchema.nullable().optional(),
|
|
56476
56617
|
created_by_user_id: external_exports.string().min(1).max(120).nullable().default(null),
|
|
56477
56618
|
created_from_incident_id: external_exports.string().min(1).max(120).nullable().default(null),
|
|
56478
56619
|
created_from_event_id: external_exports.string().min(1).max(120).nullable().default(null),
|
|
@@ -56486,26 +56627,76 @@ var CaptureRuleCreateSchema = external_exports.object({
|
|
|
56486
56627
|
message: "Sample rules require sample_rate."
|
|
56487
56628
|
});
|
|
56488
56629
|
}
|
|
56630
|
+
} else {
|
|
56631
|
+
if (value.sample_rate !== void 0 && value.sample_rate !== null) {
|
|
56632
|
+
context.addIssue({
|
|
56633
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56634
|
+
path: ["sample_rate"],
|
|
56635
|
+
message: "Only sample rules can set sample_rate."
|
|
56636
|
+
});
|
|
56637
|
+
}
|
|
56638
|
+
if (value.sample_event_class !== void 0 && value.sample_event_class !== null) {
|
|
56639
|
+
context.addIssue({
|
|
56640
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56641
|
+
path: ["sample_event_class"],
|
|
56642
|
+
message: "Only sample rules can set sample_event_class."
|
|
56643
|
+
});
|
|
56644
|
+
}
|
|
56645
|
+
}
|
|
56646
|
+
if (value.action === "threshold") {
|
|
56647
|
+
if (!hasValue(value.threshold_count)) {
|
|
56648
|
+
context.addIssue({
|
|
56649
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56650
|
+
path: ["threshold_count"],
|
|
56651
|
+
message: "Threshold rules require threshold_count."
|
|
56652
|
+
});
|
|
56653
|
+
}
|
|
56654
|
+
if (!hasValue(value.threshold_window_seconds)) {
|
|
56655
|
+
context.addIssue({
|
|
56656
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56657
|
+
path: ["threshold_window_seconds"],
|
|
56658
|
+
message: "Threshold rules require threshold_window_seconds."
|
|
56659
|
+
});
|
|
56660
|
+
}
|
|
56661
|
+
if (!hasValue(value.threshold_group_by)) {
|
|
56662
|
+
context.addIssue({
|
|
56663
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56664
|
+
path: ["threshold_group_by"],
|
|
56665
|
+
message: "Threshold rules require threshold_group_by."
|
|
56666
|
+
});
|
|
56667
|
+
} else if (value.threshold_group_by === "resource") {
|
|
56668
|
+
validateResourceThresholdMatcher(value.matcher, context);
|
|
56669
|
+
}
|
|
56489
56670
|
return;
|
|
56490
56671
|
}
|
|
56491
|
-
if (value.
|
|
56672
|
+
if (hasValue(value.threshold_count)) {
|
|
56673
|
+
context.addIssue({
|
|
56674
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56675
|
+
path: ["threshold_count"],
|
|
56676
|
+
message: "Only threshold rules can set threshold_count."
|
|
56677
|
+
});
|
|
56678
|
+
}
|
|
56679
|
+
if (hasValue(value.threshold_window_seconds)) {
|
|
56492
56680
|
context.addIssue({
|
|
56493
56681
|
code: external_exports.ZodIssueCode.custom,
|
|
56494
|
-
path: ["
|
|
56495
|
-
message: "Only
|
|
56682
|
+
path: ["threshold_window_seconds"],
|
|
56683
|
+
message: "Only threshold rules can set threshold_window_seconds."
|
|
56496
56684
|
});
|
|
56497
56685
|
}
|
|
56498
|
-
if (value.
|
|
56686
|
+
if (hasValue(value.threshold_group_by)) {
|
|
56499
56687
|
context.addIssue({
|
|
56500
56688
|
code: external_exports.ZodIssueCode.custom,
|
|
56501
|
-
path: ["
|
|
56502
|
-
message: "Only
|
|
56689
|
+
path: ["threshold_group_by"],
|
|
56690
|
+
message: "Only threshold rules can set threshold_group_by."
|
|
56503
56691
|
});
|
|
56504
56692
|
}
|
|
56505
56693
|
}).transform((value) => ({
|
|
56506
56694
|
...value,
|
|
56507
56695
|
sample_rate: value.action === "sample" ? value.sample_rate : null,
|
|
56508
|
-
sample_event_class: value.action === "sample" ? value.sample_event_class ?? "preserve" : null
|
|
56696
|
+
sample_event_class: value.action === "sample" ? value.sample_event_class ?? "preserve" : null,
|
|
56697
|
+
threshold_count: value.action === "threshold" ? value.threshold_count : null,
|
|
56698
|
+
threshold_window_seconds: value.action === "threshold" ? value.threshold_window_seconds : null,
|
|
56699
|
+
threshold_group_by: value.action === "threshold" ? value.threshold_group_by : null
|
|
56509
56700
|
}));
|
|
56510
56701
|
var CaptureRuleUpdateSchema = external_exports.object({
|
|
56511
56702
|
project_scope: external_exports.literal("current_project").optional(),
|
|
@@ -56516,6 +56707,9 @@ var CaptureRuleUpdateSchema = external_exports.object({
|
|
|
56516
56707
|
matcher: CaptureRuleMatcherSchema.optional(),
|
|
56517
56708
|
sample_rate: external_exports.number().min(0).max(1).nullable().optional(),
|
|
56518
56709
|
sample_event_class: CaptureRuleSampleEventClassSchema.nullable().optional(),
|
|
56710
|
+
threshold_count: external_exports.number().int().min(2).max(1e3).nullable().optional(),
|
|
56711
|
+
threshold_window_seconds: external_exports.number().int().min(60).max(86400).nullable().optional(),
|
|
56712
|
+
threshold_group_by: CaptureRuleThresholdGroupBySchema.nullable().optional(),
|
|
56519
56713
|
expires_at: external_exports.string().datetime().nullable().optional()
|
|
56520
56714
|
}).superRefine((value, context) => {
|
|
56521
56715
|
if (Object.keys(value).length === 0) {
|
|
@@ -56526,34 +56720,81 @@ var CaptureRuleUpdateSchema = external_exports.object({
|
|
|
56526
56720
|
}
|
|
56527
56721
|
const resolvedAction = value.action;
|
|
56528
56722
|
if (resolvedAction === "sample") {
|
|
56529
|
-
if (!("sample_rate" in value)) {
|
|
56723
|
+
if (!("sample_rate" in value) || value.sample_rate === null) {
|
|
56530
56724
|
context.addIssue({
|
|
56531
56725
|
code: external_exports.ZodIssueCode.custom,
|
|
56532
56726
|
path: ["sample_rate"],
|
|
56533
56727
|
message: "Sample rule updates must include sample_rate when changing action to sample."
|
|
56534
56728
|
});
|
|
56535
56729
|
}
|
|
56536
|
-
if (!("sample_event_class" in value)) {
|
|
56730
|
+
if (!("sample_event_class" in value) || value.sample_event_class === null) {
|
|
56537
56731
|
context.addIssue({
|
|
56538
56732
|
code: external_exports.ZodIssueCode.custom,
|
|
56539
56733
|
path: ["sample_event_class"],
|
|
56540
56734
|
message: "Sample rule updates must include sample_event_class when changing action to sample."
|
|
56541
56735
|
});
|
|
56542
56736
|
}
|
|
56737
|
+
} else {
|
|
56738
|
+
if ("sample_rate" in value) {
|
|
56739
|
+
context.addIssue({
|
|
56740
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56741
|
+
path: ["sample_rate"],
|
|
56742
|
+
message: "Sample rule fields can only be updated while setting action to sample."
|
|
56743
|
+
});
|
|
56744
|
+
}
|
|
56745
|
+
if ("sample_event_class" in value) {
|
|
56746
|
+
context.addIssue({
|
|
56747
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56748
|
+
path: ["sample_event_class"],
|
|
56749
|
+
message: "Sample rule fields can only be updated while setting action to sample."
|
|
56750
|
+
});
|
|
56751
|
+
}
|
|
56752
|
+
}
|
|
56753
|
+
if (resolvedAction === "threshold") {
|
|
56754
|
+
if (!("threshold_count" in value) || !hasValue(value.threshold_count)) {
|
|
56755
|
+
context.addIssue({
|
|
56756
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56757
|
+
path: ["threshold_count"],
|
|
56758
|
+
message: "Threshold rule updates must include threshold_count when changing action to threshold."
|
|
56759
|
+
});
|
|
56760
|
+
}
|
|
56761
|
+
if (!("threshold_window_seconds" in value) || !hasValue(value.threshold_window_seconds)) {
|
|
56762
|
+
context.addIssue({
|
|
56763
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56764
|
+
path: ["threshold_window_seconds"],
|
|
56765
|
+
message: "Threshold rule updates must include threshold_window_seconds when changing action to threshold."
|
|
56766
|
+
});
|
|
56767
|
+
}
|
|
56768
|
+
if (!("threshold_group_by" in value) || !hasValue(value.threshold_group_by)) {
|
|
56769
|
+
context.addIssue({
|
|
56770
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56771
|
+
path: ["threshold_group_by"],
|
|
56772
|
+
message: "Threshold rule updates must include threshold_group_by when changing action to threshold."
|
|
56773
|
+
});
|
|
56774
|
+
} else if (value.threshold_group_by === "resource" && value.matcher !== void 0) {
|
|
56775
|
+
validateResourceThresholdMatcher(value.matcher, context);
|
|
56776
|
+
}
|
|
56543
56777
|
return;
|
|
56544
56778
|
}
|
|
56545
|
-
if ("
|
|
56779
|
+
if ("threshold_count" in value) {
|
|
56546
56780
|
context.addIssue({
|
|
56547
56781
|
code: external_exports.ZodIssueCode.custom,
|
|
56548
|
-
path: ["
|
|
56549
|
-
message: "
|
|
56782
|
+
path: ["threshold_count"],
|
|
56783
|
+
message: "Threshold rule fields can only be updated while setting action to threshold."
|
|
56550
56784
|
});
|
|
56551
56785
|
}
|
|
56552
|
-
if ("
|
|
56786
|
+
if ("threshold_window_seconds" in value) {
|
|
56553
56787
|
context.addIssue({
|
|
56554
56788
|
code: external_exports.ZodIssueCode.custom,
|
|
56555
|
-
path: ["
|
|
56556
|
-
message: "
|
|
56789
|
+
path: ["threshold_window_seconds"],
|
|
56790
|
+
message: "Threshold rule fields can only be updated while setting action to threshold."
|
|
56791
|
+
});
|
|
56792
|
+
}
|
|
56793
|
+
if ("threshold_group_by" in value) {
|
|
56794
|
+
context.addIssue({
|
|
56795
|
+
code: external_exports.ZodIssueCode.custom,
|
|
56796
|
+
path: ["threshold_group_by"],
|
|
56797
|
+
message: "Threshold rule fields can only be updated while setting action to threshold."
|
|
56557
56798
|
});
|
|
56558
56799
|
}
|
|
56559
56800
|
});
|
|
@@ -56797,7 +57038,7 @@ function browserResourceDiagnosis(resource) {
|
|
|
56797
57038
|
return resource?.optional_candidate === true ? "The browser reported that this script failed to load. Possibly blocked by privacy tools; network, CSP or provider failures are also possible. The captured event does not identify the cause." : "The browser reported that this resource failed to load. The captured event does not identify the cause or establish whether application functionality was affected.";
|
|
56798
57039
|
}
|
|
56799
57040
|
|
|
56800
|
-
// ../../packages/shared-types/src/capture-rule-evaluation.ts
|
|
57041
|
+
// ../../packages/shared-types/src/capture-rule-evaluation-context.ts
|
|
56801
57042
|
var CaptureRuleEvaluationUrlSchema = external_exports.object({
|
|
56802
57043
|
host: external_exports.string().min(1).transform((value) => value.toLowerCase()).optional(),
|
|
56803
57044
|
path: external_exports.string().min(1).transform((value) => value.startsWith("/") ? value : `/${value}`)
|
|
@@ -59823,7 +60064,7 @@ var GitHubDispatchDeliverySchema = external_exports.object({
|
|
|
59823
60064
|
created_at: external_exports.string()
|
|
59824
60065
|
}).strict();
|
|
59825
60066
|
var GitHubInstallationResponseSchema = external_exports.object({
|
|
59826
|
-
installation: GitHubInstallationSchema
|
|
60067
|
+
installation: GitHubInstallationSchema.nullable()
|
|
59827
60068
|
}).strict();
|
|
59828
60069
|
var GitHubRepositoriesResponseSchema = external_exports.object({
|
|
59829
60070
|
repositories: external_exports.array(GitHubRepositorySchema)
|
|
@@ -59831,6 +60072,9 @@ var GitHubRepositoriesResponseSchema = external_exports.object({
|
|
|
59831
60072
|
var ProjectGitHubRepoResponseSchema = external_exports.object({
|
|
59832
60073
|
repo: ProjectGitHubRepoSchema
|
|
59833
60074
|
}).strict();
|
|
60075
|
+
var GetProjectGitHubRepoResponseSchema = ProjectGitHubRepoResponseSchema.extend({
|
|
60076
|
+
repo: ProjectGitHubRepoSchema.nullable()
|
|
60077
|
+
});
|
|
59834
60078
|
var GitHubDispatchRulesResponseSchema = external_exports.object({
|
|
59835
60079
|
rules: external_exports.array(GitHubDispatchRuleSchema)
|
|
59836
60080
|
}).strict();
|
|
@@ -59884,12 +60128,12 @@ async function expectRepositories(responsePromise) {
|
|
|
59884
60128
|
}
|
|
59885
60129
|
return parsed.data.repositories;
|
|
59886
60130
|
}
|
|
59887
|
-
async function expectProjectRepo(responsePromise) {
|
|
60131
|
+
async function expectProjectRepo(responsePromise, schema) {
|
|
59888
60132
|
const response = await responsePromise;
|
|
59889
60133
|
if (response.status < 200 || response.status >= 300) {
|
|
59890
60134
|
parseApiError8(response.status, response.body);
|
|
59891
60135
|
}
|
|
59892
|
-
const parsed =
|
|
60136
|
+
const parsed = schema.safeParse(response.body);
|
|
59893
60137
|
if (!parsed.success) {
|
|
59894
60138
|
throw new GitHubManagementApiError(response.status, "invalid_response_shape");
|
|
59895
60139
|
}
|
|
@@ -59986,7 +60230,8 @@ function createGitHubManagementApi(client) {
|
|
|
59986
60230
|
method: "GET",
|
|
59987
60231
|
path: `/v1/projects/${input3.projectId}/github/repo`,
|
|
59988
60232
|
bearerToken: input3.bearerToken
|
|
59989
|
-
})
|
|
60233
|
+
}),
|
|
60234
|
+
GetProjectGitHubRepoResponseSchema
|
|
59990
60235
|
);
|
|
59991
60236
|
},
|
|
59992
60237
|
async listProjectDeliveries(input3) {
|
|
@@ -60085,7 +60330,8 @@ function createGitHubManagementApi(client) {
|
|
|
60085
60330
|
owner: input3.owner,
|
|
60086
60331
|
repo: input3.repo
|
|
60087
60332
|
}
|
|
60088
|
-
})
|
|
60333
|
+
}),
|
|
60334
|
+
ProjectGitHubRepoResponseSchema
|
|
60089
60335
|
);
|
|
60090
60336
|
},
|
|
60091
60337
|
async removeProjectRepo(input3) {
|
|
@@ -62823,10 +63069,12 @@ function buildSkill() {
|
|
|
62823
63069
|
"",
|
|
62824
63070
|
"### Browser resource failures",
|
|
62825
63071
|
"",
|
|
62826
|
-
"- Inspect the primary failure and
|
|
62827
|
-
'-
|
|
63072
|
+
"- Inspect the primary failure, routes, and passive evidence first: one resource can span pages, route coverage may be incomplete, and historical incidents stay separate. Related tracker evidence does not explain an application exception.",
|
|
63073
|
+
'- Distinguish observed evidence from unknown causes: treat enforced CSP (`disposition: "enforce"`) separately from report-only CSP (`disposition: "report"`, which does not block), check observed resource-timing HTTP status, explicit recovery outcomes, and `visibility_state: "unloaded"` (`pagehide` teardown aborts). When the cause is still unknown, say "possibly blocked by privacy tools." Network/CSP/provider failures remain possible; provider recognition proves neither Pi-hole blocking nor optionality.',
|
|
62828
63074
|
"- Review exact resource host/path/type, service, environment and opacity, or the returned exact fingerprint when evidence is incomplete; never widen to a whole host. All resource incidents can offer explicit controls. Provider recognition does not establish that a dependency is optional; do not suppress authentication, app assets or unknown dependencies automatically.",
|
|
62829
|
-
|
|
63075
|
+
'- For single-visitor transient resource failures or deploy-hashed application assets (such as `/assets/`), prefer an opt-in `threshold` rule (`resource_threshold` suggestion or `--action threshold` with `--threshold-count`, `--threshold-window-seconds`, and `--threshold-group-by <resource|fingerprint>`) over `demote` or `drop`. Events below threshold wait without opening incidents or alerts, while real repeated outages still open one incident with prior-window occurrences and routes backfilled. Pair broader prefix rules with higher-specificity `action: "allow"` carve-outs when critical paths (such as checkout or authentication assets) must still open on the first failure.',
|
|
63076
|
+
"- For confirmed optional dependencies, context (`demote`) retains diagnostics without new incidents/alerts/automation and may remain billable; `drop` discards future matches and should be chosen only when evidence has no diagnostic value. When one confirmed optional dependency loads across primary and fallback CDN addresses, group them in one rule using `matcher.resource_urls` (1\u201310 exact `{ host, path_equals }` entries) instead of widening to a host. Explain the tradeoff; neither deletes history. Use the returned suggestion ID.",
|
|
63077
|
+
"- If legacy resource events show a redacted `tag_name` splitting one resource into per-route incidents, check the app's SDK `redactFields` configuration and recommend moving narrow private domain keys (such as `tag`) to exact-key `redactExactFields` alongside a protected SDK release that preserves schema-validated protocol fields.",
|
|
62830
63078
|
"- Check existing/disabled rules. Empty suggestions or pending/failed bundles do not justify broader rules. Applying requires user authorization and owner/admin access; preview is read-only. Verify subsequent matching and protected captures before claiming improvement; live tests need authorization.",
|
|
62831
63079
|
"- The official OpenAI connection cannot suggest or apply rules. When it is the only connection, review returned evidence and hand off through a returned safe dashboard URL; never invent tools or switch credentials.",
|
|
62832
63080
|
"",
|
|
@@ -62937,11 +63185,12 @@ function buildCliReference() {
|
|
|
62937
63185
|
"- `debugbundle capture-rule suggest <incident-id> [--auth-file <path>] [--json]`",
|
|
62938
63186
|
"- `debugbundle capture-rule create-from-suggestion <incident-id> --suggestion-id <id> [--name <name>] [--expires-at <ISO8601>] [--auth-file <path>] [--json]`",
|
|
62939
63187
|
"- `debugbundle capture-rule list --project-id <id> [--auth-file <path>] [--json]`",
|
|
62940
|
-
"- `debugbundle capture-rule create --project-id <id> --name <name> --action <demote|sample|drop> --matcher-json <json> [--auth-file <path>] [--json]`",
|
|
63188
|
+
"- `debugbundle capture-rule create --project-id <id> --name <name> --action <demote|sample|drop|threshold|allow> --matcher-json <json> [--threshold-count <2-1000>] [--threshold-window-seconds <60-86400>] [--threshold-group-by <resource|fingerprint>] [--expires-at <ISO8601>] [--auth-file <path>] [--json]`",
|
|
63189
|
+
"- `debugbundle capture-rule update <rule-id> --project-id <id> [--name <name>] [--action <demote|sample|drop|threshold|allow>] [--matcher-json <json>] [--threshold-count <2-1000>] [--threshold-window-seconds <60-86400>] [--threshold-group-by <resource|fingerprint>] [--enabled <true|false>] [--expires-at <ISO8601|null>] [--auth-file <path>] [--json]`",
|
|
62941
63190
|
"- `debugbundle capture-policy get [--project <id>] [--json]`",
|
|
62942
63191
|
"- `debugbundle capture-policy set [--project <id>] --client-error-path-rule <404=/path/*@GET,POST> [--json]`",
|
|
62943
63192
|
"",
|
|
62944
|
-
"Use capture-rule suggestions for repeated operational noise after inspecting an incident bundle. Use capture-policy client-error path rules for route-scoped 4xx incidents instead of promoting all client errors.",
|
|
63193
|
+
"Use capture-rule suggestions for repeated operational noise after inspecting an incident bundle. Prefer `threshold` (`resource_threshold` suggestion) for single-visitor transient resource failures and deploy-hashed assets, pair broader prefix rules with higher-specificity `allow` carve-outs for critical paths, and use `matcher.resource_urls` (1\u201310 exact `{ host, path_equals }` entries) for multi-CDN optional dependencies. Use capture-policy client-error path rules for route-scoped 4xx incidents instead of promoting all client errors.",
|
|
62945
63194
|
"For browser resource failures, follow the skill's Browser resource failures guidance. Use the current response's suggestion ID, inspect `bundle_status`, `access_mode` and existing-rule state, and review the complete matcher before applying.",
|
|
62946
63195
|
"",
|
|
62947
63196
|
"## Probes",
|
|
@@ -63082,10 +63331,10 @@ function buildMcpReference() {
|
|
|
63082
63331
|
"",
|
|
63083
63332
|
"- `suggest_capture_rules_from_incident` \u2014 generate deterministic capture-rule suggestions from an incident bundle.",
|
|
63084
63333
|
"- `create_capture_rule_from_incident_suggestion` \u2014 apply a confirmed suggestion.",
|
|
63085
|
-
"- `list_capture_rules`, `create_capture_rule`, `update_capture_rule`, `delete_capture_rule` \u2014 manage project capture rules.",
|
|
63334
|
+
"- `list_capture_rules`, `create_capture_rule`, `update_capture_rule`, `delete_capture_rule` \u2014 manage project capture rules (`demote`, `sample`, `drop`, `threshold` with rolling-window counts, `allow` carve-outs, and bounded `matcher.resource_urls`).",
|
|
63086
63335
|
"- `get_capture_policy`, `update_capture_policy` \u2014 review or update capture policy, including path-scoped client-error incident rules.",
|
|
63087
63336
|
"",
|
|
63088
|
-
"Use these tools for repeated low-value operational noise only after inspecting incident evidence. Keep frontend suppression scoped by structured browser and client signals, and use path-scoped capture policy for known 4xx routes.",
|
|
63337
|
+
"Use these tools for repeated low-value operational noise only after inspecting incident evidence. Prefer `threshold` (`resource_threshold`) for transient single-visitor or deploy-hashed resource noise, `allow` carve-outs for critical assets, and `resource_urls` for multi-CDN optional dependencies. Keep frontend suppression scoped by structured browser and client signals, and use path-scoped capture policy for known 4xx routes.",
|
|
63089
63338
|
"For browser resource failures, follow the skill's Browser resource failures guidance and use the suggestion ID returned by the server. These management tools belong to the access-token-authenticated MCP surface; the official OpenAI connection is read-only and cannot suggest or apply capture rules.",
|
|
63090
63339
|
"",
|
|
63091
63340
|
"## Product Analytics Tools",
|
|
@@ -63310,6 +63559,15 @@ function buildSkillEvals() {
|
|
|
63310
63559
|
"Verify the returned rule without claiming historical incidents were removed or live noise reduction was already observed."
|
|
63311
63560
|
]
|
|
63312
63561
|
},
|
|
63562
|
+
{
|
|
63563
|
+
name: "transient_hashed_asset_threshold_review",
|
|
63564
|
+
prompt: "Single-visitor deploy-hashed CSS/JS failures under /assets/ keep opening one-off incidents, while checkout assets under /assets/checkout- must stay immediate. A separate resource incident has a redacted tag_name because the app put tag in redactFields. Explain how to handle both safely.",
|
|
63565
|
+
expected_behavior: [
|
|
63566
|
+
"Inspect bundle evidence first, including passive CSP disposition, resource timing status, recovery observations, and unloaded teardown state.",
|
|
63567
|
+
"Recommend a scoped threshold rule (or resource_threshold suggestion) for transient /assets/ failures instead of broad demote/drop or whole-host suppression, paired with a higher-specificity allow carve-out for /assets/checkout-.",
|
|
63568
|
+
"Recommend moving narrow private domain keys such as tag to exact-key redactExactFields alongside a protected SDK release so protocol fields like tag_name stay intact."
|
|
63569
|
+
]
|
|
63570
|
+
},
|
|
63313
63571
|
{
|
|
63314
63572
|
name: "protected_resource_noise_review",
|
|
63315
63573
|
prompt: "A checkout TypeError has related GTM evidence. Separate incidents show Google sign-in and an unknown script failing. The user asks whether ignoring all Google or third-party hosts would clean this up.",
|
|
@@ -71468,6 +71726,18 @@ function buildDependenciesContext(incident, errorContext, requestContext) {
|
|
|
71468
71726
|
]
|
|
71469
71727
|
};
|
|
71470
71728
|
}
|
|
71729
|
+
function formatPassiveRecoveryNote(recoveryContext) {
|
|
71730
|
+
if (recoveryContext === void 0 || recoveryContext.outcome === "unknown") {
|
|
71731
|
+
return "";
|
|
71732
|
+
}
|
|
71733
|
+
if (recoveryContext.outcome === "recovered") {
|
|
71734
|
+
return " Explicit application recovery was later observed within the failure scope; incident status remains unchanged.";
|
|
71735
|
+
}
|
|
71736
|
+
if (recoveryContext.outcome === "persisted") {
|
|
71737
|
+
return " An explicit persistent-failure observation was later recorded within the failure scope.";
|
|
71738
|
+
}
|
|
71739
|
+
return " Conflicting recovery and persistent-failure observations were recorded within the failure scope.";
|
|
71740
|
+
}
|
|
71471
71741
|
function buildSummaryGuidance(input3) {
|
|
71472
71742
|
if (input3.errorContext === null) {
|
|
71473
71743
|
return {
|
|
@@ -71478,10 +71748,11 @@ function buildSummaryGuidance(input3) {
|
|
|
71478
71748
|
}
|
|
71479
71749
|
if (input3.opaqueBrowserError) {
|
|
71480
71750
|
if (input3.browserEvent?.kind === "resource_error") {
|
|
71751
|
+
const recoveryNote = formatPassiveRecoveryNote(input3.recoveryContext);
|
|
71481
71752
|
const recoveryFailure = input3.resourceContext?.recovery_failures?.[0];
|
|
71482
71753
|
if (recoveryFailure !== void 0) {
|
|
71483
71754
|
return {
|
|
71484
|
-
likely_cause: `The browser resource failure was followed by ${recoveryFailure.method} ${recoveryFailure.path} returning HTTP ${recoveryFailure.status_code}. This correlated recovery failure is the most actionable captured signal; it does not establish why the original resource load was interrupted
|
|
71755
|
+
likely_cause: `The browser resource failure was followed by ${recoveryFailure.method} ${recoveryFailure.path} returning HTTP ${recoveryFailure.status_code}. This correlated recovery failure is the most actionable captured signal; it does not establish why the original resource load was interrupted.${recoveryNote}`,
|
|
71485
71756
|
confidence: 0.65,
|
|
71486
71757
|
recommended_action: `Inspect the ${recoveryFailure.path} recovery route and its HTTP ${recoveryFailure.status_code} response, including any refresh, retry, or signed-URL handling, before investigating the generic resource error.`
|
|
71487
71758
|
};
|
|
@@ -71489,14 +71760,60 @@ function buildSummaryGuidance(input3) {
|
|
|
71489
71760
|
if (input3.resourceContext?.interruption !== void 0) {
|
|
71490
71761
|
const interruption = input3.resourceContext.interruption;
|
|
71491
71762
|
return {
|
|
71492
|
-
likely_cause: `The browser reported an opaque ${interruption.rel} failure while the page was ${interruption.visibility_state} and ${interruption.ready_state}. This is consistent with a browser-aborted speculative load, but the captured lifecycle state does not prove the cause
|
|
71763
|
+
likely_cause: `The browser reported an opaque ${interruption.rel} failure while the page was ${interruption.visibility_state} and ${interruption.ready_state}. This is consistent with a browser-aborted speculative load, but the captured lifecycle state does not prove the cause.${recoveryNote}`,
|
|
71493
71764
|
confidence: 0.55,
|
|
71494
71765
|
recommended_action: "Confirm whether the page was navigating or suspended, then review only lifecycle-scoped demotion if the asset succeeds during active page loads."
|
|
71495
71766
|
};
|
|
71496
71767
|
}
|
|
71768
|
+
const observationItems = input3.resourceObservations?.items ?? [];
|
|
71769
|
+
const enforcedCspDirectives = Array.from(
|
|
71770
|
+
new Set(
|
|
71771
|
+
observationItems.flatMap(
|
|
71772
|
+
({ observation }) => observation.kind === "csp" && observation.disposition === "enforce" ? [observation.effective_directive] : []
|
|
71773
|
+
)
|
|
71774
|
+
)
|
|
71775
|
+
).sort();
|
|
71776
|
+
if (enforcedCspDirectives.length > 0) {
|
|
71777
|
+
const directiveLabel = enforcedCspDirectives.join(", ");
|
|
71778
|
+
return {
|
|
71779
|
+
likely_cause: `An enforced Content Security Policy observation (${directiveLabel}) was captured alongside this resource failure. Temporal association does not prove causation, and document HTTP status is separate from resource status.${recoveryNote}`,
|
|
71780
|
+
confidence: 0.55,
|
|
71781
|
+
recommended_action: `Review the enforced ${directiveLabel} Content Security Policy directive for the affected resource host and confirm whether the asset should be permitted.`
|
|
71782
|
+
};
|
|
71783
|
+
}
|
|
71784
|
+
const observedFailureStatuses = Array.from(
|
|
71785
|
+
new Set(
|
|
71786
|
+
observationItems.flatMap(
|
|
71787
|
+
({ observation }) => observation.kind === "timing" && observation.availability === "observed" && observation.response_status !== null && observation.response_status >= 400 ? [observation.response_status] : []
|
|
71788
|
+
)
|
|
71789
|
+
)
|
|
71790
|
+
).sort((left, right) => left - right);
|
|
71791
|
+
if (observedFailureStatuses.length > 0) {
|
|
71792
|
+
const statusLabel = observedFailureStatuses.map((code) => `HTTP ${code}`).join(", ");
|
|
71793
|
+
return {
|
|
71794
|
+
likely_cause: `Passive resource timing observed ${statusLabel} for a matching resource load around this failure. Association is passive and does not prove the root cause.${recoveryNote}`,
|
|
71795
|
+
confidence: 0.55,
|
|
71796
|
+
recommended_action: `Check server or CDN availability, permissions, and asset deployment for the affected resource returning ${statusLabel}.`
|
|
71797
|
+
};
|
|
71798
|
+
}
|
|
71799
|
+
const reportOnlyCspDirectives = Array.from(
|
|
71800
|
+
new Set(
|
|
71801
|
+
observationItems.flatMap(
|
|
71802
|
+
({ observation }) => observation.kind === "csp" && observation.disposition === "report" ? [observation.effective_directive] : []
|
|
71803
|
+
)
|
|
71804
|
+
)
|
|
71805
|
+
).sort();
|
|
71497
71806
|
const resource = describeBrowserResource(input3.browserEvent);
|
|
71807
|
+
if (reportOnlyCspDirectives.length > 0) {
|
|
71808
|
+
const directiveLabel = reportOnlyCspDirectives.join(", ");
|
|
71809
|
+
return {
|
|
71810
|
+
likely_cause: `A report-only Content Security Policy observation (${directiveLabel}) was captured alongside this resource failure. Report-only policies do not block resource loads, so the cause and application impact remain unknown.${recoveryNote}`,
|
|
71811
|
+
confidence: 0.35,
|
|
71812
|
+
recommended_action: "Check the affected resource and routes, browser network failures, CSP and provider availability." + (resource?.optional_candidate === true ? " If the dependency is optional for your app, review a resource-scoped noise rule." : " Verify whether application functionality is affected.")
|
|
71813
|
+
};
|
|
71814
|
+
}
|
|
71498
71815
|
return {
|
|
71499
|
-
likely_cause: browserResourceDiagnosis(resource)
|
|
71816
|
+
likely_cause: `${browserResourceDiagnosis(resource)}${recoveryNote}`,
|
|
71500
71817
|
confidence: 0.35,
|
|
71501
71818
|
recommended_action: "Check the affected resource and routes, browser network failures, CSP and provider availability." + (resource?.optional_candidate === true ? " If the dependency is optional for your app, review a resource-scoped noise rule." : " Verify whether application functionality is affected.")
|
|
71502
71819
|
};
|
|
@@ -71751,7 +72068,8 @@ function buildBundle(input3) {
|
|
|
71751
72068
|
const primaryService = primarySignalEnvelope?.event_type === "probe_event" ? void 0 : primarySignalEnvelope?.service;
|
|
71752
72069
|
const serviceRuntime = primaryService?.runtime ?? input3.incident.service_runtime ?? selectLatestEnvelope(sourceEnvelopes, (envelope) => envelope.event_type !== "probe_event")?.service.runtime ?? null;
|
|
71753
72070
|
const serviceFramework = primaryService?.framework ?? input3.incident.service_framework ?? selectLatestEnvelope(sourceEnvelopes, (envelope) => envelope.event_type !== "probe_event")?.service.framework ?? null;
|
|
71754
|
-
const
|
|
72071
|
+
const hiddenOrUnloadedOpaqueResourceError = opaqueBrowserError && browserEvent?.kind === "resource_error" && (browserEvent.page?.visibility_state === "hidden" || browserEvent.page?.visibility_state === "prerender" || browserEvent.page?.visibility_state === "unloaded");
|
|
72072
|
+
const customerVisible = frontendContext !== null && !hiddenOrUnloadedOpaqueResourceError;
|
|
71755
72073
|
const firstApplicationFrame = opaqueBrowserError ? null : deriveFirstApplicationFrame(errorContext);
|
|
71756
72074
|
const summaryGuidance = buildSummaryGuidance({
|
|
71757
72075
|
errorContext,
|
|
@@ -71761,7 +72079,9 @@ function buildBundle(input3) {
|
|
|
71761
72079
|
firstApplicationFrame,
|
|
71762
72080
|
browserEvent,
|
|
71763
72081
|
opaqueBrowserError,
|
|
71764
|
-
resourceContext
|
|
72082
|
+
resourceContext,
|
|
72083
|
+
...diagnostics.resources === void 0 ? {} : { resourceObservations: diagnostics.resources },
|
|
72084
|
+
...diagnostics.recovery === void 0 ? {} : { recoveryContext: diagnostics.recovery }
|
|
71765
72085
|
});
|
|
71766
72086
|
const candidate = {
|
|
71767
72087
|
bundle_version: 1,
|
|
@@ -72695,7 +73015,7 @@ async function processCommand(input3, dependencies = {}) {
|
|
|
72695
73015
|
aggregate.newEvents.push(event);
|
|
72696
73016
|
aggregate.signalEventTypes.add(event.event_type);
|
|
72697
73017
|
const traceId = getTraceId(event);
|
|
72698
|
-
if (traceId !== null && normalizedEvent.
|
|
73018
|
+
if (traceId !== null && normalizedEvent.browser_event_kind !== "resource_error") {
|
|
72699
73019
|
aggregate.traceIds.add(traceId);
|
|
72700
73020
|
const traceKey = buildTraceCorrelationKey(projectId, event.service.environment, traceId);
|
|
72701
73021
|
const traceCorrelationGroup = traceCorrelationGroups.get(traceKey) ?? {
|
|
@@ -81329,8 +81649,8 @@ var CLI_USAGE_LINES = [
|
|
|
81329
81649
|
" debugbundle capture-rule list --project-id <id> [--auth-file <path>] [--json]",
|
|
81330
81650
|
" debugbundle capture-rule suggest <incident-id> [--auth-file <path>] [--json]",
|
|
81331
81651
|
" debugbundle capture-rule create-from-suggestion <incident-id> --suggestion-id <id> [--name <name>] [--description <text>] [--enabled <true|false>] [--expires-at <ISO8601>] [--auth-file <path>] [--json]",
|
|
81332
|
-
" debugbundle capture-rule create --project-id <id> --name <name> --action <demote|sample|drop> --matcher-json <json> [--description <text>] [--enabled <true|false>] [--sample-rate <0-1>] [--sample-event-class <preserve|context>] [--expires-at <ISO8601>] [--auth-file <path>] [--json]",
|
|
81333
|
-
" debugbundle capture-rule update <rule-id> --project-id <id> [--name <name>] [--description <text>] [--enabled <true|false>] [--action <demote|sample|drop>] [--matcher-json <json>] [--sample-rate <0-1>] [--sample-event-class <preserve|context>] [--expires-at <ISO8601|null>] [--project-scope <current_project>] [--auth-file <path>] [--json]",
|
|
81652
|
+
" debugbundle capture-rule create --project-id <id> --name <name> --action <demote|sample|drop|threshold|allow> --matcher-json <json> [--description <text>] [--enabled <true|false>] [--sample-rate <0-1>] [--sample-event-class <preserve|context>] [--threshold-count <2-1000>] [--threshold-window-seconds <60-86400>] [--threshold-group-by <resource|fingerprint>] [--expires-at <ISO8601>] [--auth-file <path>] [--json]",
|
|
81653
|
+
" debugbundle capture-rule update <rule-id> --project-id <id> [--name <name>] [--description <text>] [--enabled <true|false>] [--action <demote|sample|drop|threshold|allow>] [--matcher-json <json>] [--sample-rate <0-1>] [--sample-event-class <preserve|context>] [--threshold-count <2-1000>] [--threshold-window-seconds <60-86400>] [--threshold-group-by <resource|fingerprint>] [--expires-at <ISO8601|null>] [--project-scope <current_project>] [--auth-file <path>] [--json]",
|
|
81334
81654
|
" debugbundle capture-rule delete <rule-id> --project-id <id> [--auth-file <path>] [--json]",
|
|
81335
81655
|
" debugbundle improvements list [--project-id <id>] [--environment <name>] [--service <name>] [--status <status>] [--severity <level>] [--kind <kind>] [--cursor <cursor>] [--limit <n>] [--auth-file <path>] [--json]",
|
|
81336
81656
|
" debugbundle improvements get <improvement-id> [--auth-file <path>] [--json]",
|
|
@@ -83962,6 +84282,9 @@ function mapErrorToExitCode9(error62) {
|
|
|
83962
84282
|
return 1;
|
|
83963
84283
|
}
|
|
83964
84284
|
function formatInstallation(installation) {
|
|
84285
|
+
if (installation === null) {
|
|
84286
|
+
return "No GitHub App installation connected.";
|
|
84287
|
+
}
|
|
83965
84288
|
return [
|
|
83966
84289
|
`GitHub installation: ${installation.account_login}`,
|
|
83967
84290
|
`Installation ID: ${installation.installation_id}`,
|
|
@@ -87911,7 +88234,7 @@ function createCaptureRuleApi(httpClient) {
|
|
|
87911
88234
|
async listCaptureRules(input3) {
|
|
87912
88235
|
const response = await httpClient.request({
|
|
87913
88236
|
method: "GET",
|
|
87914
|
-
path: `/v1/projects/${encodeURIComponent(input3.projectId)}/capture-rules`,
|
|
88237
|
+
path: `/v1/projects/${encodeURIComponent(input3.projectId)}/capture-rules?rule_schema=2`,
|
|
87915
88238
|
bearerToken: input3.bearerToken
|
|
87916
88239
|
});
|
|
87917
88240
|
if (response.status !== 200) {
|
|
@@ -87942,7 +88265,7 @@ function createCaptureRuleApi(httpClient) {
|
|
|
87942
88265
|
async suggestCaptureRulesFromIncident(input3) {
|
|
87943
88266
|
const response = await httpClient.request({
|
|
87944
88267
|
method: "POST",
|
|
87945
|
-
path: `/v1/incidents/${encodeURIComponent(input3.incidentId)}/capture-rule-suggestion`,
|
|
88268
|
+
path: `/v1/incidents/${encodeURIComponent(input3.incidentId)}/capture-rule-suggestion?rule_schema=2`,
|
|
87946
88269
|
bearerToken: input3.bearerToken
|
|
87947
88270
|
});
|
|
87948
88271
|
if (response.status !== 200) {
|
|
@@ -87957,12 +88280,16 @@ function createCaptureRuleApi(httpClient) {
|
|
|
87957
88280
|
async createCaptureRuleFromIncidentSuggestion(input3) {
|
|
87958
88281
|
const response = await httpClient.request({
|
|
87959
88282
|
method: "POST",
|
|
87960
|
-
path: `/v1/incidents/${encodeURIComponent(input3.incidentId)}/capture-rules`,
|
|
88283
|
+
path: `/v1/incidents/${encodeURIComponent(input3.incidentId)}/capture-rules?rule_schema=2`,
|
|
87961
88284
|
bearerToken: input3.bearerToken,
|
|
87962
88285
|
body: input3.create
|
|
87963
88286
|
});
|
|
87964
88287
|
if (response.status !== 200 && response.status !== 201) {
|
|
87965
|
-
throw toApiError10(
|
|
88288
|
+
throw toApiError10(
|
|
88289
|
+
response.status,
|
|
88290
|
+
response.body,
|
|
88291
|
+
"Failed to create capture rule from suggestion."
|
|
88292
|
+
);
|
|
87966
88293
|
}
|
|
87967
88294
|
const parsed = CaptureRuleResponseSchema.safeParse(response.body);
|
|
87968
88295
|
if (!parsed.success) {
|
|
@@ -88034,7 +88361,11 @@ function formatMatcherFromValue(matcher) {
|
|
|
88034
88361
|
if (matcher.browser_event_opaque !== void 0) {
|
|
88035
88362
|
parts.push(`browser_event_opaque=${String(matcher.browser_event_opaque)}`);
|
|
88036
88363
|
}
|
|
88037
|
-
for (const key of [
|
|
88364
|
+
for (const key of [
|
|
88365
|
+
"browser_page_visibility_state",
|
|
88366
|
+
"browser_page_ready_state",
|
|
88367
|
+
"browser_target_tag_name"
|
|
88368
|
+
]) {
|
|
88038
88369
|
if (matcher[key] !== void 0) parts.push(`${key}=${matcher[key]}`);
|
|
88039
88370
|
}
|
|
88040
88371
|
if (matcher.browser_target_attributes !== void 0) {
|
|
@@ -88064,9 +88395,20 @@ function formatMatcherFromValue(matcher) {
|
|
|
88064
88395
|
if (matcher.resource_url?.host !== void 0) {
|
|
88065
88396
|
parts.push(`resource_host=${matcher.resource_url.host}`);
|
|
88066
88397
|
}
|
|
88398
|
+
if (matcher.resource_url?.host_suffix !== void 0) {
|
|
88399
|
+
parts.push(`resource_host_suffix=${matcher.resource_url.host_suffix}`);
|
|
88400
|
+
}
|
|
88067
88401
|
if (matcher.resource_url?.path_equals !== void 0) {
|
|
88068
88402
|
parts.push(`resource_path=${matcher.resource_url.path_equals}`);
|
|
88069
88403
|
}
|
|
88404
|
+
if (matcher.resource_url?.path_prefix !== void 0) {
|
|
88405
|
+
parts.push(`resource_path_prefix=${matcher.resource_url.path_prefix}`);
|
|
88406
|
+
}
|
|
88407
|
+
if (matcher.resource_urls !== void 0 && matcher.resource_urls.length > 0) {
|
|
88408
|
+
parts.push(
|
|
88409
|
+
`resource_urls=${matcher.resource_urls.map((entry) => `${entry.host}${entry.path_equals}`).join(",")}`
|
|
88410
|
+
);
|
|
88411
|
+
}
|
|
88070
88412
|
if (matcher.request_url?.path_equals !== void 0) {
|
|
88071
88413
|
parts.push(`request_path=${matcher.request_url.path_equals}`);
|
|
88072
88414
|
}
|
|
@@ -88082,7 +88424,7 @@ function formatMatcher(rule) {
|
|
|
88082
88424
|
return formatMatcherFromValue(rule.matcher);
|
|
88083
88425
|
}
|
|
88084
88426
|
function formatRule(rule) {
|
|
88085
|
-
const action = rule.action === "sample" ? `${rule.action}:${rule.sample_rate ?? "?"}:${rule.sample_event_class ?? "?"}` : rule.action;
|
|
88427
|
+
const action = rule.action === "sample" ? `${rule.action}:${rule.sample_rate ?? "?"}:${rule.sample_event_class ?? "?"}` : rule.action === "threshold" ? `${rule.action}:${rule.threshold_count ?? "?"}/${rule.threshold_window_seconds ?? "?"}s:${rule.threshold_group_by ?? "?"}` : rule.action;
|
|
88086
88428
|
return [
|
|
88087
88429
|
`${rule.enabled ? "enabled" : "disabled"} ${rule.id} ${action} ${rule.name}`,
|
|
88088
88430
|
formatMatcher(rule)
|
|
@@ -88788,6 +89130,9 @@ async function handleCaptureRuleCommand(parsedArgv, dependencies) {
|
|
|
88788
89130
|
"matcher-json",
|
|
88789
89131
|
"sample-rate",
|
|
88790
89132
|
"sample-event-class",
|
|
89133
|
+
"threshold-count",
|
|
89134
|
+
"threshold-window-seconds",
|
|
89135
|
+
"threshold-group-by",
|
|
88791
89136
|
"expires-at"
|
|
88792
89137
|
]);
|
|
88793
89138
|
ensureNoExtraPositionals(parsedArgv, 2);
|
|
@@ -88803,7 +89148,7 @@ async function handleCaptureRuleCommand(parsedArgv, dependencies) {
|
|
|
88803
89148
|
if (actionValue === void 0) {
|
|
88804
89149
|
throw new CliInputError("Missing required option --action.");
|
|
88805
89150
|
}
|
|
88806
|
-
if (actionValue !== "demote" && actionValue !== "sample" && actionValue !== "drop") {
|
|
89151
|
+
if (actionValue !== "demote" && actionValue !== "sample" && actionValue !== "drop" && actionValue !== "threshold" && actionValue !== "allow") {
|
|
88807
89152
|
throw new CliInputError("Invalid value for --action.");
|
|
88808
89153
|
}
|
|
88809
89154
|
const matcher = readJsonOption(parsedArgv, "matcher-json");
|
|
@@ -88821,6 +89166,9 @@ async function handleCaptureRuleCommand(parsedArgv, dependencies) {
|
|
|
88821
89166
|
matcher,
|
|
88822
89167
|
sample_rate: null,
|
|
88823
89168
|
sample_event_class: null,
|
|
89169
|
+
threshold_count: null,
|
|
89170
|
+
threshold_window_seconds: null,
|
|
89171
|
+
threshold_group_by: null,
|
|
88824
89172
|
created_by_user_id: null,
|
|
88825
89173
|
created_from_incident_id: null,
|
|
88826
89174
|
created_from_event_id: null,
|
|
@@ -88841,6 +89189,29 @@ async function handleCaptureRuleCommand(parsedArgv, dependencies) {
|
|
|
88841
89189
|
}
|
|
88842
89190
|
create.sample_event_class = sampleEventClass;
|
|
88843
89191
|
}
|
|
89192
|
+
const thresholdCount = readStringOption(parsedArgv, "threshold-count");
|
|
89193
|
+
if (thresholdCount !== void 0) {
|
|
89194
|
+
const parsed = Number(thresholdCount);
|
|
89195
|
+
if (!Number.isInteger(parsed)) {
|
|
89196
|
+
throw new CliInputError("Invalid value for --threshold-count.");
|
|
89197
|
+
}
|
|
89198
|
+
create.threshold_count = parsed;
|
|
89199
|
+
}
|
|
89200
|
+
const thresholdWindowSeconds = readStringOption(parsedArgv, "threshold-window-seconds");
|
|
89201
|
+
if (thresholdWindowSeconds !== void 0) {
|
|
89202
|
+
const parsed = Number(thresholdWindowSeconds);
|
|
89203
|
+
if (!Number.isInteger(parsed)) {
|
|
89204
|
+
throw new CliInputError("Invalid value for --threshold-window-seconds.");
|
|
89205
|
+
}
|
|
89206
|
+
create.threshold_window_seconds = parsed;
|
|
89207
|
+
}
|
|
89208
|
+
const thresholdGroupBy = readStringOption(parsedArgv, "threshold-group-by");
|
|
89209
|
+
if (thresholdGroupBy !== void 0) {
|
|
89210
|
+
if (thresholdGroupBy !== "resource" && thresholdGroupBy !== "fingerprint") {
|
|
89211
|
+
throw new CliInputError("Invalid value for --threshold-group-by.");
|
|
89212
|
+
}
|
|
89213
|
+
create.threshold_group_by = thresholdGroupBy;
|
|
89214
|
+
}
|
|
88844
89215
|
return await (dependencies.createCaptureRuleCommand ?? createCaptureRuleWithAuthCommand)(
|
|
88845
89216
|
appendCommonAuthOptions(parsedArgv, { projectId, create })
|
|
88846
89217
|
);
|
|
@@ -88857,6 +89228,9 @@ async function handleCaptureRuleCommand(parsedArgv, dependencies) {
|
|
|
88857
89228
|
"matcher-json",
|
|
88858
89229
|
"sample-rate",
|
|
88859
89230
|
"sample-event-class",
|
|
89231
|
+
"threshold-count",
|
|
89232
|
+
"threshold-window-seconds",
|
|
89233
|
+
"threshold-group-by",
|
|
88860
89234
|
"expires-at",
|
|
88861
89235
|
"project-scope"
|
|
88862
89236
|
]);
|
|
@@ -88886,7 +89260,7 @@ async function handleCaptureRuleCommand(parsedArgv, dependencies) {
|
|
|
88886
89260
|
}
|
|
88887
89261
|
const actionValue = readStringOption(parsedArgv, "action");
|
|
88888
89262
|
if (actionValue !== void 0) {
|
|
88889
|
-
if (actionValue !== "demote" && actionValue !== "sample" && actionValue !== "drop") {
|
|
89263
|
+
if (actionValue !== "demote" && actionValue !== "sample" && actionValue !== "drop" && actionValue !== "threshold" && actionValue !== "allow") {
|
|
88890
89264
|
throw new CliInputError("Invalid value for --action.");
|
|
88891
89265
|
}
|
|
88892
89266
|
update["action"] = actionValue;
|
|
@@ -88913,6 +89287,29 @@ async function handleCaptureRuleCommand(parsedArgv, dependencies) {
|
|
|
88913
89287
|
}
|
|
88914
89288
|
update["sample_event_class"] = sampleEventClass;
|
|
88915
89289
|
}
|
|
89290
|
+
const thresholdCount = readStringOption(parsedArgv, "threshold-count");
|
|
89291
|
+
if (thresholdCount !== void 0) {
|
|
89292
|
+
const parsed = Number(thresholdCount);
|
|
89293
|
+
if (!Number.isInteger(parsed)) {
|
|
89294
|
+
throw new CliInputError("Invalid value for --threshold-count.");
|
|
89295
|
+
}
|
|
89296
|
+
update["threshold_count"] = parsed;
|
|
89297
|
+
}
|
|
89298
|
+
const thresholdWindowSeconds = readStringOption(parsedArgv, "threshold-window-seconds");
|
|
89299
|
+
if (thresholdWindowSeconds !== void 0) {
|
|
89300
|
+
const parsed = Number(thresholdWindowSeconds);
|
|
89301
|
+
if (!Number.isInteger(parsed)) {
|
|
89302
|
+
throw new CliInputError("Invalid value for --threshold-window-seconds.");
|
|
89303
|
+
}
|
|
89304
|
+
update["threshold_window_seconds"] = parsed;
|
|
89305
|
+
}
|
|
89306
|
+
const thresholdGroupBy = readStringOption(parsedArgv, "threshold-group-by");
|
|
89307
|
+
if (thresholdGroupBy !== void 0) {
|
|
89308
|
+
if (thresholdGroupBy !== "resource" && thresholdGroupBy !== "fingerprint") {
|
|
89309
|
+
throw new CliInputError("Invalid value for --threshold-group-by.");
|
|
89310
|
+
}
|
|
89311
|
+
update["threshold_group_by"] = thresholdGroupBy;
|
|
89312
|
+
}
|
|
88916
89313
|
const expiresAt = readStringOption(parsedArgv, "expires-at");
|
|
88917
89314
|
if (expiresAt !== void 0) {
|
|
88918
89315
|
update["expires_at"] = expiresAt === "null" ? null : expiresAt;
|
|
@@ -90715,7 +91112,7 @@ async function handleCaptureRuleCommand2(parsedArgv, dependencies) {
|
|
|
90715
91112
|
// package.json
|
|
90716
91113
|
var package_default = {
|
|
90717
91114
|
name: "@debugbundle/cli",
|
|
90718
|
-
version: "1.
|
|
91115
|
+
version: "1.30.1",
|
|
90719
91116
|
private: false,
|
|
90720
91117
|
description: "Command-line interface for DebugBundle",
|
|
90721
91118
|
license: "Apache-2.0",
|