mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 12:54:07 -07:00
remove unused sessionHookTriggers and exports (#16324)
This commit is contained in:
@@ -1,108 +0,0 @@
|
|||||||
/**
|
|
||||||
* @license
|
|
||||||
* Copyright 2025 Google LLC
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
import type { MessageBus } from '../confirmation-bus/message-bus.js';
|
|
||||||
import {
|
|
||||||
MessageBusType,
|
|
||||||
type HookExecutionRequest,
|
|
||||||
type HookExecutionResponse,
|
|
||||||
} from '../confirmation-bus/types.js';
|
|
||||||
import {
|
|
||||||
type SessionStartSource,
|
|
||||||
type SessionEndReason,
|
|
||||||
type PreCompressTrigger,
|
|
||||||
createHookOutput,
|
|
||||||
type DefaultHookOutput,
|
|
||||||
} from '../hooks/types.js';
|
|
||||||
import { debugLogger } from '../utils/debugLogger.js';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fires the SessionStart hook.
|
|
||||||
*
|
|
||||||
* @param messageBus The message bus to use for hook communication
|
|
||||||
* @param source The source/trigger of the session start
|
|
||||||
* @returns The output from the SessionStart hook, or undefined if failed/no output
|
|
||||||
*/
|
|
||||||
export async function fireSessionStartHook(
|
|
||||||
messageBus: MessageBus,
|
|
||||||
source: SessionStartSource,
|
|
||||||
): Promise<DefaultHookOutput | undefined> {
|
|
||||||
try {
|
|
||||||
const response = await messageBus.request<
|
|
||||||
HookExecutionRequest,
|
|
||||||
HookExecutionResponse
|
|
||||||
>(
|
|
||||||
{
|
|
||||||
type: MessageBusType.HOOK_EXECUTION_REQUEST,
|
|
||||||
eventName: 'SessionStart',
|
|
||||||
input: {
|
|
||||||
source,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MessageBusType.HOOK_EXECUTION_RESPONSE,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.output) {
|
|
||||||
return createHookOutput('SessionStart', response.output);
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
} catch (error) {
|
|
||||||
debugLogger.debug(`SessionStart hook failed:`, error);
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fires the SessionEnd hook.
|
|
||||||
*
|
|
||||||
* @param messageBus The message bus to use for hook communication
|
|
||||||
* @param reason The reason for the session end
|
|
||||||
*/
|
|
||||||
export async function fireSessionEndHook(
|
|
||||||
messageBus: MessageBus,
|
|
||||||
reason: SessionEndReason,
|
|
||||||
): Promise<void> {
|
|
||||||
try {
|
|
||||||
await messageBus.request<HookExecutionRequest, HookExecutionResponse>(
|
|
||||||
{
|
|
||||||
type: MessageBusType.HOOK_EXECUTION_REQUEST,
|
|
||||||
eventName: 'SessionEnd',
|
|
||||||
input: {
|
|
||||||
reason,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MessageBusType.HOOK_EXECUTION_RESPONSE,
|
|
||||||
);
|
|
||||||
} catch (error) {
|
|
||||||
debugLogger.debug(`SessionEnd hook failed:`, error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fires the PreCompress hook.
|
|
||||||
*
|
|
||||||
* @param messageBus The message bus to use for hook communication
|
|
||||||
* @param trigger The trigger type (manual or auto)
|
|
||||||
*/
|
|
||||||
export async function firePreCompressHook(
|
|
||||||
messageBus: MessageBus,
|
|
||||||
trigger: PreCompressTrigger,
|
|
||||||
): Promise<void> {
|
|
||||||
try {
|
|
||||||
await messageBus.request<HookExecutionRequest, HookExecutionResponse>(
|
|
||||||
{
|
|
||||||
type: MessageBusType.HOOK_EXECUTION_REQUEST,
|
|
||||||
eventName: 'PreCompress',
|
|
||||||
input: {
|
|
||||||
trigger,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MessageBusType.HOOK_EXECUTION_RESPONSE,
|
|
||||||
);
|
|
||||||
} catch (error) {
|
|
||||||
debugLogger.debug(`PreCompress hook failed:`, error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -20,10 +20,3 @@ export type { HookRegistryEntry } from './hookRegistry.js';
|
|||||||
export { ConfigSource } from './types.js';
|
export { ConfigSource } from './types.js';
|
||||||
export type { AggregatedHookResult } from './hookAggregator.js';
|
export type { AggregatedHookResult } from './hookAggregator.js';
|
||||||
export type { HookEventContext } from './hookPlanner.js';
|
export type { HookEventContext } from './hookPlanner.js';
|
||||||
|
|
||||||
// Export hook trigger functions
|
|
||||||
export {
|
|
||||||
fireSessionStartHook,
|
|
||||||
fireSessionEndHook,
|
|
||||||
firePreCompressHook,
|
|
||||||
} from '../core/sessionHookTriggers.js';
|
|
||||||
|
|||||||
Reference in New Issue
Block a user