@google/gemini-cli-core 0.19.0-nightly.20251123.dadd606c0 → 0.19.0-nightly.20251125.f6d97d448
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/google-gemini-cli-core-0.19.0-nightly.20251124.e177314a4.tgz +0 -0
- package/dist/src/availability/modelAvailabilityService.d.ts +1 -0
- package/dist/src/availability/modelAvailabilityService.js.map +1 -1
- package/dist/src/availability/modelPolicy.d.ts +42 -0
- package/dist/src/availability/modelPolicy.js +7 -0
- package/dist/src/availability/modelPolicy.js.map +1 -0
- package/dist/src/availability/policyCatalog.d.ts +20 -0
- package/dist/src/availability/policyCatalog.js +83 -0
- package/dist/src/availability/policyCatalog.js.map +1 -0
- package/dist/src/availability/policyCatalog.test.d.ts +6 -0
- package/dist/src/availability/policyCatalog.test.js +70 -0
- package/dist/src/availability/policyCatalog.test.js.map +1 -0
- package/dist/src/config/config.d.ts +6 -0
- package/dist/src/config/config.js +13 -0
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/defaultModelConfigs.js +25 -0
- package/dist/src/config/defaultModelConfigs.js.map +1 -1
- package/dist/src/confirmation-bus/message-bus.d.ts +6 -0
- package/dist/src/confirmation-bus/message-bus.js +63 -2
- package/dist/src/confirmation-bus/message-bus.js.map +1 -1
- package/dist/src/confirmation-bus/types.d.ts +25 -2
- package/dist/src/confirmation-bus/types.js +3 -0
- package/dist/src/confirmation-bus/types.js.map +1 -1
- package/dist/src/core/client.js +75 -4
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +56 -2
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/clientHookTriggers.d.ts +36 -0
- package/dist/src/core/clientHookTriggers.js +76 -0
- package/dist/src/core/clientHookTriggers.js.map +1 -0
- package/dist/src/core/nonInteractiveToolExecutor.test.js +9 -1
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
- package/dist/src/core/prompts.js +12 -1
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +23 -0
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/core/turn.d.ts +5 -0
- package/dist/src/core/turn.js +10 -0
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/hooks/hookEventHandler.d.ts +109 -0
- package/dist/src/hooks/hookEventHandler.js +486 -0
- package/dist/src/hooks/hookEventHandler.js.map +1 -0
- package/dist/src/hooks/hookEventHandler.test.d.ts +6 -0
- package/dist/src/hooks/hookEventHandler.test.js +384 -0
- package/dist/src/hooks/hookEventHandler.test.js.map +1 -0
- package/dist/src/hooks/hookSystem.d.ts +48 -0
- package/dist/src/hooks/hookSystem.js +83 -0
- package/dist/src/hooks/hookSystem.js.map +1 -0
- package/dist/src/hooks/hookSystem.test.d.ts +6 -0
- package/dist/src/hooks/hookSystem.test.js +213 -0
- package/dist/src/hooks/hookSystem.test.js.map +1 -0
- package/dist/src/hooks/index.d.ts +15 -0
- package/dist/src/hooks/index.js +15 -0
- package/dist/src/hooks/index.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/policy/policy-engine.d.ts +17 -1
- package/dist/src/policy/policy-engine.js +90 -1
- package/dist/src/policy/policy-engine.js.map +1 -1
- package/dist/src/policy/policy-engine.test.js +222 -0
- package/dist/src/policy/policy-engine.test.js.map +1 -1
- package/dist/src/policy/types.d.ts +51 -1
- package/dist/src/policy/types.js +21 -0
- package/dist/src/policy/types.js.map +1 -1
- package/dist/src/services/chatCompressionService.d.ts +1 -0
- package/dist/src/services/chatCompressionService.js +22 -6
- package/dist/src/services/chatCompressionService.js.map +1 -1
- package/dist/src/services/chatCompressionService.test.js +27 -32
- package/dist/src/services/chatCompressionService.test.js.map +1 -1
- package/dist/src/services/test-data/resolved-aliases.golden.json +20 -0
- package/dist/src/telemetry/loggers.d.ts +2 -1
- package/dist/src/telemetry/loggers.js +12 -1
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/metrics.d.ts +22 -0
- package/dist/src/telemetry/metrics.js +32 -0
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/metrics.test.js +64 -0
- package/dist/src/telemetry/metrics.test.js.map +1 -1
- package/dist/src/telemetry/sanitize.d.ts +25 -0
- package/dist/src/telemetry/sanitize.js +48 -0
- package/dist/src/telemetry/sanitize.js.map +1 -0
- package/dist/src/telemetry/sanitize.test.d.ts +6 -0
- package/dist/src/telemetry/sanitize.test.js +279 -0
- package/dist/src/telemetry/sanitize.test.js.map +1 -0
- package/dist/src/telemetry/types.d.ts +19 -0
- package/dist/src/telemetry/types.js +65 -0
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/test-utils/mock-message-bus.d.ts +60 -0
- package/dist/src/test-utils/mock-message-bus.js +131 -0
- package/dist/src/test-utils/mock-message-bus.js.map +1 -0
- package/dist/src/utils/package.d.ts +14 -0
- package/dist/src/utils/package.js +15 -2
- package/dist/src/utils/package.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/google-gemini-cli-core-0.19.0-nightly.20251122.42c2e1b21.tgz +0 -0
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { HookEventName } from './types.js';
|
|
7
|
+
import { defaultHookTranslator } from './hookTranslator.js';
|
|
8
|
+
import { logHookCall } from '../telemetry/loggers.js';
|
|
9
|
+
import { HookCallEvent } from '../telemetry/types.js';
|
|
10
|
+
import { MessageBusType, } from '../confirmation-bus/types.js';
|
|
11
|
+
import { debugLogger } from '../utils/debugLogger.js';
|
|
12
|
+
/**
|
|
13
|
+
* Validates that a value is a non-null object
|
|
14
|
+
*/
|
|
15
|
+
function isObject(value) {
|
|
16
|
+
return typeof value === 'object' && value !== null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Validates BeforeTool input fields
|
|
20
|
+
*/
|
|
21
|
+
function validateBeforeToolInput(input) {
|
|
22
|
+
const toolName = input['tool_name'];
|
|
23
|
+
const toolInput = input['tool_input'];
|
|
24
|
+
if (typeof toolName !== 'string') {
|
|
25
|
+
throw new Error('Invalid input for BeforeTool hook event: tool_name must be a string');
|
|
26
|
+
}
|
|
27
|
+
if (!isObject(toolInput)) {
|
|
28
|
+
throw new Error('Invalid input for BeforeTool hook event: tool_input must be an object');
|
|
29
|
+
}
|
|
30
|
+
return { toolName, toolInput };
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Validates AfterTool input fields
|
|
34
|
+
*/
|
|
35
|
+
function validateAfterToolInput(input) {
|
|
36
|
+
const toolName = input['tool_name'];
|
|
37
|
+
const toolInput = input['tool_input'];
|
|
38
|
+
const toolResponse = input['tool_response'];
|
|
39
|
+
if (typeof toolName !== 'string') {
|
|
40
|
+
throw new Error('Invalid input for AfterTool hook event: tool_name must be a string');
|
|
41
|
+
}
|
|
42
|
+
if (!isObject(toolInput)) {
|
|
43
|
+
throw new Error('Invalid input for AfterTool hook event: tool_input must be an object');
|
|
44
|
+
}
|
|
45
|
+
if (!isObject(toolResponse)) {
|
|
46
|
+
throw new Error('Invalid input for AfterTool hook event: tool_response must be an object');
|
|
47
|
+
}
|
|
48
|
+
return { toolName, toolInput, toolResponse };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Validates BeforeAgent input fields
|
|
52
|
+
*/
|
|
53
|
+
function validateBeforeAgentInput(input) {
|
|
54
|
+
const prompt = input['prompt'];
|
|
55
|
+
if (typeof prompt !== 'string') {
|
|
56
|
+
throw new Error('Invalid input for BeforeAgent hook event: prompt must be a string');
|
|
57
|
+
}
|
|
58
|
+
return { prompt };
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Validates AfterAgent input fields
|
|
62
|
+
*/
|
|
63
|
+
function validateAfterAgentInput(input) {
|
|
64
|
+
const prompt = input['prompt'];
|
|
65
|
+
const promptResponse = input['prompt_response'];
|
|
66
|
+
const stopHookActive = input['stop_hook_active'];
|
|
67
|
+
if (typeof prompt !== 'string') {
|
|
68
|
+
throw new Error('Invalid input for AfterAgent hook event: prompt must be a string');
|
|
69
|
+
}
|
|
70
|
+
if (typeof promptResponse !== 'string') {
|
|
71
|
+
throw new Error('Invalid input for AfterAgent hook event: prompt_response must be a string');
|
|
72
|
+
}
|
|
73
|
+
// stopHookActive defaults to false if not a boolean
|
|
74
|
+
return {
|
|
75
|
+
prompt,
|
|
76
|
+
promptResponse,
|
|
77
|
+
stopHookActive: typeof stopHookActive === 'boolean' ? stopHookActive : false,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Validates model-related input fields (llm_request)
|
|
82
|
+
*/
|
|
83
|
+
function validateModelInput(input, eventName) {
|
|
84
|
+
const llmRequest = input['llm_request'];
|
|
85
|
+
if (!isObject(llmRequest)) {
|
|
86
|
+
throw new Error(`Invalid input for ${eventName} hook event: llm_request must be an object`);
|
|
87
|
+
}
|
|
88
|
+
return { llmRequest: llmRequest };
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Validates AfterModel input fields
|
|
92
|
+
*/
|
|
93
|
+
function validateAfterModelInput(input) {
|
|
94
|
+
const llmRequest = input['llm_request'];
|
|
95
|
+
const llmResponse = input['llm_response'];
|
|
96
|
+
if (!isObject(llmRequest)) {
|
|
97
|
+
throw new Error('Invalid input for AfterModel hook event: llm_request must be an object');
|
|
98
|
+
}
|
|
99
|
+
if (!isObject(llmResponse)) {
|
|
100
|
+
throw new Error('Invalid input for AfterModel hook event: llm_response must be an object');
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
llmRequest: llmRequest,
|
|
104
|
+
llmResponse: llmResponse,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Validates Notification input fields
|
|
109
|
+
*/
|
|
110
|
+
function validateNotificationInput(input) {
|
|
111
|
+
const notificationType = input['notification_type'];
|
|
112
|
+
const message = input['message'];
|
|
113
|
+
const details = input['details'];
|
|
114
|
+
if (typeof notificationType !== 'string') {
|
|
115
|
+
throw new Error('Invalid input for Notification hook event: notification_type must be a string');
|
|
116
|
+
}
|
|
117
|
+
if (typeof message !== 'string') {
|
|
118
|
+
throw new Error('Invalid input for Notification hook event: message must be a string');
|
|
119
|
+
}
|
|
120
|
+
if (!isObject(details)) {
|
|
121
|
+
throw new Error('Invalid input for Notification hook event: details must be an object');
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
notificationType: notificationType,
|
|
125
|
+
message,
|
|
126
|
+
details,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Hook event bus that coordinates hook execution across the system
|
|
131
|
+
*/
|
|
132
|
+
export class HookEventHandler {
|
|
133
|
+
config;
|
|
134
|
+
hookPlanner;
|
|
135
|
+
hookRunner;
|
|
136
|
+
hookAggregator;
|
|
137
|
+
messageBus;
|
|
138
|
+
constructor(config, logger, hookPlanner, hookRunner, hookAggregator, messageBus) {
|
|
139
|
+
this.config = config;
|
|
140
|
+
this.hookPlanner = hookPlanner;
|
|
141
|
+
this.hookRunner = hookRunner;
|
|
142
|
+
this.hookAggregator = hookAggregator;
|
|
143
|
+
this.messageBus = messageBus;
|
|
144
|
+
// Subscribe to hook execution requests from MessageBus
|
|
145
|
+
if (this.messageBus) {
|
|
146
|
+
this.messageBus.subscribe(MessageBusType.HOOK_EXECUTION_REQUEST, (request) => this.handleHookExecutionRequest(request));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Fire a BeforeTool event
|
|
151
|
+
* Called by handleHookExecutionRequest - executes hooks directly
|
|
152
|
+
*/
|
|
153
|
+
async fireBeforeToolEvent(toolName, toolInput) {
|
|
154
|
+
const input = {
|
|
155
|
+
...this.createBaseInput(HookEventName.BeforeTool),
|
|
156
|
+
tool_name: toolName,
|
|
157
|
+
tool_input: toolInput,
|
|
158
|
+
};
|
|
159
|
+
const context = { toolName };
|
|
160
|
+
return await this.executeHooks(HookEventName.BeforeTool, input, context);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Fire an AfterTool event
|
|
164
|
+
* Called by handleHookExecutionRequest - executes hooks directly
|
|
165
|
+
*/
|
|
166
|
+
async fireAfterToolEvent(toolName, toolInput, toolResponse) {
|
|
167
|
+
const input = {
|
|
168
|
+
...this.createBaseInput(HookEventName.AfterTool),
|
|
169
|
+
tool_name: toolName,
|
|
170
|
+
tool_input: toolInput,
|
|
171
|
+
tool_response: toolResponse,
|
|
172
|
+
};
|
|
173
|
+
const context = { toolName };
|
|
174
|
+
return await this.executeHooks(HookEventName.AfterTool, input, context);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Fire a BeforeAgent event
|
|
178
|
+
* Called by handleHookExecutionRequest - executes hooks directly
|
|
179
|
+
*/
|
|
180
|
+
async fireBeforeAgentEvent(prompt) {
|
|
181
|
+
const input = {
|
|
182
|
+
...this.createBaseInput(HookEventName.BeforeAgent),
|
|
183
|
+
prompt,
|
|
184
|
+
};
|
|
185
|
+
return await this.executeHooks(HookEventName.BeforeAgent, input);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Fire a Notification event
|
|
189
|
+
*/
|
|
190
|
+
async fireNotificationEvent(type, message, details) {
|
|
191
|
+
const input = {
|
|
192
|
+
...this.createBaseInput(HookEventName.Notification),
|
|
193
|
+
notification_type: type,
|
|
194
|
+
message,
|
|
195
|
+
details,
|
|
196
|
+
};
|
|
197
|
+
return await this.executeHooks(HookEventName.Notification, input);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Fire an AfterAgent event
|
|
201
|
+
* Called by handleHookExecutionRequest - executes hooks directly
|
|
202
|
+
*/
|
|
203
|
+
async fireAfterAgentEvent(prompt, promptResponse, stopHookActive = false) {
|
|
204
|
+
const input = {
|
|
205
|
+
...this.createBaseInput(HookEventName.AfterAgent),
|
|
206
|
+
prompt,
|
|
207
|
+
prompt_response: promptResponse,
|
|
208
|
+
stop_hook_active: stopHookActive,
|
|
209
|
+
};
|
|
210
|
+
return await this.executeHooks(HookEventName.AfterAgent, input);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Fire a SessionStart event
|
|
214
|
+
*/
|
|
215
|
+
async fireSessionStartEvent(source) {
|
|
216
|
+
const input = {
|
|
217
|
+
...this.createBaseInput(HookEventName.SessionStart),
|
|
218
|
+
source,
|
|
219
|
+
};
|
|
220
|
+
const context = { trigger: source };
|
|
221
|
+
return await this.executeHooks(HookEventName.SessionStart, input, context);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Fire a SessionEnd event
|
|
225
|
+
*/
|
|
226
|
+
async fireSessionEndEvent(reason) {
|
|
227
|
+
const input = {
|
|
228
|
+
...this.createBaseInput(HookEventName.SessionEnd),
|
|
229
|
+
reason,
|
|
230
|
+
};
|
|
231
|
+
const context = { trigger: reason };
|
|
232
|
+
return await this.executeHooks(HookEventName.SessionEnd, input, context);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Fire a PreCompress event
|
|
236
|
+
*/
|
|
237
|
+
async firePreCompressEvent(trigger) {
|
|
238
|
+
const input = {
|
|
239
|
+
...this.createBaseInput(HookEventName.PreCompress),
|
|
240
|
+
trigger,
|
|
241
|
+
};
|
|
242
|
+
const context = { trigger };
|
|
243
|
+
return await this.executeHooks(HookEventName.PreCompress, input, context);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Fire a BeforeModel event
|
|
247
|
+
* Called by handleHookExecutionRequest - executes hooks directly
|
|
248
|
+
*/
|
|
249
|
+
async fireBeforeModelEvent(llmRequest) {
|
|
250
|
+
const input = {
|
|
251
|
+
...this.createBaseInput(HookEventName.BeforeModel),
|
|
252
|
+
llm_request: defaultHookTranslator.toHookLLMRequest(llmRequest),
|
|
253
|
+
};
|
|
254
|
+
return await this.executeHooks(HookEventName.BeforeModel, input);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Fire an AfterModel event
|
|
258
|
+
* Called by handleHookExecutionRequest - executes hooks directly
|
|
259
|
+
*/
|
|
260
|
+
async fireAfterModelEvent(llmRequest, llmResponse) {
|
|
261
|
+
const input = {
|
|
262
|
+
...this.createBaseInput(HookEventName.AfterModel),
|
|
263
|
+
llm_request: defaultHookTranslator.toHookLLMRequest(llmRequest),
|
|
264
|
+
llm_response: defaultHookTranslator.toHookLLMResponse(llmResponse),
|
|
265
|
+
};
|
|
266
|
+
return await this.executeHooks(HookEventName.AfterModel, input);
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Fire a BeforeToolSelection event
|
|
270
|
+
* Called by handleHookExecutionRequest - executes hooks directly
|
|
271
|
+
*/
|
|
272
|
+
async fireBeforeToolSelectionEvent(llmRequest) {
|
|
273
|
+
const input = {
|
|
274
|
+
...this.createBaseInput(HookEventName.BeforeToolSelection),
|
|
275
|
+
llm_request: defaultHookTranslator.toHookLLMRequest(llmRequest),
|
|
276
|
+
};
|
|
277
|
+
return await this.executeHooks(HookEventName.BeforeToolSelection, input);
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Execute hooks for a specific event (direct execution without MessageBus)
|
|
281
|
+
* Used as fallback when MessageBus is not available
|
|
282
|
+
*/
|
|
283
|
+
async executeHooks(eventName, input, context) {
|
|
284
|
+
try {
|
|
285
|
+
// Create execution plan
|
|
286
|
+
const plan = this.hookPlanner.createExecutionPlan(eventName, context);
|
|
287
|
+
if (!plan || plan.hookConfigs.length === 0) {
|
|
288
|
+
return {
|
|
289
|
+
success: true,
|
|
290
|
+
allOutputs: [],
|
|
291
|
+
errors: [],
|
|
292
|
+
totalDuration: 0,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
// Execute hooks according to the plan's strategy
|
|
296
|
+
const results = plan.sequential
|
|
297
|
+
? await this.hookRunner.executeHooksSequential(plan.hookConfigs, eventName, input)
|
|
298
|
+
: await this.hookRunner.executeHooksParallel(plan.hookConfigs, eventName, input);
|
|
299
|
+
// Aggregate results
|
|
300
|
+
const aggregated = this.hookAggregator.aggregateResults(results, eventName);
|
|
301
|
+
// Process common hook output fields centrally
|
|
302
|
+
this.processCommonHookOutputFields(aggregated);
|
|
303
|
+
// Log hook execution
|
|
304
|
+
this.logHookExecution(eventName, input, results, aggregated);
|
|
305
|
+
return aggregated;
|
|
306
|
+
}
|
|
307
|
+
catch (error) {
|
|
308
|
+
debugLogger.error(`Hook event bus error for ${eventName}: ${error}`);
|
|
309
|
+
return {
|
|
310
|
+
success: false,
|
|
311
|
+
allOutputs: [],
|
|
312
|
+
errors: [error instanceof Error ? error : new Error(String(error))],
|
|
313
|
+
totalDuration: 0,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Create base hook input with common fields
|
|
319
|
+
*/
|
|
320
|
+
createBaseInput(eventName) {
|
|
321
|
+
return {
|
|
322
|
+
session_id: this.config.getSessionId(),
|
|
323
|
+
transcript_path: '', // TODO: Implement transcript path when supported
|
|
324
|
+
cwd: this.config.getWorkingDir(),
|
|
325
|
+
hook_event_name: eventName,
|
|
326
|
+
timestamp: new Date().toISOString(),
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Log hook execution for observability
|
|
331
|
+
*/
|
|
332
|
+
logHookExecution(eventName, input, results, aggregated) {
|
|
333
|
+
const successCount = results.filter((r) => r.success).length;
|
|
334
|
+
const errorCount = results.length - successCount;
|
|
335
|
+
if (errorCount > 0) {
|
|
336
|
+
debugLogger.warn(`Hook execution for ${eventName}: ${successCount} succeeded, ${errorCount} failed, ` +
|
|
337
|
+
`total duration: ${aggregated.totalDuration}ms`);
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
debugLogger.debug(`Hook execution for ${eventName}: ${successCount} hooks executed successfully, ` +
|
|
341
|
+
`total duration: ${aggregated.totalDuration}ms`);
|
|
342
|
+
}
|
|
343
|
+
// Log individual hook calls to telemetry
|
|
344
|
+
for (const result of results) {
|
|
345
|
+
// Determine hook name and type for telemetry
|
|
346
|
+
const hookName = this.getHookNameFromResult(result);
|
|
347
|
+
const hookType = this.getHookTypeFromResult(result);
|
|
348
|
+
const hookCallEvent = new HookCallEvent(eventName, hookType, hookName, { ...input }, result.duration, result.success, result.output ? { ...result.output } : undefined, result.exitCode, result.stdout, result.stderr, result.error?.message);
|
|
349
|
+
logHookCall(this.config, hookCallEvent);
|
|
350
|
+
}
|
|
351
|
+
// Log individual errors
|
|
352
|
+
for (const error of aggregated.errors) {
|
|
353
|
+
debugLogger.error(`Hook execution error: ${error.message}`);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Process common hook output fields centrally
|
|
358
|
+
*/
|
|
359
|
+
processCommonHookOutputFields(aggregated) {
|
|
360
|
+
if (!aggregated.finalOutput) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
// Handle systemMessage - show to user in transcript mode (not to agent)
|
|
364
|
+
const systemMessage = aggregated.finalOutput.systemMessage;
|
|
365
|
+
if (systemMessage && !aggregated.finalOutput.suppressOutput) {
|
|
366
|
+
debugLogger.warn(`Hook system message: ${systemMessage}`);
|
|
367
|
+
}
|
|
368
|
+
// Handle suppressOutput - already handled by not logging above when true
|
|
369
|
+
// Handle continue=false - this should stop the entire agent execution
|
|
370
|
+
if (aggregated.finalOutput.shouldStopExecution()) {
|
|
371
|
+
const stopReason = aggregated.finalOutput.getEffectiveReason();
|
|
372
|
+
debugLogger.log(`Hook requested to stop execution: ${stopReason}`);
|
|
373
|
+
// Note: The actual stopping of execution must be handled by integration points
|
|
374
|
+
// as they need to interpret this signal in the context of their specific workflow
|
|
375
|
+
// This is just logging the request centrally
|
|
376
|
+
}
|
|
377
|
+
// Other common fields like decision/reason are handled by specific hook output classes
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Get hook name from execution result for telemetry
|
|
381
|
+
*/
|
|
382
|
+
getHookNameFromResult(result) {
|
|
383
|
+
return result.hookConfig.command || 'unknown-command';
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Get hook type from execution result for telemetry
|
|
387
|
+
*/
|
|
388
|
+
getHookTypeFromResult(result) {
|
|
389
|
+
return result.hookConfig.type;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Handle hook execution requests from MessageBus
|
|
393
|
+
* This method routes the request to the appropriate fire*Event method
|
|
394
|
+
* and publishes the response back through MessageBus
|
|
395
|
+
*
|
|
396
|
+
* The request input only contains event-specific fields. This method adds
|
|
397
|
+
* the common base fields (session_id, cwd, etc.) before routing.
|
|
398
|
+
*/
|
|
399
|
+
async handleHookExecutionRequest(request) {
|
|
400
|
+
try {
|
|
401
|
+
// Add base fields to the input
|
|
402
|
+
const enrichedInput = {
|
|
403
|
+
...this.createBaseInput(request.eventName),
|
|
404
|
+
...request.input,
|
|
405
|
+
};
|
|
406
|
+
let result;
|
|
407
|
+
// Route to appropriate event handler based on eventName
|
|
408
|
+
switch (request.eventName) {
|
|
409
|
+
case HookEventName.BeforeTool: {
|
|
410
|
+
const { toolName, toolInput } = validateBeforeToolInput(enrichedInput);
|
|
411
|
+
result = await this.fireBeforeToolEvent(toolName, toolInput);
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
case HookEventName.AfterTool: {
|
|
415
|
+
const { toolName, toolInput, toolResponse } = validateAfterToolInput(enrichedInput);
|
|
416
|
+
result = await this.fireAfterToolEvent(toolName, toolInput, toolResponse);
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
case HookEventName.BeforeAgent: {
|
|
420
|
+
const { prompt } = validateBeforeAgentInput(enrichedInput);
|
|
421
|
+
result = await this.fireBeforeAgentEvent(prompt);
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
case HookEventName.AfterAgent: {
|
|
425
|
+
const { prompt, promptResponse, stopHookActive } = validateAfterAgentInput(enrichedInput);
|
|
426
|
+
result = await this.fireAfterAgentEvent(prompt, promptResponse, stopHookActive);
|
|
427
|
+
break;
|
|
428
|
+
}
|
|
429
|
+
case HookEventName.BeforeModel: {
|
|
430
|
+
const { llmRequest } = validateModelInput(enrichedInput, 'BeforeModel');
|
|
431
|
+
const translatedRequest = defaultHookTranslator.toHookLLMRequest(llmRequest);
|
|
432
|
+
// Update the enrichedInput with translated request
|
|
433
|
+
enrichedInput['llm_request'] = translatedRequest;
|
|
434
|
+
result = await this.fireBeforeModelEvent(llmRequest);
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
case HookEventName.AfterModel: {
|
|
438
|
+
const { llmRequest, llmResponse } = validateAfterModelInput(enrichedInput);
|
|
439
|
+
const translatedRequest = defaultHookTranslator.toHookLLMRequest(llmRequest);
|
|
440
|
+
const translatedResponse = defaultHookTranslator.toHookLLMResponse(llmResponse);
|
|
441
|
+
// Update the enrichedInput with translated versions
|
|
442
|
+
enrichedInput['llm_request'] = translatedRequest;
|
|
443
|
+
enrichedInput['llm_response'] = translatedResponse;
|
|
444
|
+
result = await this.fireAfterModelEvent(llmRequest, llmResponse);
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
447
|
+
case HookEventName.BeforeToolSelection: {
|
|
448
|
+
const { llmRequest } = validateModelInput(enrichedInput, 'BeforeToolSelection');
|
|
449
|
+
const translatedRequest = defaultHookTranslator.toHookLLMRequest(llmRequest);
|
|
450
|
+
// Update the enrichedInput with translated request
|
|
451
|
+
enrichedInput['llm_request'] = translatedRequest;
|
|
452
|
+
result = await this.fireBeforeToolSelectionEvent(llmRequest);
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
case HookEventName.Notification: {
|
|
456
|
+
const { notificationType, message, details } = validateNotificationInput(enrichedInput);
|
|
457
|
+
result = await this.fireNotificationEvent(notificationType, message, details);
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
default:
|
|
461
|
+
throw new Error(`Unsupported hook event: ${request.eventName}`);
|
|
462
|
+
}
|
|
463
|
+
// Publish response through MessageBus
|
|
464
|
+
if (this.messageBus) {
|
|
465
|
+
this.messageBus.publish({
|
|
466
|
+
type: MessageBusType.HOOK_EXECUTION_RESPONSE,
|
|
467
|
+
correlationId: request.correlationId,
|
|
468
|
+
success: result.success,
|
|
469
|
+
output: result.finalOutput,
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
catch (error) {
|
|
474
|
+
// Publish error response
|
|
475
|
+
if (this.messageBus) {
|
|
476
|
+
this.messageBus.publish({
|
|
477
|
+
type: MessageBusType.HOOK_EXECUTION_RESPONSE,
|
|
478
|
+
correlationId: request.correlationId,
|
|
479
|
+
success: false,
|
|
480
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
//# sourceMappingURL=hookEventHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hookEventHandler.js","sourceRoot":"","sources":["../../../src/hooks/hookEventHandler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAoB3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAK5D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EACL,cAAc,GAEf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD;;GAEG;AACH,SAAS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