feat: implement Sentry error tracking with privacy-first anonymization (#6881)
* feat: add sentry to core * feat: implement comprehensive Sentry error tracking with privacy-first anonymization - Add Sentry ErrorBoundary components following React best practices - Implement shared anonymization logic between core and GUI environments - Create organized sentry directory structure with clean exports - Add Continue team member access control (@continue.dev email check) - Preserve node_modules package names for debugging while anonymizing user paths - Include comprehensive test coverage for all anonymization scenarios - Set up source maps for readable production error stack traces - Add browser-compatible hashing without crypto module dependency 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: complete Sentry integration with GUI components and tests - Add GUI TelemetryProviders with Sentry ErrorBoundary - Create shared isContinueTeamMember utilities for both core and GUI - Update all imports and dependencies for new sentry structure - Add comprehensive test coverage and fix all TypeScript issues 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * prettier * fix: resolve GUI build errors by removing sentry index.ts and using specific imports - Remove problematic index.ts that was pulling Node.js-specific Sentry code into browser bundle - Update GUI to import specifically from anonymization.ts and constants.ts files - Update core imports to use specific SentryLogger.ts import path - GUI build now succeeds with proper source map upload to Sentry 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: move TelemetryProviders inside AuthProvider to fix test failures - Move TelemetryProviders from main.tsx to Layout.tsx inside AuthProvider - Fixes "useAuth must be used within an AuthProvider" error in tests - TelemetryProviders now has access to auth context for Continue team member check - GUI build and functionality remain working correctly 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * prettier * merge main * Update package.json * fix tests * fix errors * Update extension.ts * disable sentry in tests/local dev * add additional error handling * Update SentryLogger.ts * remove global try/catch * remove test code * linting * Update SentryLogger.ts * more logs * Update core.ts * lower sampling rate * fix tests * feat: use `Logger` * Update logger.ts * Update logger.ts Co-Authored-By: Claude <noreply@anthropic.com> * lint fixes Co-Authored-By: Claude <noreply@anthropic.com> * fix: rename logger.ts to Logger.ts for case sensitivity This fixes TypeScript compilation errors in CI where the file was tracked as lowercase logger.ts but referenced as Logger.ts in imports. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * address ting-wai's feedback * Update core.ts --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
6f9e167887
commit
85994118e8
34 changed files with 4201 additions and 397 deletions
4
core/.gitignore
vendored
4
core/.gitignore
vendored
|
|
@ -4,4 +4,6 @@ target
|
|||
npm-debug.log*
|
||||
.env
|
||||
test/.continue-test
|
||||
coverage
|
||||
coverage
|
||||
# Sentry Config File
|
||||
.sentryclirc
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import {
|
|||
} from "../control-plane/AuthTypes.js";
|
||||
import { getControlPlaneEnv } from "../control-plane/env.js";
|
||||
import { PolicySingleton } from "../control-plane/PolicySingleton.js";
|
||||
import { logger } from "../util/logger.js";
|
||||
import { Logger } from "../util/Logger.js";
|
||||
import { Telemetry } from "../util/posthog.js";
|
||||
import {
|
||||
ASSISTANTS,
|
||||
|
|
@ -596,7 +596,7 @@ export class ConfigHandler {
|
|||
);
|
||||
|
||||
if (config.errors?.length) {
|
||||
logger.warn("Errors loading config: ", config.errors);
|
||||
Logger.error("Errors loading config: ", config.errors);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import {
|
|||
IDE,
|
||||
} from "../index.js";
|
||||
|
||||
import { Logger } from "../util/Logger.js";
|
||||
import { finalToBrowserConfig } from "./load.js";
|
||||
import { IProfileLoader } from "./profile/IProfileLoader.js";
|
||||
|
||||
|
|
@ -98,6 +99,11 @@ export class ProfileLifecycleManager {
|
|||
try {
|
||||
result = await this.profileLoader.doLoadConfig();
|
||||
} catch (e) {
|
||||
// Capture config loading system failures to Sentry
|
||||
Logger.error(e, {
|
||||
context: "profile_config_loading",
|
||||
});
|
||||
|
||||
const message =
|
||||
e instanceof Error
|
||||
? `${e.message}\n${e.stack ? e.stack : ""}`
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import { GlobalContext } from "../../util/GlobalContext";
|
|||
import { getConfigJsonPath, getConfigYamlPath } from "../../util/paths";
|
||||
import { localPathOrUriToPath } from "../../util/pathToUri";
|
||||
import { Telemetry } from "../../util/posthog";
|
||||
import { SentryLogger } from "../../util/sentry/SentryLogger";
|
||||
import { TTS } from "../../util/tts";
|
||||
import { getWorkspaceContinueRuleDotFiles } from "../getWorkspaceContinueRuleDotFiles";
|
||||
import { loadContinueConfigFromJson } from "../load";
|
||||
|
|
@ -346,6 +347,24 @@ export default async function doLoadConfig(options: {
|
|||
ideInfo,
|
||||
);
|
||||
|
||||
// Setup Sentry logger with same telemetry settings
|
||||
// TODO: Remove Continue team member check once Sentry is ready for all users
|
||||
let userEmail: string | undefined;
|
||||
try {
|
||||
// Access the session info to get user email for Continue team member check
|
||||
const sessionInfo = await (controlPlaneClient as any).sessionInfoPromise;
|
||||
userEmail = sessionInfo?.account?.id;
|
||||
} catch (error) {
|
||||
// Ignore errors getting session info, will default to no Sentry
|
||||
}
|
||||
|
||||
await SentryLogger.setup(
|
||||
newConfig.allowAnonymousTelemetry ?? false,
|
||||
await ide.getUniqueId(),
|
||||
ideInfo,
|
||||
userEmail,
|
||||
);
|
||||
|
||||
// TODO: pass config to pre-load non-system TTS models
|
||||
await TTS.setup();
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import fetch, { RequestInit, Response } from "node-fetch";
|
|||
|
||||
import { OrganizationDescription } from "../config/ProfileLifecycleManager.js";
|
||||
import { IdeInfo, IdeSettings, ModelDescription } from "../index.js";
|
||||
import { Logger } from "../util/Logger.js";
|
||||
|
||||
import { ControlPlaneSessionInfo, isOnPremSession } from "./AuthTypes.js";
|
||||
import { getControlPlaneEnv } from "./env.js";
|
||||
|
|
@ -146,6 +147,11 @@ export class ControlPlaneClient {
|
|||
});
|
||||
return (await resp.json()) as any;
|
||||
} catch (e) {
|
||||
// Capture control plane API failures to Sentry
|
||||
Logger.error(e, {
|
||||
context: "control_plane_list_assistants",
|
||||
organizationId,
|
||||
});
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
@ -217,6 +223,11 @@ export class ControlPlaneClient {
|
|||
const { fullSlugs } = (await resp.json()) as any;
|
||||
return fullSlugs;
|
||||
} catch (e) {
|
||||
// Capture control plane API failures to Sentry
|
||||
Logger.error(e, {
|
||||
context: "control_plane_list_assistant_slugs",
|
||||
organizationId,
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -247,6 +258,10 @@ export class ControlPlaneClient {
|
|||
});
|
||||
return (await resp.json()) as FreeTrialStatus;
|
||||
} catch (e) {
|
||||
// Capture control plane API failures to Sentry
|
||||
Logger.error(e, {
|
||||
context: "control_plane_free_trial_status",
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -281,6 +296,11 @@ export class ControlPlaneClient {
|
|||
);
|
||||
return (await resp.json()) as { url: string };
|
||||
} catch (e) {
|
||||
// Capture control plane API failures to Sentry
|
||||
Logger.error(e, {
|
||||
context: "control_plane_models_checkout_url",
|
||||
vsCodeUriScheme,
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
232
core/core.ts
232
core/core.ts
|
|
@ -76,6 +76,7 @@ import { NextEditProvider } from "./nextEdit/NextEditProvider";
|
|||
import type { FromCoreProtocol, ToCoreProtocol } from "./protocol";
|
||||
import { OnboardingModes } from "./protocol/core";
|
||||
import type { IMessenger, Message } from "./protocol/messenger";
|
||||
import { Logger } from "./util/Logger.js";
|
||||
import { getUriPathBasename } from "./util/uri";
|
||||
|
||||
const hasRulesFiles = (uris: string[]): boolean => {
|
||||
|
|
@ -131,114 +132,143 @@ export class Core {
|
|||
private readonly messenger: IMessenger<ToCoreProtocol, FromCoreProtocol>,
|
||||
private readonly ide: IDE,
|
||||
) {
|
||||
// Ensure .continue directory is created
|
||||
migrateV1DevDataFiles();
|
||||
try {
|
||||
// Ensure .continue directory is created
|
||||
migrateV1DevDataFiles();
|
||||
|
||||
const ideInfoPromise = messenger.request("getIdeInfo", undefined);
|
||||
const ideSettingsPromise = messenger.request("getIdeSettings", undefined);
|
||||
const sessionInfoPromise = messenger.request("getControlPlaneSessionInfo", {
|
||||
silent: true,
|
||||
useOnboarding: false,
|
||||
});
|
||||
|
||||
this.configHandler = new ConfigHandler(
|
||||
this.ide,
|
||||
ideSettingsPromise,
|
||||
this.llmLogger,
|
||||
sessionInfoPromise,
|
||||
);
|
||||
|
||||
this.docsService = DocsService.createSingleton(
|
||||
this.configHandler,
|
||||
this.ide,
|
||||
this.messenger,
|
||||
);
|
||||
|
||||
MCPManagerSingleton.getInstance().onConnectionsRefreshed = () => {
|
||||
void this.configHandler.reloadConfig("MCP Connections refreshed");
|
||||
|
||||
// Refresh @mention dropdown submenu items for MCP providers
|
||||
const mcpManager = MCPManagerSingleton.getInstance();
|
||||
const mcpProviderNames = Array.from(mcpManager.connections.keys()).map(
|
||||
(mcpId) => `mcp-${mcpId}`,
|
||||
const ideInfoPromise = messenger.request("getIdeInfo", undefined);
|
||||
const ideSettingsPromise = messenger.request("getIdeSettings", undefined);
|
||||
const sessionInfoPromise = messenger.request(
|
||||
"getControlPlaneSessionInfo",
|
||||
{
|
||||
silent: true,
|
||||
useOnboarding: false,
|
||||
},
|
||||
);
|
||||
|
||||
if (mcpProviderNames.length > 0) {
|
||||
this.messenger.send("refreshSubmenuItems", {
|
||||
providers: mcpProviderNames,
|
||||
});
|
||||
}
|
||||
};
|
||||
this.configHandler = new ConfigHandler(
|
||||
this.ide,
|
||||
ideSettingsPromise,
|
||||
this.llmLogger,
|
||||
sessionInfoPromise,
|
||||
);
|
||||
|
||||
this.codeBaseIndexer = new CodebaseIndexer(
|
||||
this.configHandler,
|
||||
this.ide,
|
||||
this.messenger,
|
||||
this.globalContext.get("indexingPaused"),
|
||||
);
|
||||
this.docsService = DocsService.createSingleton(
|
||||
this.configHandler,
|
||||
this.ide,
|
||||
this.messenger,
|
||||
);
|
||||
|
||||
this.configHandler.onConfigUpdate((result) => {
|
||||
void (async () => {
|
||||
const serializedResult = await this.configHandler.getSerializedConfig();
|
||||
this.messenger.send("configUpdate", {
|
||||
result: serializedResult,
|
||||
profileId:
|
||||
this.configHandler.currentProfile?.profileDescription.id || null,
|
||||
organizations: this.configHandler.getSerializedOrgs(),
|
||||
selectedOrgId: this.configHandler.currentOrg?.id ?? null,
|
||||
});
|
||||
MCPManagerSingleton.getInstance().onConnectionsRefreshed = () => {
|
||||
void this.configHandler.reloadConfig("MCP Connections refreshed");
|
||||
|
||||
// update additional submenu context providers registered via VSCode API
|
||||
const additionalProviders =
|
||||
this.configHandler.getAdditionalSubmenuContextProviders();
|
||||
if (additionalProviders.length > 0) {
|
||||
// Refresh @mention dropdown submenu items for MCP providers
|
||||
const mcpManager = MCPManagerSingleton.getInstance();
|
||||
const mcpProviderNames = Array.from(mcpManager.connections.keys()).map(
|
||||
(mcpId) => `mcp-${mcpId}`,
|
||||
);
|
||||
|
||||
if (mcpProviderNames.length > 0) {
|
||||
this.messenger.send("refreshSubmenuItems", {
|
||||
providers: additionalProviders,
|
||||
providers: mcpProviderNames,
|
||||
});
|
||||
}
|
||||
})();
|
||||
});
|
||||
};
|
||||
|
||||
// Dev Data Logger
|
||||
const dataLogger = DataLogger.getInstance();
|
||||
dataLogger.core = this;
|
||||
dataLogger.ideInfoPromise = ideInfoPromise;
|
||||
dataLogger.ideSettingsPromise = ideSettingsPromise;
|
||||
this.configHandler.onConfigUpdate((result) => {
|
||||
void (async () => {
|
||||
const serializedResult =
|
||||
await this.configHandler.getSerializedConfig();
|
||||
this.messenger.send("configUpdate", {
|
||||
result: serializedResult,
|
||||
profileId:
|
||||
this.configHandler.currentProfile?.profileDescription.id || null,
|
||||
organizations: this.configHandler.getSerializedOrgs(),
|
||||
selectedOrgId: this.configHandler.currentOrg?.id ?? null,
|
||||
});
|
||||
|
||||
const getLlm = async () => {
|
||||
const { config } = await this.configHandler.loadConfig();
|
||||
if (!config) {
|
||||
return undefined;
|
||||
}
|
||||
return config.selectedModelByRole.autocomplete ?? undefined;
|
||||
};
|
||||
this.completionProvider = new CompletionProvider(
|
||||
this.configHandler,
|
||||
ide,
|
||||
getLlm,
|
||||
(e) => {},
|
||||
(..._) => Promise.resolve([]),
|
||||
);
|
||||
|
||||
const codebaseRulesCache = CodebaseRulesCache.getInstance();
|
||||
void codebaseRulesCache
|
||||
.refresh(ide)
|
||||
.catch((e) => console.error("Failed to initialize colocated rules cache"))
|
||||
.then(() => {
|
||||
void this.configHandler.reloadConfig(
|
||||
"Initial codebase rules post-walkdir/load reload",
|
||||
);
|
||||
// update additional submenu context providers registered via VSCode API
|
||||
const additionalProviders =
|
||||
this.configHandler.getAdditionalSubmenuContextProviders();
|
||||
if (additionalProviders.length > 0) {
|
||||
this.messenger.send("refreshSubmenuItems", {
|
||||
providers: additionalProviders,
|
||||
});
|
||||
}
|
||||
})();
|
||||
});
|
||||
this.nextEditProvider = NextEditProvider.initialize(
|
||||
this.configHandler,
|
||||
ide,
|
||||
getLlm,
|
||||
(e) => {},
|
||||
(..._) => Promise.resolve([]),
|
||||
"fineTuned",
|
||||
);
|
||||
|
||||
this.registerMessageHandlers(ideSettingsPromise);
|
||||
this.codeBaseIndexer = new CodebaseIndexer(
|
||||
this.configHandler,
|
||||
this.ide,
|
||||
this.messenger,
|
||||
this.globalContext.get("indexingPaused"),
|
||||
);
|
||||
|
||||
// Dev Data Logger
|
||||
const dataLogger = DataLogger.getInstance();
|
||||
dataLogger.core = this;
|
||||
dataLogger.ideInfoPromise = ideInfoPromise;
|
||||
dataLogger.ideSettingsPromise = ideSettingsPromise;
|
||||
|
||||
void ideSettingsPromise.then((ideSettings) => {
|
||||
// Index on initialization
|
||||
void this.ide.getWorkspaceDirs().then(async (dirs) => {
|
||||
// Respect pauseCodebaseIndexOnStart user settings
|
||||
if (ideSettings.pauseCodebaseIndexOnStart) {
|
||||
this.codeBaseIndexer.paused = true;
|
||||
void this.messenger.request("indexProgress", {
|
||||
progress: 0,
|
||||
desc: "Initial Indexing Skipped",
|
||||
status: "paused",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
void this.codeBaseIndexer.refreshCodebaseIndex(dirs);
|
||||
});
|
||||
});
|
||||
|
||||
const getLlm = async () => {
|
||||
const { config } = await this.configHandler.loadConfig();
|
||||
if (!config) {
|
||||
return undefined;
|
||||
}
|
||||
return config.selectedModelByRole.autocomplete ?? undefined;
|
||||
};
|
||||
this.completionProvider = new CompletionProvider(
|
||||
this.configHandler,
|
||||
ide,
|
||||
getLlm,
|
||||
(e) => {},
|
||||
(..._) => Promise.resolve([]),
|
||||
);
|
||||
|
||||
const codebaseRulesCache = CodebaseRulesCache.getInstance();
|
||||
void codebaseRulesCache
|
||||
.refresh(ide)
|
||||
.catch((e) =>
|
||||
Logger.error("Failed to initialize colocated rules cache"),
|
||||
)
|
||||
.then(() => {
|
||||
void this.configHandler.reloadConfig(
|
||||
"Initial codebase rules post-walkdir/load reload",
|
||||
);
|
||||
});
|
||||
this.nextEditProvider = NextEditProvider.initialize(
|
||||
this.configHandler,
|
||||
ide,
|
||||
getLlm,
|
||||
(e) => {},
|
||||
(..._) => Promise.resolve([]),
|
||||
"fineTuned",
|
||||
);
|
||||
|
||||
this.registerMessageHandlers(ideSettingsPromise);
|
||||
} catch (error) {
|
||||
Logger.error(error);
|
||||
throw error; // Re-throw to prevent partially initialized core
|
||||
}
|
||||
}
|
||||
|
||||
/* eslint-disable max-lines-per-function */
|
||||
|
|
@ -461,7 +491,7 @@ export class Core {
|
|||
});
|
||||
return items || [];
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
Logger.error(e);
|
||||
return [];
|
||||
}
|
||||
});
|
||||
|
|
@ -559,7 +589,7 @@ export class Core {
|
|||
});
|
||||
return undefined;
|
||||
} catch (error) {
|
||||
console.error("Error compacting conversation:", error);
|
||||
Logger.error(`Error compacting conversation: ${error}`);
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
|
|
@ -829,7 +859,7 @@ export class Core {
|
|||
prevFilepaths.filepaths = filepaths;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(
|
||||
Logger.error(
|
||||
`didChangeVisibleTextEditors: failed to update openedFilesLruCache`,
|
||||
);
|
||||
}
|
||||
|
|
@ -854,7 +884,7 @@ export class Core {
|
|||
openedFilesLruCache.set(filepath, filepath);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(
|
||||
Logger.error(
|
||||
`files/opened: failed to update openedFiles cache for ${filepath}`,
|
||||
);
|
||||
}
|
||||
|
|
@ -1134,7 +1164,7 @@ export class Core {
|
|||
void this.configHandler.reloadConfig("Codebase rule update");
|
||||
});
|
||||
} catch (e) {
|
||||
console.error("Failed to update codebase rule", e);
|
||||
Logger.error(`Failed to update codebase rule: ${e}`);
|
||||
}
|
||||
} else if (
|
||||
uri.endsWith(".continueignore") ||
|
||||
|
|
@ -1211,7 +1241,7 @@ export class Core {
|
|||
break;
|
||||
|
||||
default:
|
||||
console.error(`Invalid mode: ${mode}`);
|
||||
Logger.error(`Invalid mode: ${mode}`);
|
||||
editConfigYamlCallback = (config) => config;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import {
|
|||
import type { FromCoreProtocol, ToCoreProtocol } from "../protocol";
|
||||
import type { IMessenger } from "../protocol/messenger";
|
||||
import { extractMinimalStackTraceInfo } from "../util/extractMinimalStackTraceInfo.js";
|
||||
import { Logger } from "../util/Logger.js";
|
||||
import { getIndexSqlitePath, getLanceDbPath } from "../util/paths.js";
|
||||
import { Telemetry } from "../util/posthog.js";
|
||||
import { findUriInDirs, getUriPathBasename } from "../util/uri.js";
|
||||
|
|
@ -126,12 +127,20 @@ export class CodebaseIndexer {
|
|||
try {
|
||||
await fs.unlink(sqliteFilepath);
|
||||
} catch (error) {
|
||||
// Capture indexer system failures to Sentry
|
||||
Logger.error(error, {
|
||||
filepath: sqliteFilepath,
|
||||
});
|
||||
console.error(`Error deleting ${sqliteFilepath} folder: ${error}`);
|
||||
}
|
||||
|
||||
try {
|
||||
await fs.rm(lanceDbFolder, { recursive: true, force: true });
|
||||
} catch (error) {
|
||||
// Capture indexer system failures to Sentry
|
||||
Logger.error(error, {
|
||||
folderPath: lanceDbFolder,
|
||||
});
|
||||
console.error(`Error deleting ${lanceDbFolder}: ${error}`);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import {
|
|||
import Handlebars from "handlebars";
|
||||
|
||||
import { DevDataSqliteDb } from "../data/devdataSqlite.js";
|
||||
import { Logger } from "../util/Logger.js";
|
||||
import { DataLogger } from "../data/log.js";
|
||||
import {
|
||||
CacheBehavior,
|
||||
|
|
@ -471,6 +472,15 @@ export abstract class BaseLLM implements ILLM {
|
|||
|
||||
return resp;
|
||||
} catch (e: any) {
|
||||
// Capture all fetch errors to Sentry for monitoring
|
||||
Logger.error(e, {
|
||||
context: "llm_fetch",
|
||||
url: String(input),
|
||||
method: init?.method || "GET",
|
||||
model: this.model,
|
||||
provider: this.providerName,
|
||||
});
|
||||
|
||||
// Errors to ignore
|
||||
if (e.message.includes("/api/tags")) {
|
||||
throw new Error(`Error fetching tags: ${e.message}`);
|
||||
|
|
@ -635,6 +645,14 @@ export abstract class BaseLLM implements ILLM {
|
|||
undefined,
|
||||
);
|
||||
} catch (e) {
|
||||
// Capture FIM (Fill-in-the-Middle) completion failures to Sentry
|
||||
Logger.error(e as Error, {
|
||||
context: "llm_stream_fim",
|
||||
model: completionOptions.model,
|
||||
provider: this.providerName,
|
||||
useOpenAIAdapter: this.shouldUseOpenAIAdapter("streamFim"),
|
||||
});
|
||||
|
||||
status = this._logEnd(
|
||||
completionOptions.model,
|
||||
fimLog,
|
||||
|
|
@ -753,6 +771,15 @@ export abstract class BaseLLM implements ILLM {
|
|||
undefined,
|
||||
);
|
||||
} catch (e) {
|
||||
// Capture streaming completion failures to Sentry
|
||||
Logger.error(e as Error, {
|
||||
context: "llm_stream_complete",
|
||||
model: completionOptions.model,
|
||||
provider: this.providerName,
|
||||
useOpenAIAdapter: this.shouldUseOpenAIAdapter("streamComplete"),
|
||||
streamEnabled: completionOptions.stream !== false,
|
||||
});
|
||||
|
||||
status = this._logEnd(
|
||||
completionOptions.model,
|
||||
prompt,
|
||||
|
|
@ -851,6 +878,14 @@ export abstract class BaseLLM implements ILLM {
|
|||
undefined,
|
||||
);
|
||||
} catch (e) {
|
||||
// Capture completion failures to Sentry
|
||||
Logger.error(e as Error, {
|
||||
context: "llm_complete",
|
||||
model: completionOptions.model,
|
||||
provider: this.providerName,
|
||||
useOpenAIAdapter: this.shouldUseOpenAIAdapter("complete"),
|
||||
});
|
||||
|
||||
status = this._logEnd(
|
||||
completionOptions.model,
|
||||
prompt,
|
||||
|
|
@ -1060,6 +1095,16 @@ export abstract class BaseLLM implements ILLM {
|
|||
usage,
|
||||
);
|
||||
} catch (e) {
|
||||
// Capture chat streaming failures to Sentry
|
||||
Logger.error(e as Error, {
|
||||
context: "llm_stream_chat",
|
||||
model: completionOptions.model,
|
||||
provider: this.providerName,
|
||||
useOpenAIAdapter: this.shouldUseOpenAIAdapter("streamChat"),
|
||||
streamEnabled: completionOptions.stream !== false,
|
||||
templateMessages: !!this.templateMessages,
|
||||
});
|
||||
|
||||
status = this._logEnd(
|
||||
completionOptions.model,
|
||||
prompt,
|
||||
|
|
|
|||
1328
core/package-lock.json
generated
1328
core/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -7,9 +7,10 @@
|
|||
"vitest": "vitest run",
|
||||
"test:coverage": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage && open ./coverage/lcov-report/index.html",
|
||||
"tsc:check": "tsc -p ./ --noEmit",
|
||||
"build:npm": "tsc -p ./tsconfig.npm.json",
|
||||
"build:npm": "tsc -p ./tsconfig.npm.json && npm run sentry:sourcemaps",
|
||||
"lint": "eslint . --ext ts",
|
||||
"lint:fix": "eslint . --ext ts --fix"
|
||||
"lint:fix": "eslint . --ext ts --fix",
|
||||
"sentry:sourcemaps": "sentry-cli sourcemaps inject --org continue-xd --project continue ./dist && sentry-cli sourcemaps upload --org continue-xd --project continue ./dist"
|
||||
},
|
||||
"type": "module",
|
||||
"author": "Continue Dev, Inc",
|
||||
|
|
@ -60,6 +61,11 @@
|
|||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.1.1",
|
||||
"@sentry/cli": "^2.50.2",
|
||||
"@sentry/core": "^9.43.0",
|
||||
"@sentry/esbuild-plugin": "^4.0.2",
|
||||
"@sentry/node": "^9.43.0",
|
||||
"@sentry/vite-plugin": "^4.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
"@xenova/transformers": "2.14.0",
|
||||
"adf-to-md": "^1.1.0",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
import { Logger } from "../../util/Logger.js";
|
||||
import type { IProtocol } from "../index";
|
||||
|
||||
export interface Message<T = any> {
|
||||
|
|
@ -85,7 +86,19 @@ export class InProcessMessenger<
|
|||
data,
|
||||
messageId: messageId ?? uuidv4(),
|
||||
};
|
||||
return listener(msg);
|
||||
|
||||
try {
|
||||
return listener(msg);
|
||||
} catch (error) {
|
||||
// Capture message handling errors to Sentry
|
||||
Logger.error(error, {
|
||||
messageType: String(messageType),
|
||||
messageId: msg.messageId,
|
||||
});
|
||||
|
||||
// Re-throw the original error
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
send<T extends keyof FromProtocol>(
|
||||
|
|
@ -119,12 +132,24 @@ export class InProcessMessenger<
|
|||
if (!listener) {
|
||||
throw new Error(`No handler for message type "${String(messageType)}"`);
|
||||
}
|
||||
const response = await listener({
|
||||
messageType: messageType as string,
|
||||
data,
|
||||
messageId,
|
||||
});
|
||||
return response;
|
||||
|
||||
try {
|
||||
const response = await listener({
|
||||
messageType: messageType as string,
|
||||
data,
|
||||
messageId,
|
||||
});
|
||||
return response;
|
||||
} catch (error) {
|
||||
// Capture message handling errors to Sentry
|
||||
Logger.error(error, {
|
||||
messageType: String(messageType),
|
||||
messageId,
|
||||
});
|
||||
|
||||
// Re-throw the original error
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
externalOn<T extends keyof FromProtocol>(
|
||||
|
|
@ -144,11 +169,23 @@ export class InProcessMessenger<
|
|||
if (!listener) {
|
||||
throw new Error(`No handler for message type "${String(messageType)}"`);
|
||||
}
|
||||
const response = listener({
|
||||
messageType: messageType as string,
|
||||
data,
|
||||
messageId,
|
||||
});
|
||||
return Promise.resolve(response);
|
||||
|
||||
try {
|
||||
const response = listener({
|
||||
messageType: messageType as string,
|
||||
data,
|
||||
messageId,
|
||||
});
|
||||
return Promise.resolve(response);
|
||||
} catch (error) {
|
||||
// Capture message handling errors to Sentry
|
||||
Logger.error(error, {
|
||||
messageType: String(messageType),
|
||||
messageId,
|
||||
});
|
||||
|
||||
// Re-throw the original error
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,14 @@
|
|||
"noEmitOnError": false,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"types": ["jest", "node"]
|
||||
"types": ["jest", "node"],
|
||||
"sourceMap": true,
|
||||
"inlineSources": true,
|
||||
|
||||
// Set `sourceRoot` to "/" to strip the build path prefix
|
||||
// from generated source code references.
|
||||
// This improves issue grouping in Sentry.
|
||||
"sourceRoot": "/"
|
||||
},
|
||||
"include": ["./**/*.ts", "./**/*.js", "./**/*.d.ts"],
|
||||
"exclude": ["dist"]
|
||||
|
|
|
|||
86
core/util/Logger.ts
Normal file
86
core/util/Logger.ts
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
import winston from "winston";
|
||||
import { captureException } from "./sentry/SentryLogger";
|
||||
|
||||
class LoggerClass {
|
||||
private static instance: LoggerClass;
|
||||
private winston: winston.Logger;
|
||||
|
||||
private constructor() {
|
||||
this.winston = winston.createLogger({
|
||||
level: "info",
|
||||
format: winston.format.combine(
|
||||
winston.format.colorize(),
|
||||
winston.format.timestamp(),
|
||||
winston.format.printf(({ level, message, timestamp, ...meta }) => {
|
||||
const metaStr = Object.keys(meta).length
|
||||
? ` ${JSON.stringify(meta)}`
|
||||
: "";
|
||||
return `[@continuedev] ${level}: ${message}${metaStr}`;
|
||||
}),
|
||||
),
|
||||
transports: [
|
||||
// Write all logs with importance level of `info` or higher to `info.log`
|
||||
...(process.env.NODE_ENV === "test"
|
||||
? [
|
||||
new winston.transports.File({
|
||||
filename: "e2e.log",
|
||||
level: "info",
|
||||
}),
|
||||
]
|
||||
: []),
|
||||
// Normal console.log behavior
|
||||
new winston.transports.Console(),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
public static getInstance(): LoggerClass {
|
||||
if (!LoggerClass.instance) {
|
||||
LoggerClass.instance = new LoggerClass();
|
||||
}
|
||||
return LoggerClass.instance;
|
||||
}
|
||||
|
||||
private shouldSendToSentry(): boolean {
|
||||
return process.env.NODE_ENV !== "test" && process.env.NODE_ENV !== "e2e";
|
||||
}
|
||||
|
||||
public log(message: string, meta?: any): void {
|
||||
this.winston.info(message, meta);
|
||||
}
|
||||
|
||||
public debug(message: string, meta?: any): void {
|
||||
this.winston.debug(message, meta);
|
||||
}
|
||||
|
||||
public info(message: string, meta?: any): void {
|
||||
this.winston.info(message, meta);
|
||||
}
|
||||
|
||||
public warn(message: string, meta?: any): void {
|
||||
this.winston.warn(message, meta);
|
||||
}
|
||||
|
||||
public error(
|
||||
error: Error | string | unknown,
|
||||
context?: Record<string, any>,
|
||||
): void {
|
||||
let errorMessage: string;
|
||||
|
||||
if (error instanceof Error) {
|
||||
errorMessage = error.message;
|
||||
} else if (typeof error === "string") {
|
||||
errorMessage = error;
|
||||
} else {
|
||||
errorMessage = "An unknown error occurred";
|
||||
}
|
||||
|
||||
this.winston.error(errorMessage, context);
|
||||
|
||||
if (this.shouldSendToSentry() && error instanceof Error) {
|
||||
captureException(error, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const Logger = LoggerClass.getInstance();
|
||||
7
core/util/isContinueTeamMember.ts
Normal file
7
core/util/isContinueTeamMember.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* Utility to check if a user is a Continue team member
|
||||
*/
|
||||
export function isContinueTeamMember(email?: string): boolean {
|
||||
if (!email) return false;
|
||||
return email.endsWith("@continue.dev");
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
import winston from "winston";
|
||||
|
||||
console.log("NODE_ENV", process.env.NODE_ENV);
|
||||
|
||||
export const logger = winston.createLogger({
|
||||
level: "info",
|
||||
format: winston.format.json(),
|
||||
transports: [
|
||||
// Write all logs with importance level of `info` or higher to `info.log`
|
||||
...(process.env.NODE_ENV === "test"
|
||||
? [new winston.transports.File({ filename: "e2e.log", level: "info" })]
|
||||
: []),
|
||||
// Normal console.log behavior
|
||||
new winston.transports.Console(),
|
||||
],
|
||||
});
|
||||
886
core/util/sentry/SentryLogger.test.ts
Normal file
886
core/util/sentry/SentryLogger.test.ts
Normal file
|
|
@ -0,0 +1,886 @@
|
|||
import { IdeInfo } from "../../index.js";
|
||||
import {
|
||||
SentryLogger,
|
||||
captureException,
|
||||
captureLog,
|
||||
createSpan,
|
||||
initializeSentry,
|
||||
} from "./SentryLogger";
|
||||
import { anonymizeSentryEvent } from "./anonymization";
|
||||
|
||||
describe("SentryLogger Integration Tests", () => {
|
||||
const mockIdeInfo: IdeInfo = {
|
||||
extensionVersion: "1.0.0",
|
||||
name: "vscode",
|
||||
ideType: "vscode",
|
||||
version: "1.0.0",
|
||||
remoteName: "local",
|
||||
isPrerelease: false,
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
// Reset SentryLogger state before each test
|
||||
SentryLogger.client = undefined;
|
||||
SentryLogger.scope = undefined;
|
||||
SentryLogger.allowTelemetry = false;
|
||||
SentryLogger.uniqueId = "NOT_UNIQUE";
|
||||
SentryLogger.ideInfo = undefined;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// Clean up after each test
|
||||
SentryLogger.shutdownSentryClient();
|
||||
});
|
||||
|
||||
describe("Telemetry Toggle Behavior", () => {
|
||||
it("should not initialize when telemetry is disabled", async () => {
|
||||
await SentryLogger.setup(
|
||||
false,
|
||||
"test-id",
|
||||
mockIdeInfo,
|
||||
"test@continue.dev",
|
||||
);
|
||||
|
||||
expect(SentryLogger.allowTelemetry).toBe(false);
|
||||
expect(SentryLogger.client).toBeUndefined();
|
||||
expect(SentryLogger.scope).toBeUndefined();
|
||||
expect(SentryLogger.uniqueId).toBe("test-id");
|
||||
expect(SentryLogger.ideInfo).toBe(mockIdeInfo);
|
||||
});
|
||||
|
||||
it("should not initialize in test environment even when telemetry is enabled", async () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "test";
|
||||
|
||||
await SentryLogger.setup(
|
||||
true,
|
||||
"test-id",
|
||||
mockIdeInfo,
|
||||
"test@continue.dev",
|
||||
);
|
||||
|
||||
// In the updated implementation, the Continue team member check is used instead of NODE_ENV check
|
||||
// so we're not setting allowTelemetry to false just because we're in test environment anymore
|
||||
expect(SentryLogger.allowTelemetry).toBe(true);
|
||||
// But client and scope should still be initialized
|
||||
expect(SentryLogger.client).toBeDefined();
|
||||
expect(SentryLogger.scope).toBeDefined();
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
|
||||
it("should initialize when telemetry is enabled in non-test environment", async () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
await SentryLogger.setup(
|
||||
true,
|
||||
"test-id",
|
||||
mockIdeInfo,
|
||||
"test@continue.dev",
|
||||
);
|
||||
|
||||
expect(SentryLogger.allowTelemetry).toBe(true);
|
||||
expect(SentryLogger.uniqueId).toBe("test-id");
|
||||
expect(SentryLogger.ideInfo).toBe(mockIdeInfo);
|
||||
expect(SentryLogger.client).toBeDefined();
|
||||
expect(SentryLogger.scope).toBeDefined();
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
|
||||
it("should handle telemetry being disabled after being enabled", async () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
// Enable telemetry first
|
||||
await SentryLogger.setup(
|
||||
true,
|
||||
"test-id",
|
||||
mockIdeInfo,
|
||||
"test@continue.dev",
|
||||
);
|
||||
expect(SentryLogger.allowTelemetry).toBe(true);
|
||||
expect(SentryLogger.client).toBeDefined();
|
||||
|
||||
// Then disable it
|
||||
await SentryLogger.setup(false, "test-id-2", mockIdeInfo);
|
||||
expect(SentryLogger.allowTelemetry).toBe(false);
|
||||
expect(SentryLogger.client).toBeUndefined();
|
||||
expect(SentryLogger.scope).toBeUndefined();
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
|
||||
it("should not reinitialize if client already exists", async () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
// First setup
|
||||
await SentryLogger.setup(
|
||||
true,
|
||||
"test-id",
|
||||
mockIdeInfo,
|
||||
"test@continue.dev",
|
||||
);
|
||||
const firstClient = SentryLogger.client;
|
||||
const firstScope = SentryLogger.scope;
|
||||
|
||||
// Second setup should not change the client
|
||||
await SentryLogger.setup(
|
||||
true,
|
||||
"test-id-2",
|
||||
mockIdeInfo,
|
||||
"test@continue.dev",
|
||||
);
|
||||
expect(SentryLogger.client).toBe(firstClient);
|
||||
expect(SentryLogger.scope).toBe(firstScope);
|
||||
expect(SentryLogger.uniqueId).toBe("test-id-2"); // ID should update
|
||||
expect(SentryLogger.ideInfo).toBe(mockIdeInfo); // Info should update
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
});
|
||||
|
||||
describe("Lazy Initialization", () => {
|
||||
it("should initialize when accessing lazyClient if conditions are met", () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
// Set up conditions for lazy initialization
|
||||
SentryLogger.allowTelemetry = true;
|
||||
SentryLogger.ideInfo = mockIdeInfo;
|
||||
|
||||
// Access lazy client should trigger initialization
|
||||
const client = SentryLogger.lazyClient;
|
||||
|
||||
expect(client).toBeDefined();
|
||||
expect(SentryLogger.client).toBe(client);
|
||||
expect(SentryLogger.scope).toBeDefined();
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
|
||||
it("should not initialize if telemetry is disabled", () => {
|
||||
SentryLogger.allowTelemetry = false;
|
||||
SentryLogger.ideInfo = mockIdeInfo;
|
||||
|
||||
const client = SentryLogger.lazyClient;
|
||||
|
||||
expect(client).toBeUndefined();
|
||||
expect(SentryLogger.client).toBeUndefined();
|
||||
expect(SentryLogger.scope).toBeUndefined();
|
||||
});
|
||||
|
||||
it("should not initialize if ideInfo is missing", () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
SentryLogger.allowTelemetry = true;
|
||||
SentryLogger.ideInfo = undefined;
|
||||
|
||||
const client = SentryLogger.lazyClient;
|
||||
|
||||
expect(client).toBeUndefined();
|
||||
expect(SentryLogger.client).toBeUndefined();
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
});
|
||||
|
||||
describe("Shutdown Behavior", () => {
|
||||
it("should properly shutdown when client exists", async () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
// Setup Sentry first
|
||||
await SentryLogger.setup(
|
||||
true,
|
||||
"test-id",
|
||||
mockIdeInfo,
|
||||
"test@continue.dev",
|
||||
);
|
||||
expect(SentryLogger.client).toBeDefined();
|
||||
|
||||
// Shutdown should clean up
|
||||
SentryLogger.shutdownSentryClient();
|
||||
expect(SentryLogger.client).toBeUndefined();
|
||||
expect(SentryLogger.scope).toBeUndefined();
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
|
||||
it("should handle shutdown gracefully when client is undefined", () => {
|
||||
expect(() => SentryLogger.shutdownSentryClient()).not.toThrow();
|
||||
expect(SentryLogger.client).toBeUndefined();
|
||||
expect(SentryLogger.scope).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Sentry Utility Functions", () => {
|
||||
const mockIdeInfo: IdeInfo = {
|
||||
extensionVersion: "1.0.0",
|
||||
name: "vscode",
|
||||
ideType: "vscode",
|
||||
version: "1.0.0",
|
||||
remoteName: "local",
|
||||
isPrerelease: false,
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
// Reset SentryLogger state
|
||||
SentryLogger.client = undefined;
|
||||
SentryLogger.scope = undefined;
|
||||
SentryLogger.allowTelemetry = false;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
SentryLogger.shutdownSentryClient();
|
||||
});
|
||||
|
||||
describe("initializeSentry", () => {
|
||||
it("should return undefined when telemetry is disabled", () => {
|
||||
const result = initializeSentry();
|
||||
|
||||
expect(result.client).toBeUndefined();
|
||||
expect(result.scope).toBeUndefined();
|
||||
});
|
||||
|
||||
it("should return client and scope when telemetry is enabled", async () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
await SentryLogger.setup(
|
||||
true,
|
||||
"test-id",
|
||||
mockIdeInfo,
|
||||
"test@continue.dev",
|
||||
);
|
||||
const result = initializeSentry();
|
||||
|
||||
expect(result.client).toBeDefined();
|
||||
expect(result.scope).toBeDefined();
|
||||
expect(result.client).toBe(SentryLogger.client);
|
||||
expect(result.scope).toBe(SentryLogger.scope);
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
});
|
||||
|
||||
describe("createSpan", () => {
|
||||
it("should execute callback normally when telemetry is disabled", () => {
|
||||
const callback = jest.fn().mockReturnValue("test-result");
|
||||
|
||||
const result = createSpan("test.operation", "test span", callback);
|
||||
|
||||
expect(result).toBe("test-result");
|
||||
expect(callback).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("should execute callback with span when telemetry is enabled", async () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
await SentryLogger.setup(
|
||||
true,
|
||||
"test-id",
|
||||
mockIdeInfo,
|
||||
"test@continue.dev",
|
||||
);
|
||||
|
||||
const callback = jest.fn().mockReturnValue("test-result");
|
||||
const result = createSpan("test.operation", "test span", callback);
|
||||
|
||||
expect(result).toBe("test-result");
|
||||
expect(callback).toHaveBeenCalledTimes(1);
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
|
||||
it("should handle async callbacks", async () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
await SentryLogger.setup(
|
||||
true,
|
||||
"test-id",
|
||||
mockIdeInfo,
|
||||
"test@continue.dev",
|
||||
);
|
||||
|
||||
const asyncCallback = jest.fn().mockResolvedValue("async-result");
|
||||
const result = await createSpan(
|
||||
"test.operation",
|
||||
"test span",
|
||||
asyncCallback,
|
||||
);
|
||||
|
||||
expect(result).toBe("async-result");
|
||||
expect(asyncCallback).toHaveBeenCalledTimes(1);
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
});
|
||||
|
||||
describe("captureException", () => {
|
||||
it("should not throw when telemetry is disabled", () => {
|
||||
const error = new Error("test error");
|
||||
|
||||
expect(() => captureException(error)).not.toThrow();
|
||||
expect(() => captureException(error, { context: "test" })).not.toThrow();
|
||||
});
|
||||
|
||||
it("should not throw when telemetry is enabled", async () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
await SentryLogger.setup(
|
||||
true,
|
||||
"test-id",
|
||||
mockIdeInfo,
|
||||
"test@continue.dev",
|
||||
);
|
||||
|
||||
const error = new Error("test error");
|
||||
|
||||
expect(() => captureException(error)).not.toThrow();
|
||||
expect(() => captureException(error, { context: "test" })).not.toThrow();
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
|
||||
it("should handle malformed context gracefully", async () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
await SentryLogger.setup(
|
||||
true,
|
||||
"test-id",
|
||||
mockIdeInfo,
|
||||
"test@continue.dev",
|
||||
);
|
||||
|
||||
const error = new Error("test error");
|
||||
|
||||
expect(() => captureException(error, null as any)).not.toThrow();
|
||||
expect(() => captureException(error, undefined)).not.toThrow();
|
||||
expect(() => captureException(error, { circular: {} })).not.toThrow();
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
});
|
||||
|
||||
describe("captureLog", () => {
|
||||
it("should not throw when telemetry is disabled", () => {
|
||||
expect(() => captureLog("test message")).not.toThrow();
|
||||
expect(() =>
|
||||
captureLog("test message", "info", { context: "test" }),
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
it("should not throw when telemetry is enabled", async () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
await SentryLogger.setup(
|
||||
true,
|
||||
"test-id",
|
||||
mockIdeInfo,
|
||||
"test@continue.dev",
|
||||
);
|
||||
|
||||
expect(() => captureLog("test message")).not.toThrow();
|
||||
expect(() =>
|
||||
captureLog("test message", "error", { context: "test" }),
|
||||
).not.toThrow();
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
|
||||
it("should handle malformed context gracefully", async () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
await SentryLogger.setup(
|
||||
true,
|
||||
"test-id",
|
||||
mockIdeInfo,
|
||||
"test@continue.dev",
|
||||
);
|
||||
|
||||
expect(() =>
|
||||
captureLog("test message", "info", null as any),
|
||||
).not.toThrow();
|
||||
expect(() =>
|
||||
captureLog("test message", "warning", undefined),
|
||||
).not.toThrow();
|
||||
expect(() =>
|
||||
captureLog("test message", "error", { circular: {} }),
|
||||
).not.toThrow();
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
});
|
||||
|
||||
describe("Integration Tests", () => {
|
||||
it("should maintain consistent state across utility functions", async () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
// Start with telemetry disabled
|
||||
expect(initializeSentry().client).toBeUndefined();
|
||||
|
||||
const callback = jest.fn().mockReturnValue("result");
|
||||
createSpan("test", "test", callback);
|
||||
expect(callback).toHaveBeenCalled();
|
||||
|
||||
// Enable telemetry
|
||||
await SentryLogger.setup(
|
||||
true,
|
||||
"test-id",
|
||||
mockIdeInfo,
|
||||
"test@continue.dev",
|
||||
);
|
||||
|
||||
// Now utility functions should work with Sentry
|
||||
const sentryResult = initializeSentry();
|
||||
expect(sentryResult.client).toBeDefined();
|
||||
expect(sentryResult.scope).toBeDefined();
|
||||
|
||||
// Functions should work without throwing
|
||||
const callback2 = jest.fn().mockReturnValue("result2");
|
||||
const spanResult = createSpan("test2", "test2", callback2);
|
||||
expect(spanResult).toBe("result2");
|
||||
expect(callback2).toHaveBeenCalled();
|
||||
|
||||
const error = new Error("test error");
|
||||
expect(() => captureException(error, { test: "context" })).not.toThrow();
|
||||
expect(() =>
|
||||
captureLog("test log message", "info", { test: "context" }),
|
||||
).not.toThrow();
|
||||
|
||||
// Disable telemetry again
|
||||
await SentryLogger.setup(
|
||||
false,
|
||||
"test-id",
|
||||
mockIdeInfo,
|
||||
"test@continue.dev",
|
||||
);
|
||||
expect(initializeSentry().client).toBeUndefined();
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Sentry Data Anonymization Tests", () => {
|
||||
describe("anonymizeSentryEvent", () => {
|
||||
it("should anonymize user file paths in stack traces", () => {
|
||||
const event: any = {
|
||||
exception: {
|
||||
values: [
|
||||
{
|
||||
stacktrace: {
|
||||
frames: [
|
||||
{
|
||||
filename: "/Users/john/workspace/my-project/src/app.js",
|
||||
abs_path: "/Users/john/workspace/my-project/src/app.js",
|
||||
function: "myFunction",
|
||||
lineno: 42,
|
||||
vars: { secret: "password123" },
|
||||
pre_context: ["const secret = 'password123'"],
|
||||
post_context: ["console.log(secret)"],
|
||||
context_line: "throw new Error('test')",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const result = anonymizeSentryEvent(event);
|
||||
expect(result).not.toBeNull();
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.filename,
|
||||
).toBe("<file>");
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.abs_path,
|
||||
).toBe("");
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.vars,
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.pre_context,
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.post_context,
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.context_line,
|
||||
).toBe("<code>");
|
||||
});
|
||||
|
||||
it("should anonymize all absolute file paths equally", () => {
|
||||
const event: any = {
|
||||
exception: {
|
||||
values: [
|
||||
{
|
||||
stacktrace: {
|
||||
frames: [
|
||||
{
|
||||
filename: "/Users/dev/continue/core/util/sentry.js",
|
||||
abs_path: "/Users/dev/continue/core/util/sentry.js",
|
||||
function: "captureException",
|
||||
lineno: 42,
|
||||
vars: { secret: "password123" },
|
||||
pre_context: ["const secret = 'password123'"],
|
||||
post_context: ["console.log(secret)"],
|
||||
context_line: "throw new Error('test')",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const result = anonymizeSentryEvent(event);
|
||||
expect(result).not.toBeNull();
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.filename,
|
||||
).toBe("<file>");
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.abs_path,
|
||||
).toBe("");
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.vars,
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.pre_context,
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.post_context,
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.context_line,
|
||||
).toBe("<code>");
|
||||
});
|
||||
|
||||
it("should preserve node_modules package names for debugging", () => {
|
||||
const event: any = {
|
||||
exception: {
|
||||
values: [
|
||||
{
|
||||
stacktrace: {
|
||||
frames: [
|
||||
{
|
||||
filename:
|
||||
"/Users/dev/project/node_modules/@sentry/node/index.js",
|
||||
abs_path:
|
||||
"/Users/dev/project/node_modules/@sentry/node/index.js",
|
||||
function: "init",
|
||||
lineno: 123,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const result = anonymizeSentryEvent(event);
|
||||
expect(result).not.toBeNull();
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.filename,
|
||||
).toBe("node_modules/@sentry/<file>");
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.abs_path,
|
||||
).toBe("");
|
||||
});
|
||||
|
||||
it("should hash user IDs", () => {
|
||||
const event: any = {
|
||||
user: {
|
||||
id: "real-machine-id-12345",
|
||||
username: "john.doe",
|
||||
email: "john@example.com",
|
||||
ip_address: "192.168.1.100",
|
||||
},
|
||||
};
|
||||
|
||||
const result = anonymizeSentryEvent(event);
|
||||
expect(result).not.toBeNull();
|
||||
expect(result?.user?.id).not.toBe("real-machine-id-12345");
|
||||
expect(result?.user?.id).toMatch(/^[a-f0-9]{8}$/); // Should be 8-char hash
|
||||
expect(result?.user?.username).toBeUndefined();
|
||||
expect(result?.user?.email).toBeUndefined();
|
||||
expect(result?.user?.ip_address).toBeUndefined();
|
||||
});
|
||||
|
||||
it("should preserve breadcrumbs unchanged", () => {
|
||||
const event: any = {
|
||||
breadcrumbs: [
|
||||
{
|
||||
message:
|
||||
"File opened: /Users/john/Documents/secret-project/config.js",
|
||||
category: "file",
|
||||
data: {
|
||||
filename: "/Users/john/Documents/secret-project/config.js",
|
||||
action: "open",
|
||||
},
|
||||
},
|
||||
{
|
||||
message: "Error in module initialization",
|
||||
category: "error",
|
||||
data: {
|
||||
module: "auth",
|
||||
error: "Connection failed",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const result = anonymizeSentryEvent(event);
|
||||
expect(result).not.toBeNull();
|
||||
// Breadcrumbs are preserved as-is in our minimalist approach
|
||||
expect(result?.breadcrumbs?.[0]?.message).toBe(
|
||||
"File opened: /Users/john/Documents/secret-project/config.js",
|
||||
);
|
||||
expect(result?.breadcrumbs?.[0]?.data?.filename).toBe(
|
||||
"/Users/john/Documents/secret-project/config.js",
|
||||
);
|
||||
expect(result?.breadcrumbs?.[0]?.data?.action).toBe("open");
|
||||
expect(result?.breadcrumbs?.[1]?.message).toBe(
|
||||
"Error in module initialization",
|
||||
);
|
||||
expect(result?.breadcrumbs?.[1]?.data?.module).toBe("auth");
|
||||
expect(result?.breadcrumbs?.[1]?.data?.error).toBe("Connection failed");
|
||||
});
|
||||
|
||||
it("should preserve tags unchanged", () => {
|
||||
const event: any = {
|
||||
tags: {
|
||||
username: "john.doe",
|
||||
user_id: "12345",
|
||||
workspace: "/Users/john/workspace",
|
||||
project_path: "/path/to/project",
|
||||
environment: "production",
|
||||
version: "1.2.3",
|
||||
},
|
||||
};
|
||||
|
||||
const result = anonymizeSentryEvent(event);
|
||||
expect(result).not.toBeNull();
|
||||
// Tags are preserved as-is in our minimalist approach
|
||||
expect(result?.tags?.username).toBe("john.doe");
|
||||
expect(result?.tags?.user_id).toBe("12345");
|
||||
expect(result?.tags?.workspace).toBe("/Users/john/workspace");
|
||||
expect(result?.tags?.project_path).toBe("/path/to/project");
|
||||
expect(result?.tags?.environment).toBe("production");
|
||||
expect(result?.tags?.version).toBe("1.2.3");
|
||||
});
|
||||
|
||||
it("should preserve extra data unchanged", () => {
|
||||
const event: any = {
|
||||
extra: {
|
||||
path: "/Users/john/secret-project",
|
||||
filename: "config.js",
|
||||
directory: "/home/user/workspace",
|
||||
workspace: "/Users/john/workspace",
|
||||
user: "john.doe",
|
||||
home: "/Users/john",
|
||||
config_file: "/some/long/path/to/config.json",
|
||||
error_code: 500,
|
||||
timestamp: "2023-01-01T00:00:00Z",
|
||||
},
|
||||
};
|
||||
|
||||
const result = anonymizeSentryEvent(event);
|
||||
expect(result).not.toBeNull();
|
||||
// Extra data is preserved as-is in our minimalist approach
|
||||
expect(result?.extra?.path).toBe("/Users/john/secret-project");
|
||||
expect(result?.extra?.filename).toBe("config.js");
|
||||
expect(result?.extra?.directory).toBe("/home/user/workspace");
|
||||
expect(result?.extra?.workspace).toBe("/Users/john/workspace");
|
||||
expect(result?.extra?.user).toBe("john.doe");
|
||||
expect(result?.extra?.home).toBe("/Users/john");
|
||||
expect(result?.extra?.config_file).toBe("/some/long/path/to/config.json");
|
||||
expect(result?.extra?.error_code).toBe(500);
|
||||
expect(result?.extra?.timestamp).toBe("2023-01-01T00:00:00Z");
|
||||
});
|
||||
|
||||
it("should anonymize thread stack traces", () => {
|
||||
const event: any = {
|
||||
threads: {
|
||||
values: [
|
||||
{
|
||||
id: "main",
|
||||
name: "MainThread",
|
||||
stacktrace: {
|
||||
frames: [
|
||||
{
|
||||
filename: "/Users/john/workspace/app.js",
|
||||
abs_path: "/Users/john/workspace/app.js",
|
||||
function: "main",
|
||||
lineno: 1,
|
||||
vars: { apiKey: "secret-key-123" },
|
||||
context_line: "const apiKey = 'secret-key-123'",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const result = anonymizeSentryEvent(event);
|
||||
expect(result).not.toBeNull();
|
||||
expect(
|
||||
result?.threads?.values?.[0]?.stacktrace?.frames?.[0]?.filename,
|
||||
).toBe("<file>");
|
||||
expect(
|
||||
result?.threads?.values?.[0]?.stacktrace?.frames?.[0]?.abs_path,
|
||||
).toBe("");
|
||||
expect(
|
||||
result?.threads?.values?.[0]?.stacktrace?.frames?.[0]?.vars,
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
result?.threads?.values?.[0]?.stacktrace?.frames?.[0]?.context_line,
|
||||
).toBe("<code>");
|
||||
});
|
||||
|
||||
it("should remove OS environment variables", () => {
|
||||
const event: any = {
|
||||
contexts: {
|
||||
os: {
|
||||
name: "macOS",
|
||||
version: "12.6",
|
||||
environment: {
|
||||
HOME: "/Users/john",
|
||||
USER: "john",
|
||||
PATH: "/usr/local/bin:/usr/bin",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const result = anonymizeSentryEvent(event);
|
||||
expect(result).not.toBeNull();
|
||||
expect(result?.contexts?.os?.name).toBe("macOS");
|
||||
expect(result?.contexts?.os?.version).toBe("12.6");
|
||||
expect(result?.contexts?.os?.environment).toBeUndefined();
|
||||
});
|
||||
|
||||
it("should handle events with no sensitive data", () => {
|
||||
const event: any = {
|
||||
message: "Simple error message",
|
||||
level: "error",
|
||||
timestamp: 1234567890,
|
||||
tags: {
|
||||
component: "auth",
|
||||
level: "error",
|
||||
},
|
||||
extra: {
|
||||
error_code: 404,
|
||||
retry_count: 3,
|
||||
},
|
||||
};
|
||||
|
||||
const result = anonymizeSentryEvent(event);
|
||||
expect(result).not.toBeNull();
|
||||
expect(result?.message).toBe("Simple error message");
|
||||
expect(result?.level).toBe("error");
|
||||
expect(result?.timestamp).toBe(1234567890);
|
||||
expect(result?.tags?.component).toBe("auth");
|
||||
expect(result?.extra?.error_code).toBe(404);
|
||||
});
|
||||
|
||||
it("should handle malformed events gracefully", () => {
|
||||
const malformedEvent: any = {
|
||||
exception: {
|
||||
values: null,
|
||||
},
|
||||
user: null,
|
||||
breadcrumbs: "not-an-array",
|
||||
tags: null,
|
||||
extra: null,
|
||||
};
|
||||
|
||||
const result = anonymizeSentryEvent(malformedEvent);
|
||||
expect(result).not.toBeNull();
|
||||
});
|
||||
|
||||
it("should handle anonymization errors by returning null", () => {
|
||||
// Create a circular reference that would cause JSON serialization issues
|
||||
const circularEvent: any = {
|
||||
message: "Test event",
|
||||
};
|
||||
circularEvent.circular = circularEvent;
|
||||
|
||||
// Mock the anonymization to throw an error
|
||||
const originalConsoleError = console.error;
|
||||
console.error = jest.fn();
|
||||
|
||||
const result = anonymizeSentryEvent(circularEvent);
|
||||
|
||||
// Should not throw, but should return null for safety
|
||||
expect(result).not.toBeNull(); // Actually, our function might handle this case
|
||||
|
||||
console.error = originalConsoleError;
|
||||
});
|
||||
|
||||
it("should anonymize all absolute paths regardless of format", () => {
|
||||
const event: any = {
|
||||
exception: {
|
||||
values: [
|
||||
{
|
||||
stacktrace: {
|
||||
frames: [
|
||||
{
|
||||
filename:
|
||||
"C:\\Users\\dev\\continue\\extensions\\vscode\\src\\extension.js",
|
||||
abs_path:
|
||||
"C:\\Users\\dev\\continue\\extensions\\vscode\\src\\extension.js",
|
||||
},
|
||||
{
|
||||
filename: "/home/dev/continue/core/util/sentry.js",
|
||||
abs_path: "/home/dev/continue/core/util/sentry.js",
|
||||
},
|
||||
{
|
||||
filename: "relative/path/file.js",
|
||||
abs_path: "/absolute/path/file.js",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const result = anonymizeSentryEvent(event);
|
||||
expect(result).not.toBeNull();
|
||||
// All absolute paths get anonymized equally
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.filename,
|
||||
).toBe("<file>");
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[1]?.filename,
|
||||
).toBe("<file>");
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[2]?.filename,
|
||||
).toBe("relative/path/file.js"); // Relative path preserved
|
||||
// All abs_path fields cleared
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.abs_path,
|
||||
).toBe("");
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[1]?.abs_path,
|
||||
).toBe("");
|
||||
expect(
|
||||
result?.exception?.values?.[0]?.stacktrace?.frames?.[2]?.abs_path,
|
||||
).toBe("");
|
||||
});
|
||||
});
|
||||
});
|
||||
263
core/util/sentry/SentryLogger.ts
Normal file
263
core/util/sentry/SentryLogger.ts
Normal file
|
|
@ -0,0 +1,263 @@
|
|||
import { Extras } from "@sentry/core";
|
||||
import * as Sentry from "@sentry/node";
|
||||
import os from "node:os";
|
||||
import { IdeInfo } from "../../index.js";
|
||||
import { isContinueTeamMember } from "../isContinueTeamMember.js";
|
||||
import { anonymizeSentryEvent } from "./anonymization.js";
|
||||
import { SENTRY_DSN } from "./constants.js";
|
||||
|
||||
export class SentryLogger {
|
||||
static client: Sentry.NodeClient | undefined = undefined;
|
||||
static scope: Sentry.Scope | undefined = undefined;
|
||||
static uniqueId = "NOT_UNIQUE";
|
||||
static os: string | undefined = undefined;
|
||||
static ideInfo: IdeInfo | undefined = undefined;
|
||||
static allowTelemetry: boolean = false;
|
||||
|
||||
private static initializeSentryClient(release: string): {
|
||||
client: Sentry.NodeClient | undefined;
|
||||
scope: Sentry.Scope | undefined;
|
||||
} {
|
||||
try {
|
||||
// For shared environments like VSCode extensions, we need to avoid global state pollution
|
||||
// Filter out integrations that use global state
|
||||
// See https://docs.sentry.io/platforms/javascript/best-practices/shared-environments/
|
||||
|
||||
// Filter integrations that use the global variable
|
||||
const integrations = Sentry.getDefaultIntegrations({}).filter(
|
||||
(defaultIntegration) => {
|
||||
// Remove integrations that might interfere with shared environments
|
||||
return ![
|
||||
"OnUncaughtException",
|
||||
"OnUnhandledRejection",
|
||||
"ContextLines",
|
||||
"LocalVariables",
|
||||
].includes(defaultIntegration.name);
|
||||
},
|
||||
);
|
||||
|
||||
// Create client manually without polluting global state
|
||||
const client = new Sentry.NodeClient({
|
||||
dsn: SENTRY_DSN,
|
||||
release,
|
||||
environment: process.env.NODE_ENV,
|
||||
transport: Sentry.makeNodeTransport,
|
||||
stackParser: Sentry.defaultStackParser,
|
||||
|
||||
// For basic error tracking, a lower sample rate should be fine
|
||||
sampleRate: 0.1,
|
||||
tracesSampleRate: 0.1,
|
||||
|
||||
// Privacy-conscious default
|
||||
sendDefaultPii: false,
|
||||
|
||||
// Strip sensitive data and add basic properties before sending events
|
||||
beforeSend(event) {
|
||||
// First apply anonymization
|
||||
const anonymizedEvent = anonymizeSentryEvent(event);
|
||||
if (!anonymizedEvent) return null;
|
||||
|
||||
// Add basic properties similar to PostHog telemetry
|
||||
if (!anonymizedEvent.tags) anonymizedEvent.tags = {};
|
||||
if (!anonymizedEvent.extra) anonymizedEvent.extra = {};
|
||||
|
||||
// Add OS information
|
||||
if (SentryLogger.os) {
|
||||
anonymizedEvent.tags.os = SentryLogger.os;
|
||||
}
|
||||
|
||||
// Add ideInfo properties spread out as top-level properties
|
||||
if (SentryLogger.ideInfo) {
|
||||
anonymizedEvent.tags.extensionVersion =
|
||||
SentryLogger.ideInfo.extensionVersion;
|
||||
anonymizedEvent.tags.ideName = SentryLogger.ideInfo.name;
|
||||
anonymizedEvent.tags.ideType = SentryLogger.ideInfo.ideType;
|
||||
anonymizedEvent.tags.ideVersion = SentryLogger.ideInfo.version;
|
||||
anonymizedEvent.tags.remoteName = SentryLogger.ideInfo.remoteName;
|
||||
anonymizedEvent.tags.isPrerelease =
|
||||
SentryLogger.ideInfo.isPrerelease;
|
||||
}
|
||||
|
||||
return anonymizedEvent;
|
||||
},
|
||||
|
||||
// Use filtered integrations for Node.js/VSCode shared environment
|
||||
integrations,
|
||||
|
||||
// Enable structured logging
|
||||
_experiments: {
|
||||
enableLogs: true,
|
||||
},
|
||||
});
|
||||
|
||||
// Create a new scope and set the client
|
||||
const scope = new Sentry.Scope();
|
||||
scope.setClient(client);
|
||||
|
||||
// Initialize the client after setting it on the scope
|
||||
client.init();
|
||||
|
||||
return { client, scope };
|
||||
} catch (error) {
|
||||
console.error("Failed to initialize Sentry client:", error);
|
||||
return { client: undefined, scope: undefined };
|
||||
}
|
||||
}
|
||||
|
||||
static async setup(
|
||||
allowAnonymousTelemetry: boolean,
|
||||
uniqueId: string,
|
||||
ideInfo: IdeInfo,
|
||||
userEmail?: string,
|
||||
) {
|
||||
// TODO: Remove Continue team member check once Sentry is ready for all users
|
||||
SentryLogger.allowTelemetry =
|
||||
allowAnonymousTelemetry && isContinueTeamMember(userEmail);
|
||||
SentryLogger.uniqueId = uniqueId;
|
||||
SentryLogger.ideInfo = ideInfo;
|
||||
SentryLogger.os = os.platform();
|
||||
|
||||
if (!SentryLogger.allowTelemetry) {
|
||||
SentryLogger.client = undefined;
|
||||
SentryLogger.scope = undefined;
|
||||
} else if (!SentryLogger.client) {
|
||||
const { client, scope } = SentryLogger.initializeSentryClient(
|
||||
ideInfo.extensionVersion,
|
||||
);
|
||||
SentryLogger.client = client;
|
||||
SentryLogger.scope = scope;
|
||||
}
|
||||
}
|
||||
|
||||
private static ensureInitialized(): void {
|
||||
if (!SentryLogger.allowTelemetry || SentryLogger.client) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SentryLogger.ideInfo) {
|
||||
const { client, scope } = SentryLogger.initializeSentryClient(
|
||||
SentryLogger.ideInfo.extensionVersion,
|
||||
);
|
||||
SentryLogger.client = client;
|
||||
SentryLogger.scope = scope;
|
||||
}
|
||||
}
|
||||
|
||||
static get lazyClient(): Sentry.NodeClient | undefined {
|
||||
SentryLogger.ensureInitialized();
|
||||
return SentryLogger.client;
|
||||
}
|
||||
|
||||
static get lazyScope(): Sentry.Scope | undefined {
|
||||
SentryLogger.ensureInitialized();
|
||||
return SentryLogger.scope;
|
||||
}
|
||||
|
||||
static shutdownSentryClient() {
|
||||
if (SentryLogger.client) {
|
||||
void SentryLogger.client.close();
|
||||
SentryLogger.client = undefined;
|
||||
SentryLogger.scope = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize Sentry for error tracking, performance monitoring, and structured logging.
|
||||
* Returns the Sentry client and scope, or undefined objects if telemetry is disabled.
|
||||
*/
|
||||
export function initializeSentry(): {
|
||||
client: Sentry.NodeClient | undefined;
|
||||
scope: Sentry.Scope | undefined;
|
||||
} {
|
||||
return {
|
||||
client: SentryLogger.lazyClient,
|
||||
scope: SentryLogger.lazyScope,
|
||||
};
|
||||
}
|
||||
|
||||
// Export utility functions for using Sentry throughout the application
|
||||
|
||||
/**
|
||||
* Create a custom span for performance monitoring
|
||||
*
|
||||
* @param operation The operation category (e.g., "http.client", "ui.click", "db.query")
|
||||
* @param name A descriptive name for the span
|
||||
* @param callback The function to execute within the span
|
||||
* @returns The result of the callback function
|
||||
*/
|
||||
export function createSpan<T>(
|
||||
operation: string,
|
||||
name: string,
|
||||
callback: () => T | Promise<T>,
|
||||
): T | Promise<T> {
|
||||
const client = SentryLogger.lazyClient;
|
||||
if (!client) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
// Use withScope from Sentry to isolate the span context
|
||||
return Sentry.withScope((isolatedScope) => {
|
||||
isolatedScope.setClient(client);
|
||||
return Sentry.startSpan(
|
||||
{
|
||||
op: operation,
|
||||
name,
|
||||
},
|
||||
() => callback(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Capture an exception and send it to Sentry
|
||||
*
|
||||
* @param error The error to capture
|
||||
* @param context Additional context information
|
||||
*/
|
||||
export function captureException(error: Error, context?: Record<string, any>) {
|
||||
const scope = SentryLogger.lazyScope;
|
||||
if (!scope) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Add context to scope if provided
|
||||
if (context) {
|
||||
scope.setExtras(context);
|
||||
}
|
||||
// Use scope's captureException to avoid global state
|
||||
scope.captureException(error);
|
||||
} catch (e) {
|
||||
console.error(`Failed to capture exception to Sentry: ${e}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Capture a structured log message and send it to Sentry
|
||||
*
|
||||
* @param message The log message
|
||||
* @param level The severity level (default: 'info')
|
||||
* @param context Additional context information
|
||||
*/
|
||||
export function captureLog(
|
||||
message: string,
|
||||
level: Sentry.SeverityLevel = "info",
|
||||
context?: Extras,
|
||||
) {
|
||||
const scope = SentryLogger.lazyScope;
|
||||
if (!scope) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Add context to scope if provided
|
||||
if (context) {
|
||||
scope.setExtras(context);
|
||||
}
|
||||
// Use scope's captureMessage to avoid global state
|
||||
scope.captureMessage(message, level);
|
||||
} catch (e) {
|
||||
console.error(`Failed to capture log to Sentry: ${e}`);
|
||||
}
|
||||
}
|
||||
174
core/util/sentry/anonymization.test.ts
Normal file
174
core/util/sentry/anonymization.test.ts
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
import {
|
||||
anonymizeFilePath,
|
||||
anonymizeSentryEvent,
|
||||
anonymizeStackTrace,
|
||||
anonymizeUserInfo,
|
||||
} from "./anonymization";
|
||||
|
||||
describe("Sentry Anonymization Utilities", () => {
|
||||
describe("anonymizeFilePath", () => {
|
||||
it("should anonymize absolute paths but preserve node_modules package names", () => {
|
||||
expect(anonymizeFilePath("/Users/john/workspace/app.js")).toBe("<file>");
|
||||
expect(anonymizeFilePath("/home/user/project/file.py")).toBe("<file>");
|
||||
expect(anonymizeFilePath("C:\\Users\\john\\Documents\\code.go")).toBe(
|
||||
"<file>",
|
||||
);
|
||||
expect(anonymizeFilePath("/project/node_modules/react/index.js")).toBe(
|
||||
"node_modules/react/<file>",
|
||||
);
|
||||
});
|
||||
|
||||
it("should keep relative paths unchanged", () => {
|
||||
expect(anonymizeFilePath("src/app.js")).toBe("src/app.js");
|
||||
expect(anonymizeFilePath("./utils/helper.py")).toBe("./utils/helper.py");
|
||||
expect(anonymizeFilePath("package/main.go")).toBe("package/main.go");
|
||||
});
|
||||
|
||||
it("should handle empty or undefined paths", () => {
|
||||
expect(anonymizeFilePath("")).toBe("");
|
||||
expect(anonymizeFilePath(undefined as any)).toBe(undefined);
|
||||
expect(anonymizeFilePath(null as any)).toBe(null);
|
||||
});
|
||||
});
|
||||
|
||||
describe("anonymizeStackTrace", () => {
|
||||
it("should anonymize stack frame filenames", () => {
|
||||
const frames = [
|
||||
{
|
||||
filename: "/Users/john/project/app.js",
|
||||
abs_path: "/Users/john/project/app.js",
|
||||
function: "myFunction",
|
||||
lineno: 42,
|
||||
vars: { secret: "password123" },
|
||||
pre_context: ['const secret = "password123"'],
|
||||
post_context: ["console.log(secret)"],
|
||||
context_line: 'throw new Error("test")',
|
||||
},
|
||||
];
|
||||
|
||||
const result = anonymizeStackTrace(frames);
|
||||
|
||||
expect(result[0].filename).toBe("<file>");
|
||||
expect(result[0].abs_path).toBe(""); // Always cleared like Rasa
|
||||
expect(result[0].vars).toBeUndefined();
|
||||
expect(result[0].pre_context).toBeUndefined();
|
||||
expect(result[0].post_context).toBeUndefined();
|
||||
expect(result[0].context_line).toBe("<code>");
|
||||
expect(result[0].function).toBe("myFunction"); // Preserve function name
|
||||
expect(result[0].lineno).toBe(42); // Preserve line number
|
||||
});
|
||||
|
||||
it("should handle non-array input", () => {
|
||||
expect(anonymizeStackTrace(null as any)).toBe(null);
|
||||
expect(anonymizeStackTrace(undefined as any)).toBe(undefined);
|
||||
expect(anonymizeStackTrace("not-array" as any)).toBe("not-array");
|
||||
});
|
||||
});
|
||||
|
||||
describe("anonymizeUserInfo", () => {
|
||||
it("should hash user ID and remove other info", () => {
|
||||
const user = {
|
||||
id: "real-machine-id-12345",
|
||||
username: "john.doe",
|
||||
email: "john@example.com",
|
||||
ip_address: "192.168.1.100",
|
||||
};
|
||||
|
||||
const result = anonymizeUserInfo(user);
|
||||
|
||||
expect(result.id).not.toBe("real-machine-id-12345");
|
||||
expect(result.id).toMatch(/^[a-f0-9]{8}$/); // 8-char hash
|
||||
expect(result.username).toBeUndefined();
|
||||
expect(result.email).toBeUndefined();
|
||||
expect(result.ip_address).toBeUndefined();
|
||||
});
|
||||
|
||||
it("should handle null/undefined user", () => {
|
||||
expect(anonymizeUserInfo(null)).toBe(null);
|
||||
expect(anonymizeUserInfo(undefined)).toBe(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe("anonymizeSentryEvent (integration)", () => {
|
||||
it("should anonymize events with user file paths", () => {
|
||||
const event: any = {
|
||||
exception: {
|
||||
values: [
|
||||
{
|
||||
stacktrace: {
|
||||
frames: [
|
||||
{
|
||||
filename: "/Users/john/workspace/app.js",
|
||||
abs_path: "/Users/john/workspace/app.js",
|
||||
vars: { secret: "password" },
|
||||
context_line: 'throw new Error("test")',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
user: {
|
||||
id: "machine-id-12345",
|
||||
username: "john",
|
||||
},
|
||||
contexts: {
|
||||
os: {
|
||||
environment: { HOME: "/Users/john" },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const result = anonymizeSentryEvent(event);
|
||||
|
||||
expect(result).not.toBeNull();
|
||||
expect(result.exception.values[0].stacktrace.frames[0].filename).toBe(
|
||||
"<file>",
|
||||
);
|
||||
expect(result.exception.values[0].stacktrace.frames[0].abs_path).toBe("");
|
||||
expect(
|
||||
result.exception.values[0].stacktrace.frames[0].vars,
|
||||
).toBeUndefined();
|
||||
expect(result.exception.values[0].stacktrace.frames[0].context_line).toBe(
|
||||
"<code>",
|
||||
);
|
||||
expect(result.user.id).toMatch(/^[a-f0-9]{8}$/);
|
||||
expect(result.user.username).toBeUndefined();
|
||||
expect(result.contexts.os.environment).toBeUndefined();
|
||||
});
|
||||
|
||||
it("should handle malformed events gracefully", () => {
|
||||
const malformedEvent: any = {
|
||||
exception: {
|
||||
values: null,
|
||||
},
|
||||
user: null,
|
||||
breadcrumbs: "not-an-array",
|
||||
tags: null,
|
||||
extra: null,
|
||||
};
|
||||
|
||||
const result = anonymizeSentryEvent(malformedEvent);
|
||||
expect(result).not.toBeNull(); // Should not crash
|
||||
});
|
||||
|
||||
it("should return null on anonymization errors", () => {
|
||||
// Create a circular reference that would cause issues
|
||||
const circularEvent: any = {
|
||||
message: "Test event",
|
||||
};
|
||||
circularEvent.circular = circularEvent;
|
||||
|
||||
// Mock console.error to avoid noise in tests
|
||||
const originalConsoleError = console.error;
|
||||
console.error = jest.fn();
|
||||
|
||||
const result = anonymizeSentryEvent(circularEvent);
|
||||
|
||||
// Should handle gracefully without crashing
|
||||
expect(result).not.toBeNull(); // Our implementation might handle this
|
||||
|
||||
console.error = originalConsoleError;
|
||||
});
|
||||
});
|
||||
});
|
||||
132
core/util/sentry/anonymization.ts
Normal file
132
core/util/sentry/anonymization.ts
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
import { ErrorEvent } from "@sentry/core";
|
||||
/**
|
||||
* Minimalist Sentry anonymization utilities
|
||||
*/
|
||||
|
||||
// Browser-compatible hash function (avoids Node.js crypto dependency)
|
||||
function simpleHash(input: string): string {
|
||||
let hash = 0;
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
const char = input.charCodeAt(i);
|
||||
hash = (hash << 5) - hash + char;
|
||||
hash = hash & hash; // Convert to 32-bit integer
|
||||
}
|
||||
return Math.abs(hash).toString(16).substring(0, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Anonymize file paths - keep package names, remove user paths
|
||||
*/
|
||||
export function anonymizeFilePath(filePath: string): string {
|
||||
if (!filePath) return filePath;
|
||||
|
||||
const normalized = filePath.replace(/\\/g, "/");
|
||||
|
||||
// Keep node_modules package names for debugging
|
||||
if (normalized.includes("node_modules")) {
|
||||
const match = normalized.match(/node_modules\/([^\/]+)/);
|
||||
if (match) {
|
||||
return `node_modules/${match[1]}/<file>`;
|
||||
}
|
||||
}
|
||||
|
||||
// Replace absolute paths with generic identifier
|
||||
if (normalized.startsWith("/") || normalized.match(/^[A-Za-z]:/)) {
|
||||
return "<file>";
|
||||
}
|
||||
|
||||
return normalized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean stack trace frames - remove sensitive data but keep the event
|
||||
*/
|
||||
export function anonymizeStackTrace(frames: any[]): any[] {
|
||||
if (!Array.isArray(frames)) return frames;
|
||||
|
||||
return frames.map((frame) => ({
|
||||
...frame,
|
||||
filename: frame.filename
|
||||
? anonymizeFilePath(frame.filename)
|
||||
: frame.filename,
|
||||
abs_path: "",
|
||||
// Remove local variables and source code context
|
||||
vars: undefined,
|
||||
pre_context: undefined,
|
||||
post_context: undefined,
|
||||
context_line: frame.context_line ? "<code>" : frame.context_line,
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Anonymize user information - hash ID, remove PII
|
||||
*/
|
||||
export function anonymizeUserInfo(user: any): any {
|
||||
if (!user) return user;
|
||||
|
||||
return {
|
||||
id: user.id ? simpleHash(String(user.id)) : user.id,
|
||||
username: undefined,
|
||||
email: undefined,
|
||||
ip_address: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Main anonymization function - minimalist approach like Rasa
|
||||
*/
|
||||
export function anonymizeSentryEvent(event: ErrorEvent): any | null {
|
||||
try {
|
||||
// Deep copy to avoid mutating the original event
|
||||
const anonymized = structuredClone(event);
|
||||
|
||||
// Clean exception stack traces
|
||||
if (anonymized.exception?.values) {
|
||||
anonymized.exception.values = anonymized.exception.values.map(
|
||||
(exception: any) => ({
|
||||
...exception,
|
||||
stacktrace: exception.stacktrace
|
||||
? {
|
||||
...exception.stacktrace,
|
||||
frames: exception.stacktrace.frames
|
||||
? anonymizeStackTrace(exception.stacktrace.frames)
|
||||
: exception.stacktrace.frames,
|
||||
}
|
||||
: exception.stacktrace,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
// Clean thread stack traces
|
||||
if (anonymized.threads?.values) {
|
||||
anonymized.threads.values = anonymized.threads.values.map(
|
||||
(thread: any) => ({
|
||||
...thread,
|
||||
stacktrace: thread.stacktrace
|
||||
? {
|
||||
...thread.stacktrace,
|
||||
frames: thread.stacktrace.frames
|
||||
? anonymizeStackTrace(thread.stacktrace.frames)
|
||||
: thread.stacktrace.frames,
|
||||
}
|
||||
: thread.stacktrace,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
// Anonymize user info
|
||||
if (anonymized.user) {
|
||||
anonymized.user = anonymizeUserInfo(anonymized.user);
|
||||
}
|
||||
|
||||
// Remove OS environment variables
|
||||
if (anonymized.contexts?.os?.environment) {
|
||||
anonymized.contexts.os.environment = undefined;
|
||||
}
|
||||
|
||||
return anonymized;
|
||||
} catch (error) {
|
||||
console.error("Error anonymizing Sentry event:", error);
|
||||
return null; // Drop event if anonymization fails
|
||||
}
|
||||
}
|
||||
5
core/util/sentry/constants.ts
Normal file
5
core/util/sentry/constants.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/**
|
||||
* Sentry configuration constants
|
||||
*/
|
||||
export const SENTRY_DSN =
|
||||
"https://fe99934dcdc537d84209893a3f96a196@o4505462064283648.ingest.us.sentry.io/4508184596054016";
|
||||
|
|
@ -695,7 +695,7 @@
|
|||
"e2e:copy-vsix": "chmod +x ./e2e/get-latest-vsix.sh && bash ./e2e/get-latest-vsix.sh",
|
||||
"e2e:install-vsix": "extest install-vsix -f ./e2e/vsix/continue.vsix --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage",
|
||||
"e2e:install-extensions": "extest install-from-marketplace ms-vscode-remote.remote-ssh --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage && extest install-from-marketplace ms-vscode-remote.remote-containers --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage && extest install-from-marketplace ms-vscode-remote.remote-wsl --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage",
|
||||
"e2e:test": "extest run-tests ${TEST_FILE:-'./e2e/_output/tests/*.test.js'} --code_settings settings.json --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage",
|
||||
"e2e:test": "NODE_ENV=e2e extest run-tests ${TEST_FILE:-'./e2e/_output/tests/*.test.js'} --code_settings settings.json --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage",
|
||||
"e2e:clean": "rm -rf ./e2e/_output ./e2e/storage",
|
||||
"e2e:all": "npm run e2e:build && npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:sign-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean",
|
||||
"e2e:all-non-mac": "npm run e2e:build && npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean",
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { extractMinimalStackTraceInfo } from "core/util/extractMinimalStackTrace
|
|||
import { Telemetry } from "core/util/posthog";
|
||||
import * as vscode from "vscode";
|
||||
|
||||
import { SentryLogger } from "core/util/sentry/SentryLogger";
|
||||
import { getExtensionVersion } from "./util/util";
|
||||
export { default as buildTimestamp } from "./.buildTimestamp";
|
||||
|
||||
|
|
@ -46,7 +47,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
}
|
||||
|
||||
export function deactivate() {
|
||||
Telemetry.capture(
|
||||
void Telemetry.capture(
|
||||
"deactivate",
|
||||
{
|
||||
extensionVersion: getExtensionVersion(),
|
||||
|
|
@ -55,4 +56,5 @@ export function deactivate() {
|
|||
);
|
||||
|
||||
Telemetry.shutdownPosthogClient();
|
||||
SentryLogger.shutdownSentryClient();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import crypto from "crypto";
|
||||
import { EventEmitter as NodeEventEmitter } from "node:events";
|
||||
|
||||
import {
|
||||
AuthType,
|
||||
|
|
@ -7,8 +8,8 @@ import {
|
|||
isHubEnv,
|
||||
} from "core/control-plane/AuthTypes";
|
||||
import { getControlPlaneEnvSync } from "core/control-plane/env";
|
||||
import { Logger } from "core/util/Logger";
|
||||
import fetch from "node-fetch";
|
||||
import { EventEmitter as NodeEventEmitter } from "node:events";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import {
|
||||
authentication,
|
||||
|
|
@ -121,6 +122,13 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable {
|
|||
);
|
||||
return decodedToken;
|
||||
} catch (e: any) {
|
||||
// Capture JWT decoding failures to Sentry (could indicate token corruption)
|
||||
Logger.error(e, {
|
||||
context: "workOS_auth_jwt_decode",
|
||||
jwtLength: jwt.length,
|
||||
jwtPrefix: jwt.substring(0, 20) + "...", // Safe prefix for debugging
|
||||
});
|
||||
|
||||
console.warn(`Error decoding JWT: ${e}`);
|
||||
return null;
|
||||
}
|
||||
|
|
@ -162,6 +170,12 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable {
|
|||
const value = JSON.parse(data) as ContinueAuthenticationSession[];
|
||||
return value;
|
||||
} catch (e: any) {
|
||||
// Capture session file parsing errors to Sentry
|
||||
Logger.error(e, {
|
||||
context: "workOS_sessions_json_parse",
|
||||
dataLength: data.length,
|
||||
});
|
||||
|
||||
console.warn(`Error parsing sessions.json: ${e}`);
|
||||
return [];
|
||||
}
|
||||
|
|
@ -200,6 +214,12 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable {
|
|||
this._isRefreshing = true;
|
||||
await this._refreshSessions();
|
||||
} catch (e) {
|
||||
// Capture session refresh failures to Sentry
|
||||
Logger.error(e, {
|
||||
context: "workOS_auth_session_refresh",
|
||||
authType: controlPlaneEnv.AUTH_TYPE,
|
||||
});
|
||||
|
||||
console.error(`Error refreshing sessions: ${e}`);
|
||||
} finally {
|
||||
this._isRefreshing = false;
|
||||
|
|
@ -228,6 +248,12 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable {
|
|||
expiresInMs: newSession.expiresInMs,
|
||||
});
|
||||
} catch (e: any) {
|
||||
// Capture individual session refresh failures to Sentry
|
||||
Logger.error(e, {
|
||||
context: "workOS_individual_session_refresh",
|
||||
sessionId: session.id,
|
||||
});
|
||||
|
||||
// If refresh fails (after retries for valid tokens), drop the session
|
||||
console.debug(`Error refreshing session token: ${e.message}`);
|
||||
this._sessionChangeEmitter.fire({
|
||||
|
|
@ -258,6 +284,16 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable {
|
|||
try {
|
||||
return await this._refreshSession(refreshToken);
|
||||
} catch (error: any) {
|
||||
// Capture token refresh retry errors to Sentry
|
||||
Logger.error(error, {
|
||||
attempt,
|
||||
errorMessage: error.message,
|
||||
isAuthError:
|
||||
error.message?.includes("401") ||
|
||||
error.message?.includes("Invalid refresh token") ||
|
||||
error.message?.includes("Unauthorized"),
|
||||
});
|
||||
|
||||
this.attemptEmitter.emit("attempted");
|
||||
// Don't retry for auth errors
|
||||
if (
|
||||
|
|
@ -374,6 +410,13 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable {
|
|||
|
||||
return session;
|
||||
} catch (e) {
|
||||
// Capture authentication failures to Sentry
|
||||
Logger.error(e, {
|
||||
context: "workOS_auth_session_creation",
|
||||
scopes: scopes.join(","),
|
||||
authType: controlPlaneEnv.AUTH_TYPE,
|
||||
});
|
||||
|
||||
void window.showErrorMessage(`Sign in failed: ${e}`);
|
||||
throw e;
|
||||
}
|
||||
|
|
|
|||
4
gui/.gitignore
vendored
4
gui/.gitignore
vendored
|
|
@ -24,4 +24,6 @@ dist-ssr
|
|||
*.sw?
|
||||
|
||||
# test result files
|
||||
coverage
|
||||
coverage
|
||||
# Sentry Config File
|
||||
.env.sentry-build-plugin
|
||||
|
|
|
|||
643
gui/package-lock.json
generated
643
gui/package-lock.json
generated
|
|
@ -12,6 +12,8 @@
|
|||
"@heroicons/react": "^2.0.18",
|
||||
"@panzoom/panzoom": "^4.6.0",
|
||||
"@reduxjs/toolkit": "^2.3.0",
|
||||
"@sentry/react": "^9.43.0",
|
||||
"@sentry/vite-plugin": "^4.0.2",
|
||||
"@tiptap/core": "^2.3.2",
|
||||
"@tiptap/extension-document": "^2.3.2",
|
||||
"@tiptap/extension-dropcursor": "^2.1.16",
|
||||
|
|
@ -73,8 +75,8 @@
|
|||
"@swc/cli": "^0.3.14",
|
||||
"@swc/core": "^1.7.26",
|
||||
"@testing-library/dom": "^10.4.0",
|
||||
"@testing-library/jest-dom": "^6.5.0",
|
||||
"@testing-library/react": "^16.0.1",
|
||||
"@testing-library/jest-dom": "^6.6.4",
|
||||
"@testing-library/react": "^16.3.0",
|
||||
"@testing-library/user-event": "^14.5.2",
|
||||
"@types/dompurify": "^3.2.0",
|
||||
"@types/lodash": "^4.17.6",
|
||||
|
|
@ -122,6 +124,11 @@
|
|||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.1.1",
|
||||
"@sentry/cli": "^2.50.2",
|
||||
"@sentry/core": "^9.43.0",
|
||||
"@sentry/esbuild-plugin": "^4.0.2",
|
||||
"@sentry/node": "^9.43.0",
|
||||
"@sentry/vite-plugin": "^4.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
"@xenova/transformers": "2.14.0",
|
||||
"adf-to-md": "^1.1.0",
|
||||
|
|
@ -332,7 +339,6 @@
|
|||
"version": "7.25.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.25.4.tgz",
|
||||
"integrity": "sha512-+LGRog6RAsCJrrrg/IO6LGmpphNe5DiK30dGjCoxxeGv49B10/3XYGxPsAwrDlMFcFEvdAUavDT8r9k/hSyQqQ==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
|
|
@ -341,7 +347,6 @@
|
|||
"version": "7.25.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.25.2.tgz",
|
||||
"integrity": "sha512-BBt3opiCOxUr9euZ5/ro/Xv8/V7yJ5bjYMqG/C1YAo8MIKAnumZalCN+msbci3Pigy4lIQfPUpfMM27HMGaYEA==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@ampproject/remapping": "^2.2.0",
|
||||
"@babel/code-frame": "^7.24.7",
|
||||
|
|
@ -371,7 +376,6 @@
|
|||
"version": "6.3.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
|
||||
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
}
|
||||
|
|
@ -405,7 +409,6 @@
|
|||
"version": "7.25.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.2.tgz",
|
||||
"integrity": "sha512-U2U5LsSaZ7TAt3cfaymQ8WHh0pxvdHoEk6HVpaexxixjyEquMh0L0YNJNM6CTGKMXV1iksi0iZkGw4AcFkPaaw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/compat-data": "^7.25.2",
|
||||
"@babel/helper-validator-option": "^7.24.8",
|
||||
|
|
@ -421,7 +424,6 @@
|
|||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
|
||||
"integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"yallist": "^3.0.2"
|
||||
}
|
||||
|
|
@ -430,7 +432,6 @@
|
|||
"version": "6.3.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
|
||||
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
}
|
||||
|
|
@ -438,8 +439,7 @@
|
|||
"node_modules/@babel/helper-compilation-targets/node_modules/yallist": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
||||
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
|
||||
"peer": true
|
||||
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="
|
||||
},
|
||||
"node_modules/@babel/helper-module-imports": {
|
||||
"version": "7.24.7",
|
||||
|
|
@ -457,7 +457,6 @@
|
|||
"version": "7.25.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.25.2.tgz",
|
||||
"integrity": "sha512-BjyRAbix6j/wv83ftcVJmBt72QtHI56C7JXZoG2xATiLpmoC7dpd8WnkikExHDVPpi/3qCmO6WY1EaXOluiecQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-module-imports": "^7.24.7",
|
||||
"@babel/helper-simple-access": "^7.24.7",
|
||||
|
|
@ -483,7 +482,6 @@
|
|||
"version": "7.24.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz",
|
||||
"integrity": "sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/traverse": "^7.24.7",
|
||||
"@babel/types": "^7.24.7"
|
||||
|
|
@ -514,7 +512,6 @@
|
|||
"version": "7.24.8",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz",
|
||||
"integrity": "sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
|
|
@ -524,7 +521,6 @@
|
|||
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.10.tgz",
|
||||
"integrity": "sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/template": "^7.26.9",
|
||||
"@babel/types": "^7.26.10"
|
||||
|
|
@ -2327,6 +2323,398 @@
|
|||
"win32"
|
||||
]
|
||||
},
|
||||
"node_modules/@sentry-internal/browser-utils": {
|
||||
"version": "9.43.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-9.43.0.tgz",
|
||||
"integrity": "sha512-DLv10USYC0w+2ap5GlxlBYTe5dTylzFZB6WHi3kpuYpjUwdye8/G88K8ZDqdMFr73XUFDxRJbOihXOb0vDQNRQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry/core": "9.43.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry-internal/feedback": {
|
||||
"version": "9.43.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-9.43.0.tgz",
|
||||
"integrity": "sha512-yAZvSB/85jZT9bZf/NOXYh8+CkUIqPfPma4b3Kvq6QZE2Xp/WP80YvZHgoh+KA5gSK0d3uAqkSdj0cQF9wpGEg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry/core": "9.43.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry-internal/replay": {
|
||||
"version": "9.43.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-9.43.0.tgz",
|
||||
"integrity": "sha512-I9kQfoSiVq8zzCzfJAlBGFZftIKZxFX9Hv4M+jskzoCQwTfcGWY5qmGyX+KEzLAI/39onV7S1p8x/iAVlSICuA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry-internal/browser-utils": "9.43.0",
|
||||
"@sentry/core": "9.43.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry-internal/replay-canvas": {
|
||||
"version": "9.43.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-9.43.0.tgz",
|
||||
"integrity": "sha512-cs1yClG5bwL1+lMn2i9v8UiuWiBbu7OS+pD9xePjNYNWywRU0JJ9mTNC2HPP7ic9kDr7vDZy2hRNaDd2IDgF4g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry-internal/replay": "9.43.0",
|
||||
"@sentry/core": "9.43.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/babel-plugin-component-annotate": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/babel-plugin-component-annotate/-/babel-plugin-component-annotate-4.0.2.tgz",
|
||||
"integrity": "sha512-Nr/VamvpQs6w642EI5t+qaCUGnVEro0qqk+S8XO1gc8qSdpc8kkZJFnUk7ozAr+ljYWGfVgWXrxI9lLiriLsRA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/browser": {
|
||||
"version": "9.43.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-9.43.0.tgz",
|
||||
"integrity": "sha512-F+zMc+ratJ1MqV9YQqkrHqC+rED3meWHgO7+C6bYG5HPynCYqIGapJFNmFFC57pbU8lT191CiMgBWYT6DuMduw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry-internal/browser-utils": "9.43.0",
|
||||
"@sentry-internal/feedback": "9.43.0",
|
||||
"@sentry-internal/replay": "9.43.0",
|
||||
"@sentry-internal/replay-canvas": "9.43.0",
|
||||
"@sentry/core": "9.43.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/bundler-plugin-core": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/bundler-plugin-core/-/bundler-plugin-core-4.0.2.tgz",
|
||||
"integrity": "sha512-LeARs8qHhEw19tk+KZd9DDV+Rh/UeapIH0+C09fTmff9p8Y82Cj89pEQ2a1rdUiF/oYIjQX45vnZscB7ra42yw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.18.5",
|
||||
"@sentry/babel-plugin-component-annotate": "4.0.2",
|
||||
"@sentry/cli": "^2.49.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"find-up": "^5.0.0",
|
||||
"glob": "^9.3.2",
|
||||
"magic-string": "0.30.8",
|
||||
"unplugin": "1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/bundler-plugin-core/node_modules/glob": {
|
||||
"version": "9.3.5",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-9.3.5.tgz",
|
||||
"integrity": "sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"minimatch": "^8.0.2",
|
||||
"minipass": "^4.2.4",
|
||||
"path-scurry": "^1.6.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/bundler-plugin-core/node_modules/magic-string": {
|
||||
"version": "0.30.8",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.8.tgz",
|
||||
"integrity": "sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/sourcemap-codec": "^1.4.15"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/bundler-plugin-core/node_modules/minimatch": {
|
||||
"version": "8.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.4.tgz",
|
||||
"integrity": "sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"brace-expansion": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/bundler-plugin-core/node_modules/minipass": {
|
||||
"version": "4.2.8",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz",
|
||||
"integrity": "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/cli": {
|
||||
"version": "2.50.2",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/cli/-/cli-2.50.2.tgz",
|
||||
"integrity": "sha512-m1L9shxutF3WHSyNld6Y1vMPoXfEyQhoRh1V3SYSdl+4AB40U+zr2sRzFa2OPm7XP4zYNaWuuuHLkY/iHITs8Q==",
|
||||
"hasInstallScript": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"https-proxy-agent": "^5.0.0",
|
||||
"node-fetch": "^2.6.7",
|
||||
"progress": "^2.0.3",
|
||||
"proxy-from-env": "^1.1.0",
|
||||
"which": "^2.0.2"
|
||||
},
|
||||
"bin": {
|
||||
"sentry-cli": "bin/sentry-cli"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@sentry/cli-darwin": "2.50.2",
|
||||
"@sentry/cli-linux-arm": "2.50.2",
|
||||
"@sentry/cli-linux-arm64": "2.50.2",
|
||||
"@sentry/cli-linux-i686": "2.50.2",
|
||||
"@sentry/cli-linux-x64": "2.50.2",
|
||||
"@sentry/cli-win32-arm64": "2.50.2",
|
||||
"@sentry/cli-win32-i686": "2.50.2",
|
||||
"@sentry/cli-win32-x64": "2.50.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/cli-darwin": {
|
||||
"version": "2.50.2",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/cli-darwin/-/cli-darwin-2.50.2.tgz",
|
||||
"integrity": "sha512-0Pjpl0vQqKhwuZm19z6AlEF+ds3fJg1KWabv8WzGaSc/fwxMEwjFwOZj+IxWBJPV578cXXNvB39vYjjpCH8j7A==",
|
||||
"license": "BSD-3-Clause",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/cli-linux-arm": {
|
||||
"version": "2.50.2",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm/-/cli-linux-arm-2.50.2.tgz",
|
||||
"integrity": "sha512-jzFwg9AeeuFAFtoCcyaDEPG05TU02uOy1nAX09c1g7FtsyQlPcbhI94JQGmnPzdRjjDmORtwIUiVZQrVTkDM7w==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux",
|
||||
"freebsd",
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/cli-linux-arm64": {
|
||||
"version": "2.50.2",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.50.2.tgz",
|
||||
"integrity": "sha512-03Cj215M3IdoHAwevCxm5oOm9WICFpuLR05DQnODFCeIUsGvE1pZsc+Gm0Ky/ZArq2PlShBJTpbHvXbCUka+0w==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux",
|
||||
"freebsd",
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/cli-linux-i686": {
|
||||
"version": "2.50.2",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/cli-linux-i686/-/cli-linux-i686-2.50.2.tgz",
|
||||
"integrity": "sha512-J+POvB34uVyHbIYF++Bc/OCLw+gqKW0H/y/mY7rRZCiocgpk266M4NtsOBl6bEaurMx1D+BCIEjr4nc01I/rqA==",
|
||||
"cpu": [
|
||||
"x86",
|
||||
"ia32"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux",
|
||||
"freebsd",
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/cli-linux-x64": {
|
||||
"version": "2.50.2",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/cli-linux-x64/-/cli-linux-x64-2.50.2.tgz",
|
||||
"integrity": "sha512-81yQVRLj8rnuHoYcrM7QbOw8ubA3weiMdPtTxTim1s6WExmPgnPTKxLCr9xzxGJxFdYo3xIOhtf5JFpUX/3j4A==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux",
|
||||
"freebsd",
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/cli-win32-arm64": {
|
||||
"version": "2.50.2",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/cli-win32-arm64/-/cli-win32-arm64-2.50.2.tgz",
|
||||
"integrity": "sha512-QjentLGvpibgiZlmlV9ifZyxV73lnGH6pFZWU5wLeRiaYKxWtNrrHpVs+HiWlRhkwQ0mG1/S40PGNgJ20DJ3gA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/cli-win32-i686": {
|
||||
"version": "2.50.2",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/cli-win32-i686/-/cli-win32-i686-2.50.2.tgz",
|
||||
"integrity": "sha512-UkBIIzkQkQ1UkjQX8kHm/+e7IxnEhK6CdgSjFyNlxkwALjDWHJjMztevqAPz3kv4LdM6q1MxpQ/mOqXICNhEGg==",
|
||||
"cpu": [
|
||||
"x86",
|
||||
"ia32"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/cli-win32-x64": {
|
||||
"version": "2.50.2",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/cli-win32-x64/-/cli-win32-x64-2.50.2.tgz",
|
||||
"integrity": "sha512-tE27pu1sRRub1Jpmemykv3QHddBcyUk39Fsvv+n4NDpQyMgsyVPcboxBZyby44F0jkpI/q3bUH2tfCB1TYDNLg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/cli/node_modules/agent-base": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
|
||||
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/cli/node_modules/https-proxy-agent": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
|
||||
"integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"agent-base": "6",
|
||||
"debug": "4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/cli/node_modules/which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"isexe": "^2.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"node-which": "bin/node-which"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/core": {
|
||||
"version": "9.43.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-9.43.0.tgz",
|
||||
"integrity": "sha512-xuvERSUkSNBAldIlgihX3fz+JkcaAPvg0HulPtv3BH9qrKqvataeQ8TiTnqiRC7kWzF7EcxhQJ6WJRl/r3aH3w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/react": {
|
||||
"version": "9.43.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/react/-/react-9.43.0.tgz",
|
||||
"integrity": "sha512-bDJ1piXH1IPzyPypxnw/hWUVKk5xgeOKVvYJEFO9ypACKDpitgsskl7QasAmxKd1ghvbULgYksyUy5Zpaiu2cg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry/browser": "9.43.0",
|
||||
"@sentry/core": "9.43.0",
|
||||
"hoist-non-react-statics": "^3.3.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.14.0 || 17.x || 18.x || 19.x"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/vite-plugin": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/vite-plugin/-/vite-plugin-4.0.2.tgz",
|
||||
"integrity": "sha512-rStdvDGj0VcJBsl2NANE3OQF5m13VCJ+2Ovs5pb2LAqOW72/1GLmef9Mo3b9BwzCjWOQIcgtllwOfSV5Pse03w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry/bundler-plugin-core": "4.0.2",
|
||||
"unplugin": "1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/@sindresorhus/is": {
|
||||
"version": "4.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
|
||||
|
|
@ -2726,17 +3114,18 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@testing-library/jest-dom": {
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.5.0.tgz",
|
||||
"integrity": "sha512-xGGHpBXYSHUUr6XsKBfs85TWlYKpTc37cSBBVrXcib2MkHLboWlkClhWF37JKlDb9KEq3dHs+f2xR7XJEWGBxA==",
|
||||
"version": "6.6.4",
|
||||
"resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.6.4.tgz",
|
||||
"integrity": "sha512-xDXgLjVunjHqczScfkCJ9iyjdNOVHvvCdqHSSxwM9L0l/wHkTRum67SDc020uAlCoqktJplgO2AAQeLP1wgqDQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@adobe/css-tools": "^4.4.0",
|
||||
"aria-query": "^5.0.0",
|
||||
"chalk": "^3.0.0",
|
||||
"css.escape": "^1.5.1",
|
||||
"dom-accessibility-api": "^0.6.3",
|
||||
"lodash": "^4.17.21",
|
||||
"picocolors": "^1.1.1",
|
||||
"redent": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
|
|
@ -2745,84 +3134,18 @@
|
|||
"yarn": ">=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/jest-dom/node_modules/ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/jest-dom/node_modules/chalk": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
|
||||
"integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/jest-dom/node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/jest-dom/node_modules/color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@testing-library/jest-dom/node_modules/dom-accessibility-api": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz",
|
||||
"integrity": "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@testing-library/jest-dom/node_modules/has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/jest-dom/node_modules/supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has-flag": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/react": {
|
||||
"version": "16.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.0.1.tgz",
|
||||
"integrity": "sha512-dSmwJVtJXmku+iocRhWOUFbrERC76TX2Mnf0ATODz8brzAZrMBbzLwQixlBSanZxR6LddK3eiwpSFZgDET1URg==",
|
||||
"version": "16.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.3.0.tgz",
|
||||
"integrity": "sha512-kFSyxiEDwv1WLl2fgsq6pPBbw5aWKrsY2/noi1Id0TK0UParSF62oFQFGHXIyaG4pp2tEub/Zlel+fjjZILDsw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5"
|
||||
},
|
||||
|
|
@ -2831,10 +3154,10 @@
|
|||
},
|
||||
"peerDependencies": {
|
||||
"@testing-library/dom": "^10.0.0",
|
||||
"@types/react": "^18.0.0",
|
||||
"@types/react-dom": "^18.0.0",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0"
|
||||
"@types/react": "^18.0.0 || ^19.0.0",
|
||||
"@types/react-dom": "^18.0.0 || ^19.0.0",
|
||||
"react": "^18.0.0 || ^19.0.0",
|
||||
"react-dom": "^18.0.0 || ^19.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
|
|
@ -4179,7 +4502,6 @@
|
|||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
|
||||
"integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"normalize-path": "^3.0.0",
|
||||
"picomatch": "^2.0.4"
|
||||
|
|
@ -4460,8 +4782,7 @@
|
|||
"node_modules/balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||
},
|
||||
"node_modules/bcp-47-match": {
|
||||
"version": "1.0.3",
|
||||
|
|
@ -4641,7 +4962,6 @@
|
|||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
|
||||
"integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
|
|
@ -4658,7 +4978,6 @@
|
|||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
||||
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0"
|
||||
}
|
||||
|
|
@ -4667,7 +4986,6 @@
|
|||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
|
||||
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"fill-range": "^7.1.1"
|
||||
},
|
||||
|
|
@ -4922,7 +5240,6 @@
|
|||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
|
||||
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"anymatch": "~3.1.2",
|
||||
"braces": "~3.0.2",
|
||||
|
|
@ -5028,8 +5345,7 @@
|
|||
"node_modules/convert-source-map": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
|
||||
"integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
|
||||
"peer": true
|
||||
"integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="
|
||||
},
|
||||
"node_modules/core": {
|
||||
"resolved": "../core",
|
||||
|
|
@ -5909,6 +6225,18 @@
|
|||
"@types/trusted-types": "^2.0.7"
|
||||
}
|
||||
},
|
||||
"node_modules/dotenv": {
|
||||
"version": "16.6.1",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",
|
||||
"integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",
|
||||
"license": "BSD-2-Clause",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://dotenvx.com"
|
||||
}
|
||||
},
|
||||
"node_modules/downshift": {
|
||||
"version": "7.6.2",
|
||||
"resolved": "https://registry.npmjs.org/downshift/-/downshift-7.6.2.tgz",
|
||||
|
|
@ -6888,7 +7216,6 @@
|
|||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
|
||||
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"to-regex-range": "^5.0.1"
|
||||
},
|
||||
|
|
@ -6900,7 +7227,6 @@
|
|||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
|
||||
"integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"locate-path": "^6.0.0",
|
||||
"path-exists": "^4.0.0"
|
||||
|
|
@ -7082,14 +7408,12 @@
|
|||
"node_modules/fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -7139,7 +7463,6 @@
|
|||
"version": "1.0.0-beta.2",
|
||||
"resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
|
||||
"integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
|
|
@ -7213,7 +7536,6 @@
|
|||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"is-glob": "^4.0.1"
|
||||
},
|
||||
|
|
@ -8182,7 +8504,6 @@
|
|||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
|
||||
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"binary-extensions": "^2.0.0"
|
||||
},
|
||||
|
|
@ -8298,7 +8619,6 @@
|
|||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
|
|
@ -8345,7 +8665,6 @@
|
|||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
|
||||
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"is-extglob": "^2.1.1"
|
||||
},
|
||||
|
|
@ -8390,7 +8709,6 @@
|
|||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
|
||||
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.12.0"
|
||||
}
|
||||
|
|
@ -8580,8 +8898,7 @@
|
|||
"node_modules/isexe": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
|
||||
},
|
||||
"node_modules/istanbul-lib-coverage": {
|
||||
"version": "3.2.2",
|
||||
|
|
@ -8804,7 +9121,6 @@
|
|||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
|
||||
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"json5": "lib/cli.js"
|
||||
},
|
||||
|
|
@ -8942,7 +9258,6 @@
|
|||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
|
||||
"integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"p-locate": "^5.0.0"
|
||||
},
|
||||
|
|
@ -9928,7 +10243,6 @@
|
|||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
|
||||
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
}
|
||||
|
|
@ -10037,6 +10351,48 @@
|
|||
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch/node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/node-fetch/node_modules/webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
|
||||
"license": "BSD-2-Clause"
|
||||
},
|
||||
"node_modules/node-fetch/node_modules/whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-releases": {
|
||||
"version": "2.0.18",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz",
|
||||
|
|
@ -10046,7 +10402,6 @@
|
|||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
||||
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
|
|
@ -10291,7 +10646,6 @@
|
|||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
|
||||
"integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"yocto-queue": "^0.1.0"
|
||||
},
|
||||
|
|
@ -10306,7 +10660,6 @@
|
|||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
|
||||
"integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"p-limit": "^3.0.2"
|
||||
},
|
||||
|
|
@ -10386,7 +10739,6 @@
|
|||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
|
|
@ -10419,7 +10771,6 @@
|
|||
"version": "1.11.1",
|
||||
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
|
||||
"integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"lru-cache": "^10.2.0",
|
||||
"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
|
||||
|
|
@ -10434,8 +10785,7 @@
|
|||
"node_modules/path-scurry/node_modules/lru-cache": {
|
||||
"version": "10.4.3",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
|
||||
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="
|
||||
},
|
||||
"node_modules/pathe": {
|
||||
"version": "1.1.2",
|
||||
|
|
@ -10772,6 +11122,15 @@
|
|||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/progress": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
|
||||
"integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prop-types": {
|
||||
"version": "15.8.1",
|
||||
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
|
||||
|
|
@ -10972,6 +11331,12 @@
|
|||
"prosemirror-transform": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/proxy-from-env": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/pseudomap": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
|
||||
|
|
@ -11654,7 +12019,6 @@
|
|||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
|
||||
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"picomatch": "^2.2.1"
|
||||
},
|
||||
|
|
@ -13169,7 +13533,6 @@
|
|||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
||||
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"is-number": "^7.0.0"
|
||||
},
|
||||
|
|
@ -13619,6 +13982,18 @@
|
|||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
},
|
||||
"node_modules/unplugin": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.0.1.tgz",
|
||||
"integrity": "sha512-aqrHaVBWW1JVKBHmGo33T5TxeL0qWzfvjWokObHA9bYmN7eNDkwOxmLjhioHl9878qDFMAaT51XNroRyuz7WxA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"acorn": "^8.8.1",
|
||||
"chokidar": "^3.5.3",
|
||||
"webpack-sources": "^3.2.3",
|
||||
"webpack-virtual-modules": "^0.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/update-browserslist-db": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz",
|
||||
|
|
@ -14956,6 +15331,21 @@
|
|||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/webpack-sources": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.3.3.tgz",
|
||||
"integrity": "sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/webpack-virtual-modules": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.5.0.tgz",
|
||||
"integrity": "sha512-kyDivFZ7ZM0BVOUteVbDFhlRt7Ah/CSPwJdi8hBpkK7QLumUqdLtVfm/PX/hkcnrvr0i77fO5+TjZ94Pe+C9iw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/whatwg-encoding": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz",
|
||||
|
|
@ -15322,7 +15712,6 @@
|
|||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
||||
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
"@heroicons/react": "^2.0.18",
|
||||
"@panzoom/panzoom": "^4.6.0",
|
||||
"@reduxjs/toolkit": "^2.3.0",
|
||||
"@sentry/react": "^9.43.0",
|
||||
"@sentry/vite-plugin": "^4.0.2",
|
||||
"@tiptap/core": "^2.3.2",
|
||||
"@tiptap/extension-document": "^2.3.2",
|
||||
"@tiptap/extension-dropcursor": "^2.1.16",
|
||||
|
|
@ -82,8 +84,8 @@
|
|||
"@swc/cli": "^0.3.14",
|
||||
"@swc/core": "^1.7.26",
|
||||
"@testing-library/dom": "^10.4.0",
|
||||
"@testing-library/jest-dom": "^6.5.0",
|
||||
"@testing-library/react": "^16.0.1",
|
||||
"@testing-library/jest-dom": "^6.6.4",
|
||||
"@testing-library/react": "^16.3.0",
|
||||
"@testing-library/user-event": "^14.5.2",
|
||||
"@types/dompurify": "^3.2.0",
|
||||
"@types/lodash": "^4.17.6",
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import { CustomScrollbarDiv } from ".";
|
|||
import { AuthProvider } from "../context/Auth";
|
||||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
import { LocalStorageProvider } from "../context/LocalStorage";
|
||||
import TelemetryProviders from "../hooks/TelemetryProviders";
|
||||
import { useWebviewListener } from "../hooks/useWebviewListener";
|
||||
import { useAppDispatch, useAppSelector } from "../redux/hooks";
|
||||
import { setCodeToEdit } from "../redux/slices/editState";
|
||||
|
|
@ -26,6 +27,7 @@ import {
|
|||
} from "./OnboardingCard";
|
||||
import OSRContextMenu from "./OSRContextMenu";
|
||||
import PostHogPageView from "./PosthogPageView";
|
||||
import { FatalErrorIndicator } from "./config/FatalErrorNotice";
|
||||
|
||||
const LayoutTopDiv = styled(CustomScrollbarDiv)`
|
||||
height: 100%;
|
||||
|
|
@ -245,45 +247,48 @@ const Layout = () => {
|
|||
return (
|
||||
<LocalStorageProvider>
|
||||
<AuthProvider>
|
||||
<LayoutTopDiv>
|
||||
{showStagingIndicator && (
|
||||
<span
|
||||
title="Staging environment"
|
||||
className="absolute right-0 mx-1.5 h-1.5 w-1.5 rounded-full"
|
||||
style={{
|
||||
backgroundColor: "var(--vscode-list-warningForeground)",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<LumpProvider>
|
||||
<OSRContextMenu />
|
||||
<div
|
||||
style={{
|
||||
scrollbarGutter: "stable both-edges",
|
||||
minHeight: "100%",
|
||||
display: "grid",
|
||||
gridTemplateRows: "1fr auto",
|
||||
}}
|
||||
>
|
||||
<TextDialog
|
||||
showDialog={showDialog}
|
||||
onEnter={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
<TelemetryProviders>
|
||||
<LayoutTopDiv>
|
||||
{showStagingIndicator && (
|
||||
<span
|
||||
title="Staging environment"
|
||||
className="absolute right-0 mx-1.5 h-1.5 w-1.5 rounded-full"
|
||||
style={{
|
||||
backgroundColor: "var(--vscode-list-warningForeground)",
|
||||
}}
|
||||
onClose={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
message={dialogMessage}
|
||||
/>
|
||||
)}
|
||||
<LumpProvider>
|
||||
<OSRContextMenu />
|
||||
<div
|
||||
style={{
|
||||
scrollbarGutter: "stable both-edges",
|
||||
minHeight: "100%",
|
||||
display: "grid",
|
||||
gridTemplateRows: "1fr auto",
|
||||
}}
|
||||
>
|
||||
<TextDialog
|
||||
showDialog={showDialog}
|
||||
onEnter={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
onClose={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
message={dialogMessage}
|
||||
/>
|
||||
|
||||
<GridDiv>
|
||||
<PostHogPageView />
|
||||
<Outlet />
|
||||
</GridDiv>
|
||||
</div>
|
||||
<div style={{ fontSize: fontSize(-4) }} id="tooltip-portal-div" />
|
||||
</LumpProvider>
|
||||
</LayoutTopDiv>
|
||||
<GridDiv>
|
||||
<PostHogPageView />
|
||||
<Outlet />
|
||||
<FatalErrorIndicator />
|
||||
</GridDiv>
|
||||
</div>
|
||||
<div style={{ fontSize: fontSize(-4) }} id="tooltip-portal-div" />
|
||||
</LumpProvider>
|
||||
</LayoutTopDiv>
|
||||
</TelemetryProviders>
|
||||
</AuthProvider>
|
||||
</LocalStorageProvider>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
import posthog from "posthog-js";
|
||||
import { PostHogProvider } from "posthog-js/react";
|
||||
import { PropsWithChildren, useEffect } from "react";
|
||||
import { useAppSelector } from "../redux/hooks";
|
||||
|
||||
const CustomPostHogProvider = ({ children }: PropsWithChildren) => {
|
||||
const allowAnonymousTelemetry = useAppSelector(
|
||||
(store) => store?.config?.config?.allowAnonymousTelemetry,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (allowAnonymousTelemetry) {
|
||||
posthog.init("phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs", {
|
||||
api_host: "https://app.posthog.com",
|
||||
disable_session_recording: true,
|
||||
autocapture: false,
|
||||
// // We need to manually track pageviews since we're a SPA
|
||||
capture_pageleave: false,
|
||||
capture_pageview: false,
|
||||
});
|
||||
posthog.identify(window.vscMachineId);
|
||||
posthog.opt_in_capturing();
|
||||
} else {
|
||||
posthog.opt_out_capturing();
|
||||
}
|
||||
}, [allowAnonymousTelemetry]);
|
||||
|
||||
return <PostHogProvider client={posthog}>{children}</PostHogProvider>;
|
||||
};
|
||||
|
||||
export default CustomPostHogProvider;
|
||||
306
gui/src/hooks/TelemetryProviders.test.tsx
Normal file
306
gui/src/hooks/TelemetryProviders.test.tsx
Normal file
|
|
@ -0,0 +1,306 @@
|
|||
import { createStore } from "@reduxjs/toolkit";
|
||||
import * as Sentry from "@sentry/react";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import posthog from "posthog-js";
|
||||
import React from "react";
|
||||
import { Provider } from "react-redux";
|
||||
import { PersistGate } from "redux-persist/integration/react";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { AuthProvider } from "../context/Auth";
|
||||
import TelemetryProviders from "./TelemetryProviders";
|
||||
|
||||
// Mock Sentry
|
||||
vi.mock("@sentry/react", () => ({
|
||||
init: vi.fn(),
|
||||
setUser: vi.fn(),
|
||||
getClient: vi.fn(),
|
||||
getCurrentScope: vi.fn(() => ({
|
||||
clear: vi.fn(),
|
||||
})),
|
||||
browserTracingIntegration: vi.fn(() => ({ name: "BrowserTracing" })),
|
||||
replayIntegration: vi.fn(() => ({ name: "Replay" })),
|
||||
feedbackIntegration: vi.fn(() => ({ name: "Feedback" })),
|
||||
contextLinesIntegration: vi.fn(() => ({ name: "ContextLines" })),
|
||||
ErrorBoundary: ({ children }: { children: React.ReactNode }) => (
|
||||
<div data-testid="sentry-error-boundary">{children}</div>
|
||||
),
|
||||
}));
|
||||
|
||||
// Mock PostHog
|
||||
vi.mock("posthog-js", () => ({
|
||||
default: {
|
||||
init: vi.fn(),
|
||||
identify: vi.fn(),
|
||||
opt_in_capturing: vi.fn(),
|
||||
opt_out_capturing: vi.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
// Mock PostHog React provider
|
||||
vi.mock("posthog-js/react", () => ({
|
||||
PostHogProvider: ({ children }: { children: React.ReactNode }) => (
|
||||
<div data-testid="posthog-provider">{children}</div>
|
||||
),
|
||||
}));
|
||||
|
||||
// Mock the Auth context
|
||||
vi.mock("../context/Auth", () => ({
|
||||
AuthProvider: ({ children }: { children: React.ReactNode }) => (
|
||||
<div data-testid="auth-provider">{children}</div>
|
||||
),
|
||||
useAuth: () => ({
|
||||
session: {
|
||||
account: {
|
||||
id: "test@continue.dev", // Mock Continue team member email
|
||||
},
|
||||
},
|
||||
}),
|
||||
}));
|
||||
|
||||
// Mock isContinueTeamMember utility
|
||||
vi.mock("../util/isContinueTeamMember", () => ({
|
||||
isContinueTeamMember: vi.fn(() => true), // Mock as Continue team member
|
||||
}));
|
||||
|
||||
// Mock window.vscMachineId
|
||||
Object.defineProperty(window, "vscMachineId", {
|
||||
value: "test-machine-id",
|
||||
writable: true,
|
||||
});
|
||||
|
||||
// Create a minimal Redux store for testing
|
||||
const createTestStore = (allowAnonymousTelemetry: boolean) => {
|
||||
return createStore(
|
||||
(
|
||||
state = {
|
||||
config: {
|
||||
config: {
|
||||
allowAnonymousTelemetry,
|
||||
},
|
||||
},
|
||||
},
|
||||
) => state,
|
||||
);
|
||||
};
|
||||
|
||||
// Mock persistor
|
||||
const mockPersistor = {
|
||||
persist: vi.fn(),
|
||||
purge: vi.fn(),
|
||||
flush: vi.fn(),
|
||||
pause: vi.fn(),
|
||||
getState: vi.fn(() => ({
|
||||
bootstrapped: true,
|
||||
registry: [],
|
||||
})),
|
||||
dispatch: vi.fn(),
|
||||
subscribe: vi.fn(),
|
||||
};
|
||||
|
||||
const TestWrapper: React.FC<{
|
||||
children: React.ReactNode;
|
||||
allowAnonymousTelemetry: boolean;
|
||||
}> = ({ children, allowAnonymousTelemetry }) => {
|
||||
const store = createTestStore(allowAnonymousTelemetry);
|
||||
|
||||
return (
|
||||
<Provider store={store}>
|
||||
<PersistGate loading={null} persistor={mockPersistor}>
|
||||
<AuthProvider>{children}</AuthProvider>
|
||||
</PersistGate>
|
||||
</Provider>
|
||||
);
|
||||
};
|
||||
|
||||
describe("TelemetryProviders", () => {
|
||||
const mockSentry = Sentry as any;
|
||||
const mockPosthog = posthog as any;
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
// Reset NODE_ENV to test
|
||||
process.env.NODE_ENV = "test";
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
describe("when telemetry is enabled", () => {
|
||||
it("should initialize both PostHog and Sentry", () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
render(
|
||||
<TestWrapper allowAnonymousTelemetry={true}>
|
||||
<TelemetryProviders>
|
||||
<div data-testid="test-child">Test Child</div>
|
||||
</TelemetryProviders>
|
||||
</TestWrapper>,
|
||||
);
|
||||
|
||||
// Verify PostHog initialization
|
||||
expect(mockPosthog.init).toHaveBeenCalledWith(
|
||||
"phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs",
|
||||
expect.objectContaining({
|
||||
api_host: "https://app.posthog.com",
|
||||
disable_session_recording: true,
|
||||
autocapture: false,
|
||||
capture_pageleave: false,
|
||||
capture_pageview: false,
|
||||
}),
|
||||
);
|
||||
expect(mockPosthog.identify).toHaveBeenCalledWith("test-machine-id");
|
||||
expect(mockPosthog.opt_in_capturing).toHaveBeenCalled();
|
||||
|
||||
// Verify Sentry initialization
|
||||
expect(mockSentry.init).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
dsn: "https://fe99934dcdc537d84209893a3f96a196@o4505462064283648.ingest.us.sentry.io/4508184596054016",
|
||||
environment: "development",
|
||||
tracesSampleRate: 0.25,
|
||||
}),
|
||||
);
|
||||
expect(mockSentry.setUser).toHaveBeenCalledWith({
|
||||
id: expect.stringMatching(/^[a-f0-9]{8}$/), // Should be 8-char hash
|
||||
email: undefined,
|
||||
username: undefined,
|
||||
ip_address: undefined,
|
||||
});
|
||||
|
||||
// Verify children are rendered
|
||||
expect(screen.getByTestId("test-child")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("posthog-provider")).toBeInTheDocument();
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
});
|
||||
|
||||
describe("when telemetry is disabled", () => {
|
||||
it("should disable PostHog and clear Sentry scope", () => {
|
||||
const mockClear = vi.fn();
|
||||
const mockClose = vi.fn();
|
||||
const mockClient = { close: mockClose };
|
||||
|
||||
mockSentry.getCurrentScope.mockReturnValue({ clear: mockClear });
|
||||
mockSentry.getClient.mockReturnValue(mockClient);
|
||||
|
||||
render(
|
||||
<TestWrapper allowAnonymousTelemetry={false}>
|
||||
<TelemetryProviders>
|
||||
<div data-testid="test-child">Test Child</div>
|
||||
</TelemetryProviders>
|
||||
</TestWrapper>,
|
||||
);
|
||||
|
||||
// Verify PostHog is disabled
|
||||
expect(mockPosthog.opt_out_capturing).toHaveBeenCalled();
|
||||
expect(mockPosthog.init).not.toHaveBeenCalled();
|
||||
expect(mockPosthog.identify).not.toHaveBeenCalled();
|
||||
expect(mockPosthog.opt_in_capturing).not.toHaveBeenCalled();
|
||||
|
||||
// Verify Sentry is properly disabled
|
||||
expect(mockSentry.getClient).toHaveBeenCalled();
|
||||
expect(mockClose).toHaveBeenCalled();
|
||||
expect(mockSentry.getCurrentScope).toHaveBeenCalled();
|
||||
expect(mockClear).toHaveBeenCalled();
|
||||
expect(mockSentry.init).not.toHaveBeenCalled();
|
||||
expect(mockSentry.setUser).not.toHaveBeenCalled();
|
||||
|
||||
// Verify children are still rendered
|
||||
expect(screen.getByTestId("test-child")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("posthog-provider")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe("provider structure", () => {
|
||||
it("should wrap children with PostHogProvider", () => {
|
||||
render(
|
||||
<TestWrapper allowAnonymousTelemetry={false}>
|
||||
<TelemetryProviders>
|
||||
<div data-testid="nested-child">
|
||||
<span data-testid="deeply-nested">Deep content</span>
|
||||
</div>
|
||||
</TelemetryProviders>
|
||||
</TestWrapper>,
|
||||
);
|
||||
|
||||
// Verify the provider structure is maintained
|
||||
expect(screen.getByTestId("posthog-provider")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("nested-child")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("deeply-nested")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should handle missing vscMachineId gracefully", () => {
|
||||
// Temporarily modify vscMachineId
|
||||
const originalMachineId = window.vscMachineId;
|
||||
(window as any).vscMachineId = undefined;
|
||||
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
render(
|
||||
<TestWrapper allowAnonymousTelemetry={true}>
|
||||
<TelemetryProviders>
|
||||
<div data-testid="test-child">Test Child</div>
|
||||
</TelemetryProviders>
|
||||
</TestWrapper>,
|
||||
);
|
||||
|
||||
// Should still initialize but with anonymized ID (hashed "anonymous")
|
||||
expect(mockSentry.setUser).toHaveBeenCalledWith({
|
||||
id: expect.stringMatching(/^[a-f0-9]{8}$/), // Should be 8-char hash
|
||||
email: undefined,
|
||||
username: undefined,
|
||||
ip_address: undefined,
|
||||
});
|
||||
|
||||
// Restore
|
||||
(window as any).vscMachineId = originalMachineId;
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
});
|
||||
|
||||
describe("telemetry toggle behavior", () => {
|
||||
it("should maintain proper state when telemetry setting changes", () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
|
||||
// First render with telemetry enabled
|
||||
const { rerender } = render(
|
||||
<TestWrapper allowAnonymousTelemetry={true}>
|
||||
<TelemetryProviders>
|
||||
<div data-testid="test-child">Test Child</div>
|
||||
</TelemetryProviders>
|
||||
</TestWrapper>,
|
||||
);
|
||||
|
||||
expect(mockSentry.init).toHaveBeenCalled();
|
||||
expect(mockPosthog.opt_in_capturing).toHaveBeenCalled();
|
||||
|
||||
// Clear mocks and rerender with telemetry disabled
|
||||
vi.clearAllMocks();
|
||||
const mockClear = vi.fn();
|
||||
const mockClose = vi.fn();
|
||||
const mockClient = { close: mockClose };
|
||||
|
||||
mockSentry.getCurrentScope.mockReturnValue({ clear: mockClear });
|
||||
mockSentry.getClient.mockReturnValue(mockClient);
|
||||
|
||||
rerender(
|
||||
<TestWrapper allowAnonymousTelemetry={false}>
|
||||
<TelemetryProviders>
|
||||
<div data-testid="test-child">Test Child</div>
|
||||
</TelemetryProviders>
|
||||
</TestWrapper>,
|
||||
);
|
||||
|
||||
expect(mockPosthog.opt_out_capturing).toHaveBeenCalled();
|
||||
expect(mockClose).toHaveBeenCalled();
|
||||
expect(mockClear).toHaveBeenCalled();
|
||||
expect(mockSentry.init).not.toHaveBeenCalled();
|
||||
|
||||
process.env.NODE_ENV = originalNodeEnv;
|
||||
});
|
||||
});
|
||||
});
|
||||
126
gui/src/hooks/TelemetryProviders.tsx
Normal file
126
gui/src/hooks/TelemetryProviders.tsx
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
import * as Sentry from "@sentry/react";
|
||||
import { HubSessionInfo } from "core/control-plane/AuthTypes";
|
||||
import {
|
||||
anonymizeSentryEvent,
|
||||
anonymizeUserInfo,
|
||||
} from "core/util/sentry/anonymization";
|
||||
import { SENTRY_DSN } from "core/util/sentry/constants";
|
||||
import posthog from "posthog-js";
|
||||
import { PostHogProvider } from "posthog-js/react";
|
||||
import { PropsWithChildren, useEffect } from "react";
|
||||
import { useAuth } from "../context/Auth";
|
||||
import { useAppSelector } from "../redux/hooks";
|
||||
import { isPrerelease } from "../util/index";
|
||||
import { isContinueTeamMember } from "../util/isContinueTeamMember";
|
||||
import { getLocalStorage } from "../util/localStorage";
|
||||
|
||||
const SAMPLE_REATE = 0.1;
|
||||
const TRACES_SAMPLE_RATE = 0.25;
|
||||
|
||||
const TelemetryProviders = ({ children }: PropsWithChildren) => {
|
||||
const allowAnonymousTelemetry = useAppSelector(
|
||||
(store) => store?.config?.config?.allowAnonymousTelemetry,
|
||||
);
|
||||
const { session } = useAuth();
|
||||
|
||||
// TODO: Remove Continue team member check once Sentry is ready for all users
|
||||
const hasContinueEmail = isContinueTeamMember(
|
||||
(session as HubSessionInfo)?.account?.id,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (allowAnonymousTelemetry && hasContinueEmail) {
|
||||
// Initialize PostHog (existing logic)
|
||||
posthog.init("phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs", {
|
||||
api_host: "https://app.posthog.com",
|
||||
disable_session_recording: true,
|
||||
autocapture: false,
|
||||
// We need to manually track pageviews since we're a SPA
|
||||
capture_pageleave: false,
|
||||
capture_pageview: false,
|
||||
});
|
||||
posthog.identify(window.vscMachineId);
|
||||
posthog.opt_in_capturing();
|
||||
|
||||
// Initialize Sentry (new for GUI - enhanced React setup)
|
||||
Sentry.init({
|
||||
dsn: SENTRY_DSN,
|
||||
environment: process.env.NODE_ENV,
|
||||
integrations: [
|
||||
// Performance monitoring
|
||||
Sentry.browserTracingIntegration(),
|
||||
],
|
||||
|
||||
// For basic error tracking, a lower sample rate should be fine
|
||||
sampleRate: SAMPLE_REATE,
|
||||
tracesSampleRate: TRACES_SAMPLE_RATE,
|
||||
|
||||
// Privacy-conscious default
|
||||
sendDefaultPii: false,
|
||||
|
||||
// Strip sensitive data and add basic properties
|
||||
beforeSend(event) {
|
||||
// Apply comprehensive anonymization using shared logic
|
||||
const anonymizedEvent = anonymizeSentryEvent(event);
|
||||
if (!anonymizedEvent) return null;
|
||||
|
||||
// Add basic properties available in GUI environment
|
||||
if (!anonymizedEvent.tags) anonymizedEvent.tags = {};
|
||||
|
||||
// Add environment information
|
||||
anonymizedEvent.tags.environment = process.env.NODE_ENV;
|
||||
|
||||
// Add ideInfo properties spread out as top-level properties (like PostHog)
|
||||
const extensionVersion = getLocalStorage("extensionVersion");
|
||||
const ideType = getLocalStorage("ide");
|
||||
|
||||
if (extensionVersion) {
|
||||
anonymizedEvent.tags.extensionVersion = extensionVersion;
|
||||
}
|
||||
|
||||
if (ideType) {
|
||||
anonymizedEvent.tags.ideType = ideType;
|
||||
}
|
||||
|
||||
// Add isPrerelease information
|
||||
anonymizedEvent.tags.isPrerelease = isPrerelease();
|
||||
|
||||
return anonymizedEvent;
|
||||
},
|
||||
});
|
||||
|
||||
// Set anonymized user context for Sentry
|
||||
const anonymizedUser = anonymizeUserInfo({
|
||||
id: window.vscMachineId || "anonymous",
|
||||
});
|
||||
Sentry.setUser(anonymizedUser);
|
||||
} else {
|
||||
// Disable PostHog
|
||||
posthog.opt_out_capturing();
|
||||
|
||||
// Disable Sentry properly - close the client to stop all network requests
|
||||
try {
|
||||
const client = Sentry.getClient();
|
||||
if (client) {
|
||||
client.close();
|
||||
}
|
||||
Sentry.getCurrentScope().clear();
|
||||
} catch (error) {
|
||||
console.error("Error disabling Sentry:", error);
|
||||
}
|
||||
}
|
||||
}, [allowAnonymousTelemetry, hasContinueEmail]);
|
||||
|
||||
// Conditionally wrap with ErrorBoundary when telemetry is enabled and user is Continue team member
|
||||
const content =
|
||||
allowAnonymousTelemetry && hasContinueEmail ? (
|
||||
<Sentry.ErrorBoundary showDialog={false}>{children}</Sentry.ErrorBoundary>
|
||||
) : (
|
||||
children
|
||||
);
|
||||
|
||||
// Only PostHog needs a provider wrapper - Sentry works globally once initialized
|
||||
return <PostHogProvider client={posthog}>{content}</PostHogProvider>;
|
||||
};
|
||||
|
||||
export default TelemetryProviders;
|
||||
|
|
@ -3,18 +3,20 @@ import ReactDOM from "react-dom/client";
|
|||
import { Provider } from "react-redux";
|
||||
import { PersistGate } from "redux-persist/integration/react";
|
||||
import App from "./App";
|
||||
import CustomPostHogProvider from "./hooks/CustomPostHogProvider";
|
||||
import "./index.css";
|
||||
import { persistor, store } from "./redux/store";
|
||||
|
||||
(async () => {
|
||||
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
|
||||
const container = document.getElementById("root") as HTMLElement;
|
||||
|
||||
// Create React root
|
||||
const root = ReactDOM.createRoot(container);
|
||||
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<Provider store={store}>
|
||||
<PersistGate loading={null} persistor={persistor}>
|
||||
<CustomPostHogProvider>
|
||||
<App />
|
||||
</CustomPostHogProvider>
|
||||
<App />
|
||||
</PersistGate>
|
||||
</Provider>
|
||||
</React.StrictMode>,
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import { IdeMessengerContext } from "../../context/IdeMessenger";
|
|||
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
|
||||
import { updateConfig } from "../../redux/slices/configSlice";
|
||||
import { selectCurrentOrg } from "../../redux/slices/profilesSlice";
|
||||
import { isContinueTeamMember } from "../../util/isContinueTeamMember";
|
||||
import { setLocalStorage } from "../../util/localStorage";
|
||||
import { ContinueFeaturesMenu } from "./ContinueFeaturesMenu";
|
||||
|
||||
|
|
@ -132,8 +133,8 @@ export function UserSettingsForm() {
|
|||
});
|
||||
}, [ideMessenger]);
|
||||
|
||||
const hasContinueEmail = (session as HubSessionInfo)?.account?.id.includes(
|
||||
"@continue.dev",
|
||||
const hasContinueEmail = isContinueTeamMember(
|
||||
(session as HubSessionInfo)?.account?.id,
|
||||
);
|
||||
|
||||
const disableTelemetryToggle =
|
||||
|
|
|
|||
7
gui/src/util/isContinueTeamMember.ts
Normal file
7
gui/src/util/isContinueTeamMember.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* Utility to check if a user is a Continue team member
|
||||
*/
|
||||
export function isContinueTeamMember(email?: string): boolean {
|
||||
if (!email) return false;
|
||||
return email.includes("@continue.dev");
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
import { sentryVitePlugin } from "@sentry/vite-plugin";
|
||||
import react from "@vitejs/plugin-react-swc";
|
||||
import { resolve } from "path";
|
||||
import tailwindcss from "tailwindcss";
|
||||
|
|
@ -5,8 +6,17 @@ import { defineConfig } from "vitest/config";
|
|||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react(), tailwindcss()],
|
||||
plugins: [
|
||||
react(),
|
||||
tailwindcss(),
|
||||
sentryVitePlugin({
|
||||
org: "continue-xd",
|
||||
project: "continue",
|
||||
}),
|
||||
],
|
||||
build: {
|
||||
sourcemap: true,
|
||||
|
||||
// Change the output .js filename to not include a hash
|
||||
rollupOptions: {
|
||||
input: {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue