mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
Explict imports & exports with type modifier (#3774)
This commit is contained in:
@@ -14,18 +14,11 @@ import {
|
||||
beforeAll,
|
||||
afterAll,
|
||||
} from 'vitest';
|
||||
import {
|
||||
ClearcutLogger,
|
||||
LogEvent,
|
||||
LogEventEntry,
|
||||
EventNames,
|
||||
TEST_ONLY,
|
||||
} from './clearcut-logger.js';
|
||||
import {
|
||||
AuthType,
|
||||
ContentGeneratorConfig,
|
||||
} from '../../core/contentGenerator.js';
|
||||
import { ConfigParameters } from '../../config/config.js';
|
||||
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 type { ConfigParameters } from '../../config/config.js';
|
||||
import { EventMetadataKey } from './event-metadata-key.js';
|
||||
import { makeFakeConfig } from '../../test-utils/config.js';
|
||||
import { http, HttpResponse } from 'msw';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { HttpsProxyAgent } from 'https-proxy-agent';
|
||||
import {
|
||||
import type {
|
||||
StartSessionEvent,
|
||||
UserPromptEvent,
|
||||
ToolCallEvent,
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
FileOperationEvent,
|
||||
} from '../types.js';
|
||||
import { EventMetadataKey } from './event-metadata-key.js';
|
||||
import { Config } from '../../config/config.js';
|
||||
import type { Config } from '../../config/config.js';
|
||||
import { InstallationManager } from '../../utils/installationManager.js';
|
||||
import { UserAccountManager } from '../../utils/userAccountManager.js';
|
||||
import { safeJsonStringify } from '../../utils/safeJsonStringify.js';
|
||||
|
||||
@@ -5,14 +5,18 @@
|
||||
*/
|
||||
|
||||
import * as fs from 'node:fs';
|
||||
import { ExportResult, ExportResultCode } from '@opentelemetry/core';
|
||||
import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
|
||||
import { ReadableLogRecord, LogRecordExporter } from '@opentelemetry/sdk-logs';
|
||||
import {
|
||||
import type { ExportResult } from '@opentelemetry/core';
|
||||
import { ExportResultCode } from '@opentelemetry/core';
|
||||
import type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
|
||||
import type {
|
||||
ReadableLogRecord,
|
||||
LogRecordExporter,
|
||||
} from '@opentelemetry/sdk-logs';
|
||||
import type {
|
||||
ResourceMetrics,
|
||||
PushMetricExporter,
|
||||
AggregationTemporality,
|
||||
} from '@opentelemetry/sdk-metrics';
|
||||
import { AggregationTemporality } from '@opentelemetry/sdk-metrics';
|
||||
|
||||
class FileExporter {
|
||||
protected writeStream: fs.WriteStream;
|
||||
|
||||
@@ -31,24 +31,22 @@ export {
|
||||
logKittySequenceOverflow,
|
||||
logChatCompression,
|
||||
} from './loggers.js';
|
||||
export type { SlashCommandEvent, ChatCompressionEvent } from './types.js';
|
||||
export {
|
||||
StartSessionEvent,
|
||||
SlashCommandStatus,
|
||||
EndSessionEvent,
|
||||
UserPromptEvent,
|
||||
ToolCallEvent,
|
||||
ApiRequestEvent,
|
||||
ApiErrorEvent,
|
||||
ApiResponseEvent,
|
||||
TelemetryEvent,
|
||||
FlashFallbackEvent,
|
||||
StartSessionEvent,
|
||||
ToolCallEvent,
|
||||
ConversationFinishedEvent,
|
||||
KittySequenceOverflowEvent,
|
||||
SlashCommandEvent,
|
||||
makeSlashCommandEvent,
|
||||
SlashCommandStatus,
|
||||
ChatCompressionEvent,
|
||||
makeChatCompressionEvent,
|
||||
} from './types.js';
|
||||
export { makeSlashCommandEvent, makeChatCompressionEvent } from './types.js';
|
||||
export type { TelemetryEvent } from './types.js';
|
||||
export { SpanStatusCode, ValueType } from '@opentelemetry/api';
|
||||
export { SemanticAttributes } from '@opentelemetry/semantic-conventions';
|
||||
export * from './uiTelemetry.js';
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ClearcutLogger } from './clearcut-logger/clearcut-logger.js';
|
||||
import { Config } from '../config/config.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
|
||||
describe('Circular Reference Integration Test', () => {
|
||||
it('should handle HttpsProxyAgent-like circular references in clearcut logging', () => {
|
||||
|
||||
@@ -11,9 +11,12 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { logToolCall } from './loggers.js';
|
||||
import { ToolCallEvent } from './types.js';
|
||||
import { Config } from '../config/config.js';
|
||||
import { CompletedToolCall } from '../core/coreToolScheduler.js';
|
||||
import { ToolCallRequestInfo, ToolCallResponseInfo } from '../core/turn.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
import type { CompletedToolCall } from '../core/coreToolScheduler.js';
|
||||
import type {
|
||||
ToolCallRequestInfo,
|
||||
ToolCallResponseInfo,
|
||||
} from '../core/turn.js';
|
||||
import { MockTool } from '../test-utils/tools.js';
|
||||
|
||||
describe('Circular Reference Handling', () => {
|
||||
|
||||
@@ -4,13 +4,15 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import {
|
||||
import type {
|
||||
AnyToolInvocation,
|
||||
AuthType,
|
||||
CompletedToolCall,
|
||||
ContentGeneratorConfig,
|
||||
EditTool,
|
||||
ErroredToolCall,
|
||||
} from '../index.js';
|
||||
import {
|
||||
AuthType,
|
||||
EditTool,
|
||||
GeminiClient,
|
||||
ToolConfirmationOutcome,
|
||||
ToolErrorType,
|
||||
@@ -18,7 +20,7 @@ import {
|
||||
} from '../index.js';
|
||||
import { logs } from '@opentelemetry/api-logs';
|
||||
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
|
||||
import { Config } from '../config/config.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
import {
|
||||
EVENT_API_REQUEST,
|
||||
EVENT_API_RESPONSE,
|
||||
@@ -52,7 +54,7 @@ import {
|
||||
import * as metrics from './metrics.js';
|
||||
import * as sdk from './sdk.js';
|
||||
import { vi, describe, beforeEach, it, expect } from 'vitest';
|
||||
import { GenerateContentResponseUsageMetadata } from '@google/genai';
|
||||
import type { GenerateContentResponseUsageMetadata } from '@google/genai';
|
||||
import * as uiTelemetry from './uiTelemetry.js';
|
||||
import { makeFakeConfig } from '../test-utils/config.js';
|
||||
import { ClearcutLogger } from './clearcut-logger/clearcut-logger.js';
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { logs, LogRecord, LogAttributes } from '@opentelemetry/api-logs';
|
||||
import type { LogRecord, LogAttributes } from '@opentelemetry/api-logs';
|
||||
import { logs } from '@opentelemetry/api-logs';
|
||||
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
|
||||
import { Config } from '../config/config.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
import {
|
||||
EVENT_API_ERROR,
|
||||
EVENT_API_REQUEST,
|
||||
@@ -23,7 +24,7 @@ import {
|
||||
EVENT_CHAT_COMPRESSION,
|
||||
EVENT_MALFORMED_JSON_RESPONSE,
|
||||
} from './constants.js';
|
||||
import {
|
||||
import type {
|
||||
ApiErrorEvent,
|
||||
ApiRequestEvent,
|
||||
ApiResponseEvent,
|
||||
@@ -50,7 +51,8 @@ import {
|
||||
recordFileOperationMetric,
|
||||
} from './metrics.js';
|
||||
import { isTelemetrySdkInitialized } from './sdk.js';
|
||||
import { uiTelemetryService, UiEvent } from './uiTelemetry.js';
|
||||
import type { UiEvent } from './uiTelemetry.js';
|
||||
import { uiTelemetryService } from './uiTelemetry.js';
|
||||
import { ClearcutLogger } from './clearcut-logger/clearcut-logger.js';
|
||||
import { safeJsonStringify } from '../utils/safeJsonStringify.js';
|
||||
import { UserAccountManager } from '../utils/userAccountManager.js';
|
||||
|
||||
@@ -12,7 +12,7 @@ import type {
|
||||
Context,
|
||||
Histogram,
|
||||
} from '@opentelemetry/api';
|
||||
import { Config } from '../config/config.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
import { FileOperation } from './metrics.js';
|
||||
import { makeFakeConfig } from '../test-utils/config.js';
|
||||
|
||||
|
||||
@@ -4,14 +4,8 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import {
|
||||
metrics,
|
||||
Attributes,
|
||||
ValueType,
|
||||
Meter,
|
||||
Counter,
|
||||
Histogram,
|
||||
} from '@opentelemetry/api';
|
||||
import type { Attributes, Meter, Counter, Histogram } from '@opentelemetry/api';
|
||||
import { metrics, ValueType } from '@opentelemetry/api';
|
||||
import {
|
||||
SERVICE_NAME,
|
||||
METRIC_TOOL_CALL_COUNT,
|
||||
@@ -26,8 +20,8 @@ import {
|
||||
METRIC_CONTENT_RETRY_COUNT,
|
||||
METRIC_CONTENT_RETRY_FAILURE_COUNT,
|
||||
} from './constants.js';
|
||||
import { Config } from '../config/config.js';
|
||||
import { DiffStat } from '../tools/tools.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
import type { DiffStat } from '../tools/tools.js';
|
||||
|
||||
export enum FileOperation {
|
||||
CREATE = 'create',
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import { Config } from '../config/config.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
import { initializeTelemetry, shutdownTelemetry } from './sdk.js';
|
||||
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc';
|
||||
import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-grpc';
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
PeriodicExportingMetricReader,
|
||||
} from '@opentelemetry/sdk-metrics';
|
||||
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
|
||||
import { Config } from '../config/config.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
import { SERVICE_NAME } from './constants.js';
|
||||
import { initializeMetrics } from './metrics.js';
|
||||
import { ClearcutLogger } from './clearcut-logger/clearcut-logger.js';
|
||||
|
||||
@@ -4,19 +4,20 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { GenerateContentResponseUsageMetadata } from '@google/genai';
|
||||
import { ApprovalMode, Config } from '../config/config.js';
|
||||
import { CompletedToolCall } from '../core/coreToolScheduler.js';
|
||||
import type { GenerateContentResponseUsageMetadata } from '@google/genai';
|
||||
import type { Config } from '../config/config.js';
|
||||
import type { ApprovalMode } from '../config/config.js';
|
||||
import type { CompletedToolCall } from '../core/coreToolScheduler.js';
|
||||
import { DiscoveredMCPTool } from '../tools/mcp-tool.js';
|
||||
import { DiffStat, FileDiff } from '../tools/tools.js';
|
||||
import type { DiffStat, FileDiff } from '../tools/tools.js';
|
||||
import { AuthType } from '../core/contentGenerator.js';
|
||||
import {
|
||||
getDecisionFromOutcome,
|
||||
ToolCallDecision,
|
||||
} from './tool-call-decision.js';
|
||||
import { FileOperation } from './metrics.js';
|
||||
import type { FileOperation } from './metrics.js';
|
||||
export { ToolCallDecision };
|
||||
import { ToolRegistry } from '../tools/tool-registry.js';
|
||||
import type { ToolRegistry } from '../tools/tool-registry.js';
|
||||
|
||||
export interface BaseTelemetryEvent {
|
||||
'event.name': string;
|
||||
|
||||
@@ -7,13 +7,14 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { UiTelemetryService } from './uiTelemetry.js';
|
||||
import { ToolCallDecision } from './tool-call-decision.js';
|
||||
import { ApiErrorEvent, ApiResponseEvent, ToolCallEvent } from './types.js';
|
||||
import type { ApiErrorEvent, ApiResponseEvent } from './types.js';
|
||||
import { ToolCallEvent } from './types.js';
|
||||
import {
|
||||
EVENT_API_ERROR,
|
||||
EVENT_API_RESPONSE,
|
||||
EVENT_TOOL_CALL,
|
||||
} from './constants.js';
|
||||
import {
|
||||
import type {
|
||||
CompletedToolCall,
|
||||
ErroredToolCall,
|
||||
SuccessfulToolCall,
|
||||
|
||||
@@ -12,7 +12,11 @@ import {
|
||||
} from './constants.js';
|
||||
|
||||
import { ToolCallDecision } from './tool-call-decision.js';
|
||||
import { ApiErrorEvent, ApiResponseEvent, ToolCallEvent } from './types.js';
|
||||
import type {
|
||||
ApiErrorEvent,
|
||||
ApiResponseEvent,
|
||||
ToolCallEvent,
|
||||
} from './types.js';
|
||||
|
||||
export type UiEvent =
|
||||
| (ApiResponseEvent & { 'event.name': typeof EVENT_API_RESPONSE })
|
||||
|
||||
Reference in New Issue
Block a user