fix: merge duplicate imports in packages/core (3/4) (#20928)

This commit is contained in:
nityam
2026-03-04 05:42:59 +05:30
committed by GitHub
parent d25088956d
commit 28af4e127f
143 changed files with 909 additions and 712 deletions
@@ -6,13 +6,14 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { HookAggregator } from './hookAggregator.js';
import type {
HookExecutionResult,
BeforeToolSelectionOutput,
BeforeModelOutput,
HookOutput,
import {
HookType,
HookEventName,
type HookExecutionResult,
type BeforeToolSelectionOutput,
type BeforeModelOutput,
type HookOutput,
} from './types.js';
import { HookType, HookEventName } from './types.js';
// Helper function to create proper HookExecutionResult objects
function createHookExecutionResult(
+3 -5
View File
@@ -5,11 +5,6 @@
*/
import { FunctionCallingConfigMode } from '@google/genai';
import type {
HookOutput,
HookExecutionResult,
BeforeToolSelectionOutput,
} from './types.js';
import {
DefaultHookOutput,
BeforeToolHookOutput,
@@ -18,6 +13,9 @@ import {
AfterModelHookOutput,
AfterAgentHookOutput,
HookEventName,
type HookOutput,
type HookExecutionResult,
type BeforeToolSelectionOutput,
} from './types.js';
/**
@@ -11,12 +11,13 @@ import type {
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { HookEventHandler } from './hookEventHandler.js';
import type { Config } from '../config/config.js';
import type { HookConfig, HookExecutionResult } from './types.js';
import {
NotificationType,
SessionStartSource,
HookEventName,
HookType,
type HookConfig,
type HookExecutionResult,
} from './types.js';
import type { HookPlanner } from './hookPlanner.js';
import type { HookRunner } from './hookRunner.js';
+22 -21
View File
@@ -8,27 +8,28 @@ import type { Config } from '../config/config.js';
import type { HookPlanner, HookEventContext } from './hookPlanner.js';
import type { HookRunner } from './hookRunner.js';
import type { HookAggregator, AggregatedHookResult } from './hookAggregator.js';
import { HookEventName, HookType } from './types.js';
import type {
HookConfig,
HookInput,
BeforeToolInput,
AfterToolInput,
BeforeAgentInput,
NotificationInput,
AfterAgentInput,
SessionStartInput,
SessionEndInput,
PreCompressInput,
BeforeModelInput,
AfterModelInput,
BeforeToolSelectionInput,
NotificationType,
SessionStartSource,
SessionEndReason,
PreCompressTrigger,
HookExecutionResult,
McpToolContext,
import {
HookEventName,
HookType,
type HookConfig,
type HookInput,
type BeforeToolInput,
type AfterToolInput,
type BeforeAgentInput,
type NotificationInput,
type AfterAgentInput,
type SessionStartInput,
type SessionEndInput,
type PreCompressInput,
type BeforeModelInput,
type AfterModelInput,
type BeforeToolSelectionInput,
type NotificationType,
type SessionStartSource,
type SessionEndReason,
type PreCompressTrigger,
type HookExecutionResult,
type McpToolContext,
} from './types.js';
import { defaultHookTranslator } from './hookTranslator.js';
import type {
+5 -2
View File
@@ -5,8 +5,11 @@
*/
import type { HookRegistry, HookRegistryEntry } from './hookRegistry.js';
import type { HookExecutionPlan, HookEventName } from './types.js';
import { getHookKey } from './types.js';
import {
getHookKey,
type HookExecutionPlan,
type HookEventName,
} from './types.js';
import { debugLogger } from '../utils/debugLogger.js';
/**
+7 -2
View File
@@ -5,8 +5,13 @@
*/
import type { Config } from '../config/config.js';
import type { HookDefinition, HookConfig } from './types.js';
import { HookEventName, ConfigSource, HOOKS_CONFIG_FIELDS } from './types.js';
import {
HookEventName,
ConfigSource,
HOOKS_CONFIG_FIELDS,
type HookDefinition,
type HookConfig,
} from './types.js';
import { debugLogger } from '../utils/debugLogger.js';
import { TrustedHooksManager } from './trustedHooks.js';
import { coreEvents } from '../utils/events.js';
+7 -2
View File
@@ -7,8 +7,13 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { spawn, type ChildProcessWithoutNullStreams } from 'node:child_process';
import { HookRunner } from './hookRunner.js';
import { HookEventName, HookType, ConfigSource } from './types.js';
import type { HookConfig, HookInput } from './types.js';
import {
HookEventName,
HookType,
ConfigSource,
type HookConfig,
type HookInput,
} from './types.js';
import type { Readable, Writable } from 'node:stream';
import type { Config } from '../config/config.js';
+14 -12
View File
@@ -5,19 +5,21 @@
*/
import { spawn, execSync } from 'node:child_process';
import type {
HookConfig,
CommandHookConfig,
RuntimeHookConfig,
HookInput,
HookOutput,
HookExecutionResult,
BeforeAgentInput,
BeforeModelInput,
BeforeModelOutput,
BeforeToolInput,
import {
HookEventName,
ConfigSource,
HookType,
type HookConfig,
type CommandHookConfig,
type RuntimeHookConfig,
type HookInput,
type HookOutput,
type HookExecutionResult,
type BeforeAgentInput,
type BeforeModelInput,
type BeforeModelOutput,
type BeforeToolInput,
} from './types.js';
import { HookEventName, ConfigSource, HookType } from './types.js';
import type { Config } from '../config/config.js';
import type { LLMRequest } from './hookTranslator.js';
import { debugLogger } from '../utils/debugLogger.js';
+1 -2
View File
@@ -8,11 +8,10 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { HookSystem } from './hookSystem.js';
import { Config } from '../config/config.js';
import { HookType } from './types.js';
import { spawn } from 'node:child_process';
import { spawn, type ChildProcessWithoutNullStreams } from 'node:child_process';
import * as fs from 'node:fs';
import * as os from 'node:os';
import * as path from 'node:path';
import type { ChildProcessWithoutNullStreams } from 'node:child_process';
import type { Readable, Writable } from 'node:stream';
// Mock type for the child_process spawn
+15 -17
View File
@@ -5,28 +5,26 @@
*/
import type { Config } from '../config/config.js';
import { HookRegistry } from './hookRegistry.js';
import { HookRegistry, type HookRegistryEntry } from './hookRegistry.js';
import { HookRunner } from './hookRunner.js';
import { HookAggregator } from './hookAggregator.js';
import { HookAggregator, type AggregatedHookResult } from './hookAggregator.js';
import { HookPlanner } from './hookPlanner.js';
import { HookEventHandler } from './hookEventHandler.js';
import type { HookRegistryEntry } from './hookRegistry.js';
import { debugLogger } from '../utils/debugLogger.js';
import type {
SessionStartSource,
SessionEndReason,
PreCompressTrigger,
DefaultHookOutput,
BeforeModelHookOutput,
AfterModelHookOutput,
BeforeToolSelectionHookOutput,
McpToolContext,
HookConfig,
HookEventName,
ConfigSource,
import {
NotificationType,
type SessionStartSource,
type SessionEndReason,
type PreCompressTrigger,
type DefaultHookOutput,
type BeforeModelHookOutput,
type AfterModelHookOutput,
type BeforeToolSelectionHookOutput,
type McpToolContext,
type HookConfig,
type HookEventName,
type ConfigSource,
} from './types.js';
import { NotificationType } from './types.js';
import type { AggregatedHookResult } from './hookAggregator.js';
import type {
GenerateContentParameters,
GenerateContentResponse,
+6 -3
View File
@@ -14,15 +14,18 @@ import {
HookEventName,
HookType,
BeforeToolHookOutput,
type HookDecision,
} from './types.js';
import { defaultHookTranslator } from './hookTranslator.js';
import {
defaultHookTranslator,
type LLMRequest,
type LLMResponse,
} from './hookTranslator.js';
import type {
GenerateContentParameters,
GenerateContentResponse,
ToolConfig,
} from '@google/genai';
import type { LLMRequest, LLMResponse } from './hookTranslator.js';
import type { HookDecision } from './types.js';
vi.mock('./hookTranslator.js', () => ({
defaultHookTranslator: {
+5 -5
View File
@@ -10,12 +10,12 @@ import type {
ToolConfig as GenAIToolConfig,
ToolListUnion,
} from '@google/genai';
import type {
LLMRequest,
LLMResponse,
HookToolConfig,
import {
defaultHookTranslator,
type LLMRequest,
type LLMResponse,
type HookToolConfig,
} from './hookTranslator.js';
import { defaultHookTranslator } from './hookTranslator.js';
/**
* Configuration source levels in precedence order (highest to lowest)