@debugbundle/cli 1.0.2 → 1.0.4
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 +288 -63
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -15169,8 +15169,24 @@ var BrowserExceptionEventSchema = external_exports.object({
|
|
|
15169
15169
|
column_number: external_exports.number().int().nonnegative().nullable(),
|
|
15170
15170
|
target: external_exports.object({
|
|
15171
15171
|
tag_name: external_exports.string().nullable(),
|
|
15172
|
-
source_url: external_exports.string().nullable()
|
|
15173
|
-
|
|
15172
|
+
source_url: external_exports.string().nullable(),
|
|
15173
|
+
attributes: external_exports.object({
|
|
15174
|
+
rel: external_exports.string().optional(),
|
|
15175
|
+
as: external_exports.string().optional(),
|
|
15176
|
+
type: external_exports.string().optional(),
|
|
15177
|
+
media: external_exports.string().optional(),
|
|
15178
|
+
cross_origin: external_exports.string().optional(),
|
|
15179
|
+
async: external_exports.boolean().optional(),
|
|
15180
|
+
defer: external_exports.boolean().optional(),
|
|
15181
|
+
integrity_present: external_exports.boolean().optional()
|
|
15182
|
+
}).strict().optional()
|
|
15183
|
+
}).strict().nullable(),
|
|
15184
|
+
page: external_exports.object({
|
|
15185
|
+
url: external_exports.string().nullable(),
|
|
15186
|
+
referrer: external_exports.string().nullable(),
|
|
15187
|
+
ready_state: external_exports.enum(["loading", "interactive", "complete"]).nullable(),
|
|
15188
|
+
visibility_state: external_exports.enum(["visible", "hidden", "prerender", "unloaded"]).nullable()
|
|
15189
|
+
}).strict().optional(),
|
|
15174
15190
|
opaque: external_exports.boolean()
|
|
15175
15191
|
}).strict();
|
|
15176
15192
|
var FrontendExceptionPayloadSchema = external_exports.object({
|
|
@@ -15615,10 +15631,11 @@ function buildSkill() {
|
|
|
15615
15631
|
"When the user reports a bug, runtime failure, production incident, regression, broken deploy, or unknown error, start here before reading arbitrary source files.",
|
|
15616
15632
|
"",
|
|
15617
15633
|
"1. Run `debugbundle doctor --json` to learn whether the project is local-only or connected and whether the local scaffold is healthy.",
|
|
15618
|
-
"2.
|
|
15619
|
-
"3.
|
|
15620
|
-
"4.
|
|
15621
|
-
"5.
|
|
15634
|
+
"2. If `debugbundle doctor --json` reports `mode=local-only`, start with `debugbundle incidents --source local --status open --json`.",
|
|
15635
|
+
"3. If `debugbundle doctor --json` reports `mode=connected` and the target environment is cloud-enabled, check both `debugbundle incidents --source local --status open --json` and `debugbundle incidents --source cloud --status open --json` unless the user explicitly scoped the issue to local-only development. For user-reported production incidents, check cloud incidents after local incidents and explicitly report whether each source had matches.",
|
|
15636
|
+
"4. Inspect the chosen incident with `debugbundle inspect <incident-id> --source <local|cloud> --json` and `debugbundle explain <incident-id> --source <local|cloud> --json`.",
|
|
15637
|
+
"5. Fetch evidence before editing code: `debugbundle bundle <incident-id> --source <local|cloud> --json` and `debugbundle reproduce <incident-id> --source <local|cloud> --json`.",
|
|
15638
|
+
"6. If local SDK or relay events have landed but no bundle exists yet, run `debugbundle process --preset <minimal|balanced|investigative> --json` and then list incidents again.",
|
|
15622
15639
|
"",
|
|
15623
15640
|
"Key local paths:",
|
|
15624
15641
|
"- `.debugbundle/profile.json` \u2014 project map, service paths, and validation state",
|
|
@@ -15903,7 +15920,8 @@ function buildSkillEvals() {
|
|
|
15903
15920
|
name: "connected_incident_fetch",
|
|
15904
15921
|
prompt: "The user says a production incident fired in the hosted DebugBundle project. Confirm the skill points the agent to the cloud retrieval path.",
|
|
15905
15922
|
expected_behavior: [
|
|
15906
|
-
"
|
|
15923
|
+
"Check both local and cloud incident sources when the project is connected and the environment is cloud-enabled.",
|
|
15924
|
+
"Explicitly report whether the local source, the cloud source, or both had matches.",
|
|
15907
15925
|
"Fetch inspect, context, bundle, and reproduction artifacts before editing code."
|
|
15908
15926
|
]
|
|
15909
15927
|
}
|
|
@@ -18121,6 +18139,7 @@ var STORAGE_BOOTSTRAP_STATEMENTS = [
|
|
|
18121
18139
|
channel text NOT NULL,
|
|
18122
18140
|
condition_type text NOT NULL,
|
|
18123
18141
|
severity_min text,
|
|
18142
|
+
cooldown_seconds integer NOT NULL DEFAULT 0,
|
|
18124
18143
|
config jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
18125
18144
|
is_enabled boolean NOT NULL DEFAULT true,
|
|
18126
18145
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
@@ -18159,6 +18178,7 @@ var STORAGE_BOOTSTRAP_STATEMENTS = [
|
|
|
18159
18178
|
incident_id uuid NOT NULL REFERENCES incidents(id) ON DELETE CASCADE,
|
|
18160
18179
|
condition_type text NOT NULL,
|
|
18161
18180
|
dedupe_key text NOT NULL,
|
|
18181
|
+
notification_key text NOT NULL DEFAULT '',
|
|
18162
18182
|
channel text NOT NULL,
|
|
18163
18183
|
status text NOT NULL,
|
|
18164
18184
|
payload jsonb NOT NULL,
|
|
@@ -18173,6 +18193,10 @@ var STORAGE_BOOTSTRAP_STATEMENTS = [
|
|
|
18173
18193
|
CREATE INDEX alert_deliveries_project_status_idx
|
|
18174
18194
|
ON alert_deliveries (project_id, status, created_at DESC)
|
|
18175
18195
|
`,
|
|
18196
|
+
`
|
|
18197
|
+
CREATE INDEX alert_deliveries_alert_notification_idx
|
|
18198
|
+
ON alert_deliveries (alert_id, notification_key, created_at DESC)
|
|
18199
|
+
`,
|
|
18176
18200
|
`
|
|
18177
18201
|
CREATE TABLE alert_email_digests (
|
|
18178
18202
|
id uuid PRIMARY KEY,
|
|
@@ -18205,6 +18229,7 @@ var STORAGE_BOOTSTRAP_STATEMENTS = [
|
|
|
18205
18229
|
incident_id uuid NOT NULL REFERENCES incidents(id) ON DELETE CASCADE,
|
|
18206
18230
|
condition_type text NOT NULL,
|
|
18207
18231
|
dedupe_key text NOT NULL,
|
|
18232
|
+
notification_key text NOT NULL DEFAULT '',
|
|
18208
18233
|
payload jsonb NOT NULL,
|
|
18209
18234
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
18210
18235
|
UNIQUE (alert_id, incident_id, dedupe_key)
|
|
@@ -18214,6 +18239,10 @@ var STORAGE_BOOTSTRAP_STATEMENTS = [
|
|
|
18214
18239
|
CREATE INDEX alert_email_digest_items_digest_created_idx
|
|
18215
18240
|
ON alert_email_digest_items (digest_id, created_at ASC)
|
|
18216
18241
|
`,
|
|
18242
|
+
`
|
|
18243
|
+
CREATE INDEX alert_email_digest_items_alert_notification_idx
|
|
18244
|
+
ON alert_email_digest_items (alert_id, notification_key, created_at DESC)
|
|
18245
|
+
`,
|
|
18217
18246
|
`
|
|
18218
18247
|
CREATE TABLE agent_webhooks (
|
|
18219
18248
|
id uuid PRIMARY KEY,
|
|
@@ -18265,6 +18294,19 @@ var STORAGE_BOOTSTRAP_STATEMENTS = [
|
|
|
18265
18294
|
processed_at timestamptz NOT NULL DEFAULT now()
|
|
18266
18295
|
)
|
|
18267
18296
|
`,
|
|
18297
|
+
`
|
|
18298
|
+
CREATE TABLE processed_github_marketplace_events (
|
|
18299
|
+
delivery_id text PRIMARY KEY,
|
|
18300
|
+
event_name text NOT NULL,
|
|
18301
|
+
marketplace_account_id bigint,
|
|
18302
|
+
action text,
|
|
18303
|
+
processed_at timestamptz NOT NULL DEFAULT now()
|
|
18304
|
+
)
|
|
18305
|
+
`,
|
|
18306
|
+
`
|
|
18307
|
+
CREATE INDEX processed_github_marketplace_events_account_idx
|
|
18308
|
+
ON processed_github_marketplace_events (marketplace_account_id, processed_at DESC)
|
|
18309
|
+
`,
|
|
18268
18310
|
`
|
|
18269
18311
|
CREATE TABLE github_installations (
|
|
18270
18312
|
id uuid PRIMARY KEY,
|
|
@@ -18282,6 +18324,41 @@ var STORAGE_BOOTSTRAP_STATEMENTS = [
|
|
|
18282
18324
|
CREATE INDEX github_installations_status_idx
|
|
18283
18325
|
ON github_installations (status)
|
|
18284
18326
|
`,
|
|
18327
|
+
`
|
|
18328
|
+
CREATE TABLE github_marketplace_accounts (
|
|
18329
|
+
id uuid PRIMARY KEY,
|
|
18330
|
+
organization_id uuid REFERENCES organizations(id) ON DELETE SET NULL,
|
|
18331
|
+
marketplace_account_id bigint NOT NULL UNIQUE,
|
|
18332
|
+
marketplace_account_login text NOT NULL,
|
|
18333
|
+
marketplace_account_type text NOT NULL CHECK (marketplace_account_type IN ('Organization', 'User')),
|
|
18334
|
+
marketplace_account_node_id text,
|
|
18335
|
+
marketplace_listing_plan_id bigint NOT NULL,
|
|
18336
|
+
marketplace_listing_plan_name text NOT NULL,
|
|
18337
|
+
marketplace_plan_price_model text,
|
|
18338
|
+
billing_cycle text CHECK (billing_cycle IN ('monthly', 'yearly')),
|
|
18339
|
+
unit_count integer,
|
|
18340
|
+
on_free_trial boolean NOT NULL DEFAULT false,
|
|
18341
|
+
free_trial_ends_on timestamptz,
|
|
18342
|
+
next_billing_date timestamptz,
|
|
18343
|
+
effective_date timestamptz NOT NULL,
|
|
18344
|
+
installation_id bigint,
|
|
18345
|
+
marketplace_purchase_status text NOT NULL
|
|
18346
|
+
CHECK (marketplace_purchase_status IN ('purchased', 'cancelled', 'pending_change', 'pending_change_cancelled', 'changed')),
|
|
18347
|
+
last_event_id text NOT NULL,
|
|
18348
|
+
last_event_action text NOT NULL,
|
|
18349
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
18350
|
+
updated_at timestamptz NOT NULL DEFAULT now()
|
|
18351
|
+
)
|
|
18352
|
+
`,
|
|
18353
|
+
`
|
|
18354
|
+
CREATE INDEX github_marketplace_accounts_org_idx
|
|
18355
|
+
ON github_marketplace_accounts (organization_id, updated_at DESC)
|
|
18356
|
+
`,
|
|
18357
|
+
`
|
|
18358
|
+
CREATE UNIQUE INDEX github_marketplace_accounts_installation_idx
|
|
18359
|
+
ON github_marketplace_accounts (installation_id)
|
|
18360
|
+
WHERE installation_id IS NOT NULL
|
|
18361
|
+
`,
|
|
18285
18362
|
`
|
|
18286
18363
|
CREATE TABLE project_github_repos (
|
|
18287
18364
|
id uuid PRIMARY KEY,
|
|
@@ -18881,6 +18958,86 @@ var STORAGE_SCHEMA_MIGRATIONS = [
|
|
|
18881
18958
|
ON capture_rules (project_id, updated_at DESC)
|
|
18882
18959
|
`
|
|
18883
18960
|
]
|
|
18961
|
+
}),
|
|
18962
|
+
defineStorageSchemaMigration({
|
|
18963
|
+
id: "202606020001_add_github_marketplace_tracking",
|
|
18964
|
+
description: "Add GitHub Marketplace purchase tracking tables and webhook idempotency ledger.",
|
|
18965
|
+
statements: [
|
|
18966
|
+
`
|
|
18967
|
+
CREATE TABLE IF NOT EXISTS processed_github_marketplace_events (
|
|
18968
|
+
delivery_id text PRIMARY KEY,
|
|
18969
|
+
event_name text NOT NULL,
|
|
18970
|
+
marketplace_account_id bigint,
|
|
18971
|
+
action text,
|
|
18972
|
+
processed_at timestamptz NOT NULL DEFAULT now()
|
|
18973
|
+
)
|
|
18974
|
+
`,
|
|
18975
|
+
`
|
|
18976
|
+
CREATE INDEX IF NOT EXISTS processed_github_marketplace_events_account_idx
|
|
18977
|
+
ON processed_github_marketplace_events (marketplace_account_id, processed_at DESC)
|
|
18978
|
+
`,
|
|
18979
|
+
`
|
|
18980
|
+
CREATE TABLE IF NOT EXISTS github_marketplace_accounts (
|
|
18981
|
+
id uuid PRIMARY KEY,
|
|
18982
|
+
organization_id uuid REFERENCES organizations(id) ON DELETE SET NULL,
|
|
18983
|
+
marketplace_account_id bigint NOT NULL UNIQUE,
|
|
18984
|
+
marketplace_account_login text NOT NULL,
|
|
18985
|
+
marketplace_account_type text NOT NULL CHECK (marketplace_account_type IN ('Organization', 'User')),
|
|
18986
|
+
marketplace_account_node_id text,
|
|
18987
|
+
marketplace_listing_plan_id bigint NOT NULL,
|
|
18988
|
+
marketplace_listing_plan_name text NOT NULL,
|
|
18989
|
+
marketplace_plan_price_model text,
|
|
18990
|
+
billing_cycle text CHECK (billing_cycle IN ('monthly', 'yearly')),
|
|
18991
|
+
unit_count integer,
|
|
18992
|
+
on_free_trial boolean NOT NULL DEFAULT false,
|
|
18993
|
+
free_trial_ends_on timestamptz,
|
|
18994
|
+
next_billing_date timestamptz,
|
|
18995
|
+
effective_date timestamptz NOT NULL,
|
|
18996
|
+
installation_id bigint,
|
|
18997
|
+
marketplace_purchase_status text NOT NULL
|
|
18998
|
+
CHECK (marketplace_purchase_status IN ('purchased', 'cancelled', 'pending_change', 'pending_change_cancelled', 'changed')),
|
|
18999
|
+
last_event_id text NOT NULL,
|
|
19000
|
+
last_event_action text NOT NULL,
|
|
19001
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
19002
|
+
updated_at timestamptz NOT NULL DEFAULT now()
|
|
19003
|
+
)
|
|
19004
|
+
`,
|
|
19005
|
+
`
|
|
19006
|
+
CREATE INDEX IF NOT EXISTS github_marketplace_accounts_org_idx
|
|
19007
|
+
ON github_marketplace_accounts (organization_id, updated_at DESC)
|
|
19008
|
+
`,
|
|
19009
|
+
`
|
|
19010
|
+
CREATE UNIQUE INDEX IF NOT EXISTS github_marketplace_accounts_installation_idx
|
|
19011
|
+
ON github_marketplace_accounts (installation_id)
|
|
19012
|
+
WHERE installation_id IS NOT NULL
|
|
19013
|
+
`
|
|
19014
|
+
]
|
|
19015
|
+
}),
|
|
19016
|
+
defineStorageSchemaMigration({
|
|
19017
|
+
id: "202606030001_add_alert_notification_cooldowns_and_rule_window",
|
|
19018
|
+
description: "Add configurable alert cooldown windows and notification keys for cross-incident suppression.",
|
|
19019
|
+
statements: [
|
|
19020
|
+
"ALTER TABLE alert_rules ADD COLUMN IF NOT EXISTS cooldown_seconds integer",
|
|
19021
|
+
"UPDATE alert_rules SET cooldown_seconds = 0 WHERE cooldown_seconds IS NULL",
|
|
19022
|
+
"ALTER TABLE alert_rules ALTER COLUMN cooldown_seconds SET DEFAULT 0",
|
|
19023
|
+
"ALTER TABLE alert_rules ALTER COLUMN cooldown_seconds SET NOT NULL",
|
|
19024
|
+
"ALTER TABLE alert_deliveries ADD COLUMN IF NOT EXISTS notification_key text",
|
|
19025
|
+
"UPDATE alert_deliveries SET notification_key = dedupe_key WHERE notification_key IS NULL",
|
|
19026
|
+
"ALTER TABLE alert_deliveries ALTER COLUMN notification_key SET DEFAULT ''",
|
|
19027
|
+
"ALTER TABLE alert_deliveries ALTER COLUMN notification_key SET NOT NULL",
|
|
19028
|
+
`
|
|
19029
|
+
CREATE INDEX IF NOT EXISTS alert_deliveries_alert_notification_idx
|
|
19030
|
+
ON alert_deliveries (alert_id, notification_key, created_at DESC)
|
|
19031
|
+
`,
|
|
19032
|
+
"ALTER TABLE alert_email_digest_items ADD COLUMN IF NOT EXISTS notification_key text",
|
|
19033
|
+
"UPDATE alert_email_digest_items SET notification_key = dedupe_key WHERE notification_key IS NULL",
|
|
19034
|
+
"ALTER TABLE alert_email_digest_items ALTER COLUMN notification_key SET DEFAULT ''",
|
|
19035
|
+
"ALTER TABLE alert_email_digest_items ALTER COLUMN notification_key SET NOT NULL",
|
|
19036
|
+
`
|
|
19037
|
+
CREATE INDEX IF NOT EXISTS alert_email_digest_items_alert_notification_idx
|
|
19038
|
+
ON alert_email_digest_items (alert_id, notification_key, created_at DESC)
|
|
19039
|
+
`
|
|
19040
|
+
]
|
|
18884
19041
|
})
|
|
18885
19042
|
];
|
|
18886
19043
|
|
|
@@ -20002,6 +20159,7 @@ var AlertSchema = external_exports.object({
|
|
|
20002
20159
|
channel: AlertChannelSchema,
|
|
20003
20160
|
condition_type: AlertConditionTypeSchema,
|
|
20004
20161
|
severity_min: external_exports.enum(["low", "medium", "high", "critical"]).nullable(),
|
|
20162
|
+
cooldown_seconds: external_exports.number().int().min(0),
|
|
20005
20163
|
config: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
20006
20164
|
is_enabled: external_exports.boolean(),
|
|
20007
20165
|
created_at: external_exports.string(),
|
|
@@ -20088,6 +20246,9 @@ function createAlertApi(client) {
|
|
|
20088
20246
|
if (input2.severityMin !== void 0) {
|
|
20089
20247
|
body.severity_min = input2.severityMin;
|
|
20090
20248
|
}
|
|
20249
|
+
if (input2.cooldownSeconds !== void 0) {
|
|
20250
|
+
body.cooldown_seconds = input2.cooldownSeconds;
|
|
20251
|
+
}
|
|
20091
20252
|
if (input2.isEnabled !== void 0) {
|
|
20092
20253
|
body.is_enabled = input2.isEnabled;
|
|
20093
20254
|
}
|
|
@@ -20114,6 +20275,9 @@ function createAlertApi(client) {
|
|
|
20114
20275
|
if (input2.severityMin !== void 0) {
|
|
20115
20276
|
body.severity_min = input2.severityMin;
|
|
20116
20277
|
}
|
|
20278
|
+
if (input2.cooldownSeconds !== void 0) {
|
|
20279
|
+
body.cooldown_seconds = input2.cooldownSeconds;
|
|
20280
|
+
}
|
|
20117
20281
|
if (input2.config !== void 0) {
|
|
20118
20282
|
body.config = input2.config;
|
|
20119
20283
|
}
|
|
@@ -23262,7 +23426,8 @@ function normalizeRouteTemplate(path) {
|
|
|
23262
23426
|
return normalizedSegments.length === 0 ? "/" : `/${normalizedSegments.join("/")}`;
|
|
23263
23427
|
}
|
|
23264
23428
|
function isBrowserSdkFallbackFrame(frame) {
|
|
23265
|
-
|
|
23429
|
+
const normalizedFrame = frame.toLowerCase();
|
|
23430
|
+
return normalizedFrame.includes("onerror") && (normalizedFrame.includes("debugbundle-browser-sdk") || normalizedFrame.includes("debugbundle-browser.js") || normalizedFrame.includes("wp-content/plugins/debugbundle/"));
|
|
23266
23431
|
}
|
|
23267
23432
|
function deriveFirstApplicationFrame(errorContext) {
|
|
23268
23433
|
const firstFrame = errorContext?.top_frames[0];
|
|
@@ -23307,6 +23472,20 @@ function isOpaqueBrowserError(errorContext, browserEvent) {
|
|
|
23307
23472
|
const firstFrame = errorContext?.top_frames[0];
|
|
23308
23473
|
return errorContext?.message === "Window error" && firstFrame !== void 0 && isBrowserSdkFallbackFrame(firstFrame);
|
|
23309
23474
|
}
|
|
23475
|
+
function stableJson2(value) {
|
|
23476
|
+
if (value === null || typeof value !== "object") {
|
|
23477
|
+
return JSON.stringify(value);
|
|
23478
|
+
}
|
|
23479
|
+
if (Array.isArray(value)) {
|
|
23480
|
+
return `[${value.map((entry) => stableJson2(entry)).join(",")}]`;
|
|
23481
|
+
}
|
|
23482
|
+
const record = value;
|
|
23483
|
+
const keys = Object.keys(record).sort();
|
|
23484
|
+
return `{${keys.map((key) => `${JSON.stringify(key)}:${stableJson2(record[key])}`).join(",")}}`;
|
|
23485
|
+
}
|
|
23486
|
+
function buildFrontendBreadcrumbKey(input2) {
|
|
23487
|
+
return `${input2.breadcrumb_type}:${input2.ts}:${input2.route ?? ""}:${stableJson2(input2.data)}`;
|
|
23488
|
+
}
|
|
23310
23489
|
function buildErrorContext(envelopes, incident, primarySignalEnvelope) {
|
|
23311
23490
|
if (primarySignalEnvelope !== null && isBackendExceptionEnvelope(primarySignalEnvelope)) {
|
|
23312
23491
|
return {
|
|
@@ -23568,6 +23747,7 @@ function buildLogsContext(envelopes) {
|
|
|
23568
23747
|
};
|
|
23569
23748
|
}
|
|
23570
23749
|
function buildFrontendContext(envelopes) {
|
|
23750
|
+
const breadcrumbs = /* @__PURE__ */ new Map();
|
|
23571
23751
|
const routeChanges = [];
|
|
23572
23752
|
const clicks = [];
|
|
23573
23753
|
const formSubmissions = [];
|
|
@@ -23576,54 +23756,24 @@ function buildFrontendContext(envelopes) {
|
|
|
23576
23756
|
const exceptions = [];
|
|
23577
23757
|
for (const envelope of envelopes) {
|
|
23578
23758
|
if (isFrontendBreadcrumbEnvelope(envelope)) {
|
|
23579
|
-
const
|
|
23580
|
-
|
|
23581
|
-
|
|
23582
|
-
|
|
23583
|
-
|
|
23584
|
-
}
|
|
23585
|
-
|
|
23586
|
-
|
|
23587
|
-
|
|
23588
|
-
|
|
23589
|
-
ts: timestamp
|
|
23590
|
-
});
|
|
23591
|
-
}
|
|
23592
|
-
if (envelope.payload.breadcrumb_type === "form_submit") {
|
|
23593
|
-
formSubmissions.push({
|
|
23594
|
-
form: typeof envelope.payload.data["form"] === "string" ? envelope.payload.data["form"] : "unknown",
|
|
23595
|
-
fields: envelope.payload.data["fields"] !== null && typeof envelope.payload.data["fields"] === "object" ? envelope.payload.data["fields"] : {},
|
|
23596
|
-
ts: timestamp
|
|
23597
|
-
});
|
|
23598
|
-
}
|
|
23599
|
-
if (envelope.payload.breadcrumb_type === "console_log") {
|
|
23600
|
-
consoleLogs.push({
|
|
23601
|
-
ts: timestamp,
|
|
23602
|
-
...envelope.payload.data
|
|
23603
|
-
});
|
|
23604
|
-
}
|
|
23605
|
-
if (envelope.payload.breadcrumb_type === "network_request") {
|
|
23606
|
-
const d = envelope.payload.data;
|
|
23759
|
+
const entry = {
|
|
23760
|
+
breadcrumb_type: envelope.payload.breadcrumb_type,
|
|
23761
|
+
route: envelope.payload.route,
|
|
23762
|
+
data: envelope.payload.data,
|
|
23763
|
+
ts: toIsoTimestamp(envelope.occurred_at)
|
|
23764
|
+
};
|
|
23765
|
+
breadcrumbs.set(buildFrontendBreadcrumbKey(entry), entry);
|
|
23766
|
+
}
|
|
23767
|
+
if (isFrontendExceptionEnvelope(envelope)) {
|
|
23768
|
+
for (const breadcrumb of envelope.payload.breadcrumbs ?? []) {
|
|
23607
23769
|
const entry = {
|
|
23608
|
-
|
|
23609
|
-
|
|
23610
|
-
|
|
23611
|
-
ts:
|
|
23770
|
+
breadcrumb_type: breadcrumb.breadcrumb_type,
|
|
23771
|
+
route: breadcrumb.route,
|
|
23772
|
+
data: breadcrumb.data,
|
|
23773
|
+
ts: toIsoTimestamp(breadcrumb.ts)
|
|
23612
23774
|
};
|
|
23613
|
-
|
|
23614
|
-
if (Array.isArray(d["caller_trace"])) entry.caller_trace = d["caller_trace"];
|
|
23615
|
-
if (d["response_body"] !== void 0) entry.response_body = d["response_body"];
|
|
23616
|
-
if (d["request_body"] !== void 0) entry.request_body = d["request_body"];
|
|
23617
|
-
if (typeof d["response_headers"] === "object" && d["response_headers"] !== null) {
|
|
23618
|
-
entry.response_headers = d["response_headers"];
|
|
23619
|
-
}
|
|
23620
|
-
if (typeof d["response_content_length"] === "number") {
|
|
23621
|
-
entry.response_content_length = d["response_content_length"];
|
|
23622
|
-
}
|
|
23623
|
-
networkRequests.push(entry);
|
|
23775
|
+
breadcrumbs.set(buildFrontendBreadcrumbKey(entry), entry);
|
|
23624
23776
|
}
|
|
23625
|
-
}
|
|
23626
|
-
if (isFrontendExceptionEnvelope(envelope)) {
|
|
23627
23777
|
exceptions.push({
|
|
23628
23778
|
name: envelope.payload.name,
|
|
23629
23779
|
message: envelope.payload.message,
|
|
@@ -23634,6 +23784,59 @@ function buildFrontendContext(envelopes) {
|
|
|
23634
23784
|
});
|
|
23635
23785
|
}
|
|
23636
23786
|
}
|
|
23787
|
+
const sortedBreadcrumbs = [...breadcrumbs.values()].sort((left, right) => {
|
|
23788
|
+
const timestampComparison = left.ts.localeCompare(right.ts);
|
|
23789
|
+
if (timestampComparison !== 0) {
|
|
23790
|
+
return timestampComparison;
|
|
23791
|
+
}
|
|
23792
|
+
return buildFrontendBreadcrumbKey(left).localeCompare(buildFrontendBreadcrumbKey(right));
|
|
23793
|
+
});
|
|
23794
|
+
for (const breadcrumb of sortedBreadcrumbs) {
|
|
23795
|
+
if (breadcrumb.breadcrumb_type === "route_change") {
|
|
23796
|
+
const from = typeof breadcrumb.data["from"] === "string" ? breadcrumb.data["from"] : "unknown";
|
|
23797
|
+
const to = typeof breadcrumb.data["to"] === "string" ? breadcrumb.data["to"] : breadcrumb.route ?? "unknown";
|
|
23798
|
+
routeChanges.push({ from, to, ts: breadcrumb.ts });
|
|
23799
|
+
}
|
|
23800
|
+
if (breadcrumb.breadcrumb_type === "click") {
|
|
23801
|
+
clicks.push({
|
|
23802
|
+
selector: typeof breadcrumb.data["selector"] === "string" ? breadcrumb.data["selector"] : "unknown",
|
|
23803
|
+
label: typeof breadcrumb.data["label"] === "string" ? breadcrumb.data["label"] : "unknown",
|
|
23804
|
+
ts: breadcrumb.ts
|
|
23805
|
+
});
|
|
23806
|
+
}
|
|
23807
|
+
if (breadcrumb.breadcrumb_type === "form_submit") {
|
|
23808
|
+
formSubmissions.push({
|
|
23809
|
+
form: typeof breadcrumb.data["form"] === "string" ? breadcrumb.data["form"] : "unknown",
|
|
23810
|
+
fields: breadcrumb.data["fields"] !== null && typeof breadcrumb.data["fields"] === "object" ? breadcrumb.data["fields"] : {},
|
|
23811
|
+
ts: breadcrumb.ts
|
|
23812
|
+
});
|
|
23813
|
+
}
|
|
23814
|
+
if (breadcrumb.breadcrumb_type === "console_log") {
|
|
23815
|
+
consoleLogs.push({
|
|
23816
|
+
ts: breadcrumb.ts,
|
|
23817
|
+
...breadcrumb.data
|
|
23818
|
+
});
|
|
23819
|
+
}
|
|
23820
|
+
if (breadcrumb.breadcrumb_type === "network_request") {
|
|
23821
|
+
const entry = {
|
|
23822
|
+
method: typeof breadcrumb.data["method"] === "string" ? breadcrumb.data["method"] : "GET",
|
|
23823
|
+
url: typeof breadcrumb.data["url"] === "string" ? breadcrumb.data["url"] : "unknown",
|
|
23824
|
+
status: typeof breadcrumb.data["status_code"] === "number" && Number.isInteger(breadcrumb.data["status_code"]) ? breadcrumb.data["status_code"] : typeof breadcrumb.data["status"] === "number" && Number.isInteger(breadcrumb.data["status"]) ? breadcrumb.data["status"] : 0,
|
|
23825
|
+
ts: breadcrumb.ts
|
|
23826
|
+
};
|
|
23827
|
+
if (typeof breadcrumb.data["duration_ms"] === "number") entry.duration_ms = breadcrumb.data["duration_ms"];
|
|
23828
|
+
if (Array.isArray(breadcrumb.data["caller_trace"])) entry.caller_trace = breadcrumb.data["caller_trace"];
|
|
23829
|
+
if (breadcrumb.data["response_body"] !== void 0) entry.response_body = breadcrumb.data["response_body"];
|
|
23830
|
+
if (breadcrumb.data["request_body"] !== void 0) entry.request_body = breadcrumb.data["request_body"];
|
|
23831
|
+
if (typeof breadcrumb.data["response_headers"] === "object" && breadcrumb.data["response_headers"] !== null) {
|
|
23832
|
+
entry.response_headers = breadcrumb.data["response_headers"];
|
|
23833
|
+
}
|
|
23834
|
+
if (typeof breadcrumb.data["response_content_length"] === "number") {
|
|
23835
|
+
entry.response_content_length = breadcrumb.data["response_content_length"];
|
|
23836
|
+
}
|
|
23837
|
+
networkRequests.push(entry);
|
|
23838
|
+
}
|
|
23839
|
+
}
|
|
23637
23840
|
const latestFrontendException = selectLatestEnvelopeByType(envelopes, isFrontendExceptionEnvelope);
|
|
23638
23841
|
const domContext = latestFrontendException?.payload.dom_context ?? null;
|
|
23639
23842
|
if (routeChanges.length === 0 && clicks.length === 0 && formSubmissions.length === 0 && consoleLogs.length === 0 && networkRequests.length === 0 && exceptions.length === 0 && domContext === null) {
|
|
@@ -23783,7 +23986,7 @@ function buildBundle(input2) {
|
|
|
23783
23986
|
const serviceRuntime = input2.incident.service_runtime ?? selectLatestEnvelope(sourceEnvelopes, (envelope) => envelope.event_type !== "probe_event")?.service.runtime ?? null;
|
|
23784
23987
|
const serviceFramework = input2.incident.service_framework ?? selectLatestEnvelope(sourceEnvelopes, (envelope) => envelope.event_type !== "probe_event")?.service.framework ?? null;
|
|
23785
23988
|
const customerVisible = frontendContext !== null;
|
|
23786
|
-
const firstApplicationFrame = deriveFirstApplicationFrame(errorContext);
|
|
23989
|
+
const firstApplicationFrame = opaqueBrowserError ? null : deriveFirstApplicationFrame(errorContext);
|
|
23787
23990
|
const summaryGuidance = buildSummaryGuidance({
|
|
23788
23991
|
errorContext,
|
|
23789
23992
|
requestContext,
|
|
@@ -24304,20 +24507,20 @@ function mergeSourceEvents(existingEvents, nextEvents) {
|
|
|
24304
24507
|
}
|
|
24305
24508
|
return [...merged.values()].sort(compareEventEnvelopes);
|
|
24306
24509
|
}
|
|
24307
|
-
function
|
|
24510
|
+
function stableJson3(value) {
|
|
24308
24511
|
if (value === null || typeof value !== "object") {
|
|
24309
24512
|
return JSON.stringify(value);
|
|
24310
24513
|
}
|
|
24311
24514
|
if (Array.isArray(value)) {
|
|
24312
|
-
return `[${value.map((entry) =>
|
|
24515
|
+
return `[${value.map((entry) => stableJson3(entry)).join(",")}]`;
|
|
24313
24516
|
}
|
|
24314
24517
|
const record = value;
|
|
24315
24518
|
const keys = Object.keys(record).sort();
|
|
24316
|
-
return `{${keys.map((key) => `${JSON.stringify(key)}:${
|
|
24519
|
+
return `{${keys.map((key) => `${JSON.stringify(key)}:${stableJson3(record[key])}`).join(",")}}`;
|
|
24317
24520
|
}
|
|
24318
24521
|
function buildRequestAnomalyFingerprint(input2) {
|
|
24319
24522
|
return (0, import_node_crypto4.createHash)("sha256").update(
|
|
24320
|
-
|
|
24523
|
+
stableJson3({
|
|
24321
24524
|
kind: "request_status_anomaly",
|
|
24322
24525
|
project_id: input2.projectId,
|
|
24323
24526
|
service_name: input2.serviceName,
|
|
@@ -28279,8 +28482,8 @@ var CLI_USAGE_LINES = [
|
|
|
28279
28482
|
" debugbundle token member create --label <label> [--auth-file <path>] [--json]",
|
|
28280
28483
|
" debugbundle token member revoke <token-id> [--auth-file <path>] [--json]",
|
|
28281
28484
|
" debugbundle alert list --project-id <id> [--limit <n>] [--auth-file <path>] [--json]",
|
|
28282
|
-
" debugbundle alert create --project-id <id> --channel <channel> --condition <condition> [--service-id <id>] [--severity-min <level>] --config-json <json> [--is-enabled <true|false>] [--auth-file <path>] [--json]",
|
|
28283
|
-
" debugbundle alert update <alert-id> --project-id <id> [--service-id <id|null>] [--channel <channel>] [--condition <condition>] [--severity-min <level|null>] [--config-json <json|null>] [--is-enabled <true|false>] [--auth-file <path>] [--json]",
|
|
28485
|
+
" debugbundle alert create --project-id <id> --channel <channel> --condition <condition> [--service-id <id>] [--severity-min <level>] [--cooldown <seconds>] --config-json <json> [--is-enabled <true|false>] [--auth-file <path>] [--json]",
|
|
28486
|
+
" debugbundle alert update <alert-id> --project-id <id> [--service-id <id|null>] [--channel <channel>] [--condition <condition>] [--severity-min <level|null>] [--cooldown <seconds>] [--config-json <json|null>] [--is-enabled <true|false>] [--auth-file <path>] [--json]",
|
|
28284
28487
|
" debugbundle alert delete <alert-id> --project-id <id> [--auth-file <path>] [--json]",
|
|
28285
28488
|
" debugbundle slack list --project-id <id> [--auth-file <path>] [--json]",
|
|
28286
28489
|
" debugbundle slack connect-url --project-id <id> [--return-to </projects/...>] [--auth-file <path>] [--json]",
|
|
@@ -28819,7 +29022,7 @@ function formatAlertTable(alerts) {
|
|
|
28819
29022
|
return "No alerts found.";
|
|
28820
29023
|
}
|
|
28821
29024
|
return alerts.map(
|
|
28822
|
-
(alert) => `${alert.alert_id} | ${alert.is_enabled ? "enabled" : "disabled"} | ${alert.condition_type} | ${alert.channel} | project=${alert.project_id}`
|
|
29025
|
+
(alert) => `${alert.alert_id} | ${alert.is_enabled ? "enabled" : "disabled"} | ${alert.condition_type} | ${alert.channel} | cooldown=${alert.cooldown_seconds}s | project=${alert.project_id}`
|
|
28823
29026
|
).join("\n");
|
|
28824
29027
|
}
|
|
28825
29028
|
async function listAlertsCommand(input2, api) {
|
|
@@ -28876,6 +29079,9 @@ async function createAlertCommand(input2, api) {
|
|
|
28876
29079
|
if (input2.severityMin !== void 0) {
|
|
28877
29080
|
requestInput.severityMin = input2.severityMin;
|
|
28878
29081
|
}
|
|
29082
|
+
if (input2.cooldownSeconds !== void 0) {
|
|
29083
|
+
requestInput.cooldownSeconds = input2.cooldownSeconds;
|
|
29084
|
+
}
|
|
28879
29085
|
if (input2.isEnabled !== void 0) {
|
|
28880
29086
|
requestInput.isEnabled = input2.isEnabled;
|
|
28881
29087
|
}
|
|
@@ -28906,6 +29112,9 @@ async function createAlertWithAuthCommand(input2, dependencies) {
|
|
|
28906
29112
|
if (input2.severityMin !== void 0) {
|
|
28907
29113
|
commandInput.severityMin = input2.severityMin;
|
|
28908
29114
|
}
|
|
29115
|
+
if (input2.cooldownSeconds !== void 0) {
|
|
29116
|
+
commandInput.cooldownSeconds = input2.cooldownSeconds;
|
|
29117
|
+
}
|
|
28909
29118
|
if (input2.isEnabled !== void 0) {
|
|
28910
29119
|
commandInput.isEnabled = input2.isEnabled;
|
|
28911
29120
|
}
|
|
@@ -28937,6 +29146,9 @@ async function updateAlertCommand(input2, api) {
|
|
|
28937
29146
|
if (input2.severityMin !== void 0) {
|
|
28938
29147
|
requestInput.severityMin = input2.severityMin;
|
|
28939
29148
|
}
|
|
29149
|
+
if (input2.cooldownSeconds !== void 0) {
|
|
29150
|
+
requestInput.cooldownSeconds = input2.cooldownSeconds;
|
|
29151
|
+
}
|
|
28940
29152
|
if (input2.config !== void 0) {
|
|
28941
29153
|
requestInput.config = input2.config;
|
|
28942
29154
|
}
|
|
@@ -28974,6 +29186,9 @@ async function updateAlertWithAuthCommand(input2, dependencies) {
|
|
|
28974
29186
|
if (input2.severityMin !== void 0) {
|
|
28975
29187
|
commandInput.severityMin = input2.severityMin;
|
|
28976
29188
|
}
|
|
29189
|
+
if (input2.cooldownSeconds !== void 0) {
|
|
29190
|
+
commandInput.cooldownSeconds = input2.cooldownSeconds;
|
|
29191
|
+
}
|
|
28977
29192
|
if (input2.config !== void 0) {
|
|
28978
29193
|
commandInput.config = input2.config;
|
|
28979
29194
|
}
|
|
@@ -33391,6 +33606,7 @@ async function handleAlertCommand(parsedArgv, dependencies) {
|
|
|
33391
33606
|
"channel",
|
|
33392
33607
|
"condition",
|
|
33393
33608
|
"severity-min",
|
|
33609
|
+
"cooldown",
|
|
33394
33610
|
"config-json",
|
|
33395
33611
|
"is-enabled"
|
|
33396
33612
|
]);
|
|
@@ -33420,6 +33636,10 @@ async function handleAlertCommand(parsedArgv, dependencies) {
|
|
|
33420
33636
|
if (severityMin !== void 0) {
|
|
33421
33637
|
input2.severityMin = severityMin;
|
|
33422
33638
|
}
|
|
33639
|
+
const cooldownSeconds = readIntegerOption(parsedArgv, "cooldown");
|
|
33640
|
+
if (cooldownSeconds !== void 0) {
|
|
33641
|
+
input2.cooldownSeconds = cooldownSeconds;
|
|
33642
|
+
}
|
|
33423
33643
|
const config = readJsonOption(parsedArgv, "config-json");
|
|
33424
33644
|
if (config === void 0 || typeof config !== "object" || config === null) {
|
|
33425
33645
|
throw new CliInputError("Missing required option --config-json.");
|
|
@@ -33440,6 +33660,7 @@ async function handleAlertCommand(parsedArgv, dependencies) {
|
|
|
33440
33660
|
"channel",
|
|
33441
33661
|
"condition",
|
|
33442
33662
|
"severity-min",
|
|
33663
|
+
"cooldown",
|
|
33443
33664
|
"config-json",
|
|
33444
33665
|
"is-enabled"
|
|
33445
33666
|
]);
|
|
@@ -33468,6 +33689,10 @@ async function handleAlertCommand(parsedArgv, dependencies) {
|
|
|
33468
33689
|
if (severityMin !== void 0) {
|
|
33469
33690
|
input2.severityMin = severityMin === "null" ? null : severityMin;
|
|
33470
33691
|
}
|
|
33692
|
+
const cooldownSeconds = readIntegerOption(parsedArgv, "cooldown");
|
|
33693
|
+
if (cooldownSeconds !== void 0) {
|
|
33694
|
+
input2.cooldownSeconds = cooldownSeconds;
|
|
33695
|
+
}
|
|
33471
33696
|
const config = readJsonOption(parsedArgv, "config-json");
|
|
33472
33697
|
if (config !== void 0) {
|
|
33473
33698
|
input2.config = config;
|
|
@@ -33476,7 +33701,7 @@ async function handleAlertCommand(parsedArgv, dependencies) {
|
|
|
33476
33701
|
if (isEnabled !== void 0) {
|
|
33477
33702
|
input2.isEnabled = isEnabled;
|
|
33478
33703
|
}
|
|
33479
|
-
if (input2.serviceId === void 0 && input2.channel === void 0 && input2.conditionType === void 0 && input2.severityMin === void 0 && input2.config === void 0 && input2.isEnabled === void 0) {
|
|
33704
|
+
if (input2.serviceId === void 0 && input2.channel === void 0 && input2.conditionType === void 0 && input2.severityMin === void 0 && input2.cooldownSeconds === void 0 && input2.config === void 0 && input2.isEnabled === void 0) {
|
|
33480
33705
|
throw new CliInputError("At least one alert field must be provided.");
|
|
33481
33706
|
}
|
|
33482
33707
|
return await (dependencies.updateAlertCommand ?? updateAlertWithAuthCommand)(input2);
|
|
@@ -33734,7 +33959,7 @@ async function handleCaptureRuleCommand2(parsedArgv, dependencies) {
|
|
|
33734
33959
|
// package.json
|
|
33735
33960
|
var package_default = {
|
|
33736
33961
|
name: "@debugbundle/cli",
|
|
33737
|
-
version: "1.0.
|
|
33962
|
+
version: "1.0.4",
|
|
33738
33963
|
private: false,
|
|
33739
33964
|
description: "Command-line interface for DebugBundle",
|
|
33740
33965
|
license: "AGPL-3.0-only",
|