mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-26 04:54:25 -07:00
fix: merge duplicate imports in packages/core (3/4) (#20928)
This commit is contained in:
@@ -13,9 +13,9 @@ import {
|
||||
recordGlobalActivity,
|
||||
startGlobalActivityMonitoring,
|
||||
stopGlobalActivityMonitoring,
|
||||
type ActivityEvent,
|
||||
} from './activity-monitor.js';
|
||||
import { ActivityType } from './activity-types.js';
|
||||
import type { ActivityEvent } from './activity-monitor.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
import { debugLogger } from '../utils/debugLogger.js';
|
||||
|
||||
|
||||
@@ -14,10 +14,17 @@ import {
|
||||
afterAll,
|
||||
beforeEach,
|
||||
} from 'vitest';
|
||||
import type { LogEvent, LogEventEntry } from './clearcut-logger.js';
|
||||
import { ClearcutLogger, EventNames, TEST_ONLY } from './clearcut-logger.js';
|
||||
import type { ContentGeneratorConfig } from '../../core/contentGenerator.js';
|
||||
import { AuthType } from '../../core/contentGenerator.js';
|
||||
import {
|
||||
ClearcutLogger,
|
||||
EventNames,
|
||||
TEST_ONLY,
|
||||
type LogEvent,
|
||||
type LogEventEntry,
|
||||
} from './clearcut-logger.js';
|
||||
import {
|
||||
AuthType,
|
||||
type ContentGeneratorConfig,
|
||||
} from '../../core/contentGenerator.js';
|
||||
import type { SuccessfulToolCall } from '../../core/coreToolScheduler.js';
|
||||
import type { ConfigParameters } from '../../config/config.js';
|
||||
import { EventMetadataKey } from './event-metadata-key.js';
|
||||
@@ -42,8 +49,7 @@ import { GIT_COMMIT_INFO, CLI_VERSION } from '../../generated/git-commit.js';
|
||||
import { UserAccountManager } from '../../utils/userAccountManager.js';
|
||||
import { InstallationManager } from '../../utils/installationManager.js';
|
||||
|
||||
import si from 'systeminformation';
|
||||
import type { Systeminformation } from 'systeminformation';
|
||||
import si, { type Systeminformation } from 'systeminformation';
|
||||
import * as os from 'node:os';
|
||||
|
||||
interface CustomMatchers<R = unknown> {
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import type { LogRecord } from '@opentelemetry/api-logs';
|
||||
import { logs } from '@opentelemetry/api-logs';
|
||||
import { logs, type LogRecord } from '@opentelemetry/api-logs';
|
||||
import type { Config } from '../config/config.js';
|
||||
import { SERVICE_NAME } from './constants.js';
|
||||
import { isTelemetrySdkInitialized } from './sdk.js';
|
||||
|
||||
@@ -13,8 +13,10 @@ import {
|
||||
import { ExportResultCode } from '@opentelemetry/core';
|
||||
import type { ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
||||
import type { ReadableLogRecord } from '@opentelemetry/sdk-logs';
|
||||
import type { ResourceMetrics } from '@opentelemetry/sdk-metrics';
|
||||
import { AggregationTemporality } from '@opentelemetry/sdk-metrics';
|
||||
import {
|
||||
AggregationTemporality,
|
||||
type ResourceMetrics,
|
||||
} from '@opentelemetry/sdk-metrics';
|
||||
import * as fs from 'node:fs';
|
||||
|
||||
function createMockWriteStream(): {
|
||||
|
||||
@@ -5,18 +5,17 @@
|
||||
*/
|
||||
|
||||
import * as fs from 'node:fs';
|
||||
import type { ExportResult } from '@opentelemetry/core';
|
||||
import { ExportResultCode } from '@opentelemetry/core';
|
||||
import { ExportResultCode, type ExportResult } from '@opentelemetry/core';
|
||||
import type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
|
||||
import type {
|
||||
ReadableLogRecord,
|
||||
LogRecordExporter,
|
||||
} from '@opentelemetry/sdk-logs';
|
||||
import type {
|
||||
ResourceMetrics,
|
||||
PushMetricExporter,
|
||||
import {
|
||||
AggregationTemporality,
|
||||
type ResourceMetrics,
|
||||
type PushMetricExporter,
|
||||
} from '@opentelemetry/sdk-metrics';
|
||||
import { AggregationTemporality } from '@opentelemetry/sdk-metrics';
|
||||
import { safeJsonStringify } from '../utils/safeJsonStringify.js';
|
||||
|
||||
class FileExporter {
|
||||
|
||||
@@ -7,10 +7,12 @@
|
||||
import { type JWTInput } from 'google-auth-library';
|
||||
import { TraceExporter } from '@google-cloud/opentelemetry-cloud-trace-exporter';
|
||||
import { MetricExporter } from '@google-cloud/opentelemetry-cloud-monitoring-exporter';
|
||||
import { Logging } from '@google-cloud/logging';
|
||||
import type { Log } from '@google-cloud/logging';
|
||||
import { hrTimeToMilliseconds, ExportResultCode } from '@opentelemetry/core';
|
||||
import type { ExportResult } from '@opentelemetry/core';
|
||||
import { Logging, type Log } from '@google-cloud/logging';
|
||||
import {
|
||||
hrTimeToMilliseconds,
|
||||
ExportResultCode,
|
||||
type ExportResult,
|
||||
} from '@opentelemetry/core';
|
||||
import type {
|
||||
ReadableLogRecord,
|
||||
LogRecordExporter,
|
||||
|
||||
@@ -14,10 +14,10 @@ import { ToolCallEvent } from './types.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
import type { CompletedToolCall } from '../core/coreToolScheduler.js';
|
||||
import {
|
||||
CoreToolCallStatus,
|
||||
type ToolCallRequestInfo,
|
||||
type ToolCallResponseInfo,
|
||||
} from '../scheduler/types.js';
|
||||
import { CoreToolCallStatus } from '../scheduler/types.js';
|
||||
import { MockTool } from '../test-utils/mock-tool.js';
|
||||
|
||||
describe('Circular Reference Handling', () => {
|
||||
|
||||
@@ -4,14 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import type {
|
||||
AnyDeclarativeTool,
|
||||
AnyToolInvocation,
|
||||
CompletedToolCall,
|
||||
ContentGeneratorConfig,
|
||||
ErroredToolCall,
|
||||
MessageBus,
|
||||
} from '../index.js';
|
||||
import {
|
||||
CoreToolCallStatus,
|
||||
AuthType,
|
||||
@@ -20,6 +12,12 @@ import {
|
||||
ToolConfirmationOutcome,
|
||||
ToolErrorType,
|
||||
ToolRegistry,
|
||||
type AnyDeclarativeTool,
|
||||
type AnyToolInvocation,
|
||||
type CompletedToolCall,
|
||||
type ContentGeneratorConfig,
|
||||
type ErroredToolCall,
|
||||
type MessageBus,
|
||||
} from '../index.js';
|
||||
import { OutputFormat } from '../output/types.js';
|
||||
import { logs } from '@opentelemetry/api-logs';
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import type { LogRecord } from '@opentelemetry/api-logs';
|
||||
import { logs } from '@opentelemetry/api-logs';
|
||||
import { logs, type LogRecord } from '@opentelemetry/api-logs';
|
||||
import type { Config } from '../config/config.js';
|
||||
import { SERVICE_NAME } from './constants.js';
|
||||
import {
|
||||
@@ -13,51 +12,49 @@ import {
|
||||
EVENT_API_RESPONSE,
|
||||
EVENT_TOOL_CALL,
|
||||
EVENT_REWIND,
|
||||
} from './types.js';
|
||||
import type {
|
||||
ApiErrorEvent,
|
||||
ApiRequestEvent,
|
||||
ApiResponseEvent,
|
||||
FileOperationEvent,
|
||||
IdeConnectionEvent,
|
||||
StartSessionEvent,
|
||||
ToolCallEvent,
|
||||
UserPromptEvent,
|
||||
FlashFallbackEvent,
|
||||
NextSpeakerCheckEvent,
|
||||
LoopDetectedEvent,
|
||||
LoopDetectionDisabledEvent,
|
||||
SlashCommandEvent,
|
||||
RewindEvent,
|
||||
ConversationFinishedEvent,
|
||||
ChatCompressionEvent,
|
||||
MalformedJsonResponseEvent,
|
||||
ContentRetryEvent,
|
||||
ContentRetryFailureEvent,
|
||||
RipgrepFallbackEvent,
|
||||
ToolOutputTruncatedEvent,
|
||||
ModelRoutingEvent,
|
||||
ExtensionDisableEvent,
|
||||
ExtensionEnableEvent,
|
||||
ExtensionUninstallEvent,
|
||||
ExtensionInstallEvent,
|
||||
ModelSlashCommandEvent,
|
||||
EditStrategyEvent,
|
||||
EditCorrectionEvent,
|
||||
AgentStartEvent,
|
||||
AgentFinishEvent,
|
||||
RecoveryAttemptEvent,
|
||||
WebFetchFallbackAttemptEvent,
|
||||
ExtensionUpdateEvent,
|
||||
ApprovalModeSwitchEvent,
|
||||
ApprovalModeDurationEvent,
|
||||
HookCallEvent,
|
||||
StartupStatsEvent,
|
||||
LlmLoopCheckEvent,
|
||||
PlanExecutionEvent,
|
||||
ToolOutputMaskingEvent,
|
||||
KeychainAvailabilityEvent,
|
||||
TokenStorageInitializationEvent,
|
||||
type ApiErrorEvent,
|
||||
type ApiRequestEvent,
|
||||
type ApiResponseEvent,
|
||||
type FileOperationEvent,
|
||||
type IdeConnectionEvent,
|
||||
type StartSessionEvent,
|
||||
type ToolCallEvent,
|
||||
type UserPromptEvent,
|
||||
type FlashFallbackEvent,
|
||||
type NextSpeakerCheckEvent,
|
||||
type LoopDetectedEvent,
|
||||
type LoopDetectionDisabledEvent,
|
||||
type SlashCommandEvent,
|
||||
type RewindEvent,
|
||||
type ConversationFinishedEvent,
|
||||
type ChatCompressionEvent,
|
||||
type MalformedJsonResponseEvent,
|
||||
type ContentRetryEvent,
|
||||
type ContentRetryFailureEvent,
|
||||
type RipgrepFallbackEvent,
|
||||
type ToolOutputTruncatedEvent,
|
||||
type ModelRoutingEvent,
|
||||
type ExtensionDisableEvent,
|
||||
type ExtensionEnableEvent,
|
||||
type ExtensionUninstallEvent,
|
||||
type ExtensionInstallEvent,
|
||||
type ModelSlashCommandEvent,
|
||||
type EditStrategyEvent,
|
||||
type EditCorrectionEvent,
|
||||
type AgentStartEvent,
|
||||
type AgentFinishEvent,
|
||||
type RecoveryAttemptEvent,
|
||||
type WebFetchFallbackAttemptEvent,
|
||||
type ExtensionUpdateEvent,
|
||||
type ApprovalModeSwitchEvent,
|
||||
type ApprovalModeDurationEvent,
|
||||
type HookCallEvent,
|
||||
type StartupStatsEvent,
|
||||
type LlmLoopCheckEvent,
|
||||
type PlanExecutionEvent,
|
||||
type ToolOutputMaskingEvent,
|
||||
type KeychainAvailabilityEvent,
|
||||
type TokenStorageInitializationEvent,
|
||||
} from './types.js';
|
||||
import {
|
||||
recordApiErrorMetrics,
|
||||
@@ -80,8 +77,7 @@ import {
|
||||
recordTokenStorageInitialization,
|
||||
} from './metrics.js';
|
||||
import { bufferTelemetryEvent } from './sdk.js';
|
||||
import type { UiEvent } from './uiTelemetry.js';
|
||||
import { uiTelemetryService } from './uiTelemetry.js';
|
||||
import { uiTelemetryService, type UiEvent } from './uiTelemetry.js';
|
||||
import { ClearcutLogger } from './clearcut-logger/clearcut-logger.js';
|
||||
import { debugLogger } from '../utils/debugLogger.js';
|
||||
import type { BillingTelemetryEvent } from './billingEvents.js';
|
||||
|
||||
@@ -4,8 +4,15 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import type { Attributes, Meter, Counter, Histogram } from '@opentelemetry/api';
|
||||
import { diag, metrics, ValueType } from '@opentelemetry/api';
|
||||
import {
|
||||
diag,
|
||||
metrics,
|
||||
ValueType,
|
||||
type Attributes,
|
||||
type Meter,
|
||||
type Counter,
|
||||
type Histogram,
|
||||
} from '@opentelemetry/api';
|
||||
import { SERVICE_NAME } from './constants.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
import type {
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
* @see https://github.com/open-telemetry/semantic-conventions/blob/8b4f210f43136e57c1f6f47292eb6d38e3bf30bb/docs/gen-ai/gen-ai-events.md
|
||||
*/
|
||||
|
||||
import { FinishReason } from '@google/genai';
|
||||
import type {
|
||||
Candidate,
|
||||
Content,
|
||||
ContentUnion,
|
||||
Part,
|
||||
PartUnion,
|
||||
import {
|
||||
FinishReason,
|
||||
type Candidate,
|
||||
type Content,
|
||||
type ContentUnion,
|
||||
type Part,
|
||||
type PartUnion,
|
||||
} from '@google/genai';
|
||||
import { truncateString } from '../utils/textUtils.js';
|
||||
|
||||
|
||||
@@ -31,13 +31,13 @@ import type { AgentTerminateMode } from '../agents/types.js';
|
||||
import { getCommonAttributes } from './telemetryAttributes.js';
|
||||
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
|
||||
import { safeJsonStringify } from '../utils/safeJsonStringify.js';
|
||||
import type { OTelFinishReason } from './semantic.js';
|
||||
import {
|
||||
toInputMessages,
|
||||
toOutputMessages,
|
||||
toFinishReasons,
|
||||
toOutputType,
|
||||
toSystemInstruction,
|
||||
type OTelFinishReason,
|
||||
} from './semantic.js';
|
||||
import { sanitizeHookName } from './sanitize.js';
|
||||
import { getFileDiffFromResultDisplay } from '../utils/fileDiffUtils.js';
|
||||
|
||||
@@ -7,12 +7,13 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { UiTelemetryService } from './uiTelemetry.js';
|
||||
import { ToolCallDecision } from './tool-call-decision.js';
|
||||
import type { ApiErrorEvent, ApiResponseEvent } from './types.js';
|
||||
import {
|
||||
ToolCallEvent,
|
||||
EVENT_API_ERROR,
|
||||
EVENT_API_RESPONSE,
|
||||
EVENT_TOOL_CALL,
|
||||
type ApiErrorEvent,
|
||||
type ApiResponseEvent,
|
||||
} from './types.js';
|
||||
import type {
|
||||
CompletedToolCall,
|
||||
|
||||
@@ -9,15 +9,13 @@ import {
|
||||
EVENT_API_ERROR,
|
||||
EVENT_API_RESPONSE,
|
||||
EVENT_TOOL_CALL,
|
||||
type ApiErrorEvent,
|
||||
type ApiResponseEvent,
|
||||
type ToolCallEvent,
|
||||
type LlmRole,
|
||||
} from './types.js';
|
||||
|
||||
import { ToolCallDecision } from './tool-call-decision.js';
|
||||
import type {
|
||||
ApiErrorEvent,
|
||||
ApiResponseEvent,
|
||||
ToolCallEvent,
|
||||
LlmRole,
|
||||
} from './types.js';
|
||||
|
||||
export type UiEvent =
|
||||
| (ApiResponseEvent & { 'event.name': typeof EVENT_API_RESPONSE })
|
||||
|
||||
Reference in New Issue
Block a user