
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2bb9c50e-87c7-5aed-ad66-45fa37956f55")}catch(e){}}();
var _a;
/**
 * Sentry instrumentation for the stdio transport.
 *
 * IMPORTANT: This file must be imported before any other modules
 * to ensure Sentry is initialized as early as possible.
 *
 * Respects the --telemetry-enabled flag and TELEMETRY_ENABLED env var.
 * Sentry is disabled when telemetry is explicitly disabled.
 */
import * as Sentry from '@sentry/node';
import { getPackageVersion } from './utils/version.js';
// Check if telemetry is disabled via CLI arg or env var before yargs parses them.
// This mirrors the --telemetry-enabled / TELEMETRY_ENABLED option from stdio.ts.
const isTelemetryDisabled = process.argv.includes('--telemetry-enabled=false')
    || process.argv.includes('--no-telemetry-enabled')
    || process.env.TELEMETRY_ENABLED === 'false';
Sentry.init({
    dsn: 'https://916ec26e2f0abda151403acb5d8370c7@o272833.ingest.us.sentry.io/4510662589808640',
    release: (_a = getPackageVersion()) !== null && _a !== void 0 ? _a : undefined,
    sendDefaultPii: true,
    enabled: !isTelemetryDisabled,
});
// Start a Sentry session for this CLI invocation so crash-free rate metrics work.
// Without explicit session tracking, Sentry has zero sessions and crash-free % is always 0%.
if (!isTelemetryDisabled) {
    Sentry.startSession();
    Sentry.captureSession();
    // End the session cleanly when the process exits normally.
    // If the process crashes, Sentry automatically marks the session as crashed.
    process.on('beforeExit', () => {
        Sentry.endSession();
    });
}
//# sourceMappingURL=instrument.js.map
//# debugId=2bb9c50e-87c7-5aed-ad66-45fa37956f55
