From 1073629b773b4a0ee02f4bf3ee17e5b0ea442ab0 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 20 Jul 2025 11:18:12 -0700 Subject: [PATCH] fix type errs --- src/commands/chat.ts | 13 +++++++------ src/commands/logout.ts | 3 ++- src/telemetry/telemetryService.ts | 5 +++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/commands/chat.ts b/src/commands/chat.ts index 16be5ec7c..ac30177de 100644 --- a/src/commands/chat.ts +++ b/src/commands/chat.ts @@ -2,7 +2,7 @@ import chalk from "chalk"; import { ChatCompletionMessageParam } from "openai/resources.mjs"; import * as readlineSync from "readline-sync"; import { CONTINUE_ASCII_ART } from "../asciiArt.js"; -import { ensureOrganization, loadAuthConfig } from "../auth/workos.js"; +import { ensureOrganization, loadAuthConfig, getOrganizationId } from "../auth/workos.js"; import { introMessage } from "../intro.js"; import { configureLogger } from "../logger.js"; import { initializeWithOnboarding } from "../onboarding.js"; @@ -46,10 +46,11 @@ async function initializeChat(options: ChatOptions) { ); // Update telemetry with organization info - if (finalAuthConfig.selectedOrganization?.id) { - telemetryService.updateOrganization( - finalAuthConfig.selectedOrganization.id - ); + if (finalAuthConfig) { + const organizationId = getOrganizationId(finalAuthConfig); + if (organizationId) { + telemetryService.updateOrganization(organizationId); + } } } @@ -178,4 +179,4 @@ export async function chat(prompt?: string, options: ChatOptions = {}) { // Stop active time tracking telemetryService.stopActiveTime(); } -} +} \ No newline at end of file diff --git a/src/commands/logout.ts b/src/commands/logout.ts index 1dfba7871..b6b40c62f 100644 --- a/src/commands/logout.ts +++ b/src/commands/logout.ts @@ -9,10 +9,11 @@ export async function logout() { ".continue", ".onboarding_complete" ); - workosLogout(); // Remove onboarding completion flag so user will go through onboarding again if (fs.existsSync(onboardingFlagPath)) { fs.unlinkSync(onboardingFlagPath); } + + workosLogout(); } diff --git a/src/telemetry/telemetryService.ts b/src/telemetry/telemetryService.ts index 207e61e21..7700122ed 100644 --- a/src/telemetry/telemetryService.ts +++ b/src/telemetry/telemetryService.ts @@ -1,5 +1,6 @@ import { metrics } from "@opentelemetry/api"; import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http"; +import { resourceFromAttributes } from "@opentelemetry/resources"; import { ConsoleMetricExporter, MeterProvider, @@ -77,7 +78,7 @@ class TelemetryService { private initialize() { try { // Create resource - const resource = new Resource({ + const resource = resourceFromAttributes({ [SEMRESATTRS_SERVICE_NAME]: "continue-cli", [SEMRESATTRS_SERVICE_VERSION]: getVersion(), [SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: @@ -556,4 +557,4 @@ class TelemetryService { // Export the singleton instance directly export const telemetryService = new TelemetryService(); -export default telemetryService; +export default telemetryService; \ No newline at end of file