@machina.ai/cell-cli-core 1.19.4-rc2 → 1.20.2-rc1
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/package.json +1 -1
- package/dist/src/agents/executor.js +11 -16
- package/dist/src/agents/executor.js.map +1 -1
- package/dist/src/agents/executor.test.js +8 -9
- package/dist/src/agents/executor.test.js.map +1 -1
- package/dist/src/availability/modelAvailabilityService.d.ts +1 -1
- package/dist/src/availability/modelAvailabilityService.js +2 -2
- package/dist/src/availability/modelAvailabilityService.js.map +1 -1
- package/dist/src/availability/modelAvailabilityService.test.js +3 -3
- package/dist/src/availability/modelAvailabilityService.test.js.map +1 -1
- package/dist/src/availability/policyCatalog.d.ts +3 -1
- package/dist/src/availability/policyCatalog.js +2 -2
- package/dist/src/availability/policyCatalog.js.map +1 -1
- package/dist/src/availability/policyHelpers.d.ts +21 -0
- package/dist/src/availability/policyHelpers.js +45 -0
- package/dist/src/availability/policyHelpers.js.map +1 -0
- package/dist/src/availability/policyHelpers.test.d.ts +6 -0
- package/dist/src/availability/policyHelpers.test.js +52 -0
- package/dist/src/availability/policyHelpers.test.js.map +1 -0
- package/dist/src/code_assist/experiments/client_metadata.js +1 -1
- package/dist/src/code_assist/experiments/client_metadata.js.map +1 -1
- package/dist/src/code_assist/experiments/experiments.js +2 -2
- package/dist/src/code_assist/experiments/experiments.js.map +1 -1
- package/dist/src/code_assist/oauth2.js +3 -3
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/code_assist/oauth2.test.js +1 -1
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/code_assist/server.d.ts +2 -1
- package/dist/src/code_assist/server.js +7 -4
- package/dist/src/code_assist/server.js.map +1 -1
- package/dist/src/code_assist/server.test.js +24 -0
- package/dist/src/code_assist/server.test.js.map +1 -1
- package/dist/src/code_assist/types.d.ts +14 -0
- package/dist/src/config/config.d.ts +14 -0
- package/dist/src/config/config.js +36 -0
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +14 -0
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/core/AuthenticatedContentGenerator.js +4 -4
- package/dist/src/core/AuthenticatedContentGenerator.js.map +1 -1
- package/dist/src/core/client.js +5 -38
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +45 -0
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/coreToolHookTriggers.d.ts +55 -0
- package/dist/src/core/coreToolHookTriggers.js +244 -0
- package/dist/src/core/coreToolHookTriggers.js.map +1 -0
- package/dist/src/core/coreToolScheduler.js +11 -2
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +66 -1
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/geminiChat.js +91 -19
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +15 -4
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/geminiChatHookTriggers.d.ts +64 -0
- package/dist/src/core/geminiChatHookTriggers.js +136 -0
- package/dist/src/core/geminiChatHookTriggers.js.map +1 -0
- package/dist/src/core/loggingContentGenerator.js +9 -4
- package/dist/src/core/loggingContentGenerator.js.map +1 -1
- package/dist/src/core/prompts.js +39 -20
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/fallback/handler.js +100 -28
- package/dist/src/fallback/handler.js.map +1 -1
- package/dist/src/fallback/handler.test.js +170 -0
- package/dist/src/fallback/handler.test.js.map +1 -1
- package/dist/src/fallback/types.d.ts +8 -0
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/hooks/hookEventHandler.js +11 -11
- package/dist/src/hooks/hookEventHandler.js.map +1 -1
- package/dist/src/hooks/hookRunner.js +7 -1
- package/dist/src/hooks/hookRunner.js.map +1 -1
- package/dist/src/hooks/hookRunner.test.js +1 -0
- package/dist/src/hooks/hookRunner.test.js.map +1 -1
- package/dist/src/hooks/hookSystem.test.js +1 -0
- package/dist/src/hooks/hookSystem.test.js.map +1 -1
- package/dist/src/ide/ide-client.js +3 -3
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/ide/ide-client.test.js +17 -0
- package/dist/src/ide/ide-client.test.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/auth-provider.d.ts +16 -0
- package/dist/src/mcp/auth-provider.js +7 -0
- package/dist/src/mcp/auth-provider.js.map +1 -0
- package/dist/src/mcp/google-auth-provider.d.ts +10 -2
- package/dist/src/mcp/google-auth-provider.js +28 -0
- package/dist/src/mcp/google-auth-provider.js.map +1 -1
- package/dist/src/mcp/google-auth-provider.test.js +45 -0
- package/dist/src/mcp/google-auth-provider.test.js.map +1 -1
- package/dist/src/mcp/mcpLauncher.js +32 -8
- package/dist/src/mcp/mcpLauncher.js.map +1 -1
- package/dist/src/mcp/sa-impersonation-provider.d.ts +2 -2
- package/dist/src/mcp/sa-impersonation-provider.js.map +1 -1
- package/dist/src/mcp/token-storage/hybrid-token-storage.js +1 -1
- package/dist/src/mcp/token-storage/hybrid-token-storage.js.map +1 -1
- package/dist/src/policy/policies/read-only.toml +5 -0
- package/dist/src/services/chatCompressionService.js +2 -2
- package/dist/src/services/chatCompressionService.js.map +1 -1
- package/dist/src/services/chatCompressionService.test.js +7 -0
- package/dist/src/services/chatCompressionService.test.js.map +1 -1
- package/dist/src/services/contextManager.d.ts +35 -0
- package/dist/src/services/contextManager.js +68 -0
- package/dist/src/services/contextManager.js.map +1 -0
- package/dist/src/services/contextManager.test.d.ts +6 -0
- package/dist/src/services/contextManager.test.js +105 -0
- package/dist/src/services/contextManager.test.js.map +1 -0
- package/dist/src/services/loopDetectionService.js +1 -1
- package/dist/src/services/loopDetectionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.js +51 -23
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +102 -12
- package/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +1 -0
- package/dist/src/telemetry/index.js +1 -0
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/loggers.js +2 -5
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +175 -13
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/startupProfiler.d.ts +51 -0
- package/dist/src/telemetry/startupProfiler.js +147 -0
- package/dist/src/telemetry/startupProfiler.js.map +1 -0
- package/dist/src/telemetry/startupProfiler.test.d.ts +6 -0
- package/dist/src/telemetry/startupProfiler.test.js +247 -0
- package/dist/src/telemetry/startupProfiler.test.js.map +1 -0
- package/dist/src/telemetry/trace.js +2 -2
- package/dist/src/telemetry/trace.js.map +1 -1
- package/dist/src/telemetry/types.d.ts +6 -4
- package/dist/src/telemetry/types.js +35 -9
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.d.ts +1 -0
- package/dist/src/tools/mcp-client-manager.js +10 -0
- package/dist/src/tools/mcp-client-manager.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.test.js +25 -0
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +1 -0
- package/dist/src/tools/mcp-client.js +4 -6
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +47 -0
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/shell.js +43 -3
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +23 -4
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/smart-edit.js +1 -1
- package/dist/src/tools/smart-edit.js.map +1 -1
- package/dist/src/tools/web-fetch.js +1 -1
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/utils/exitCodes.d.ts +12 -0
- package/dist/src/utils/exitCodes.js +13 -0
- package/dist/src/utils/exitCodes.js.map +1 -0
- package/dist/src/utils/memoryDiscovery.d.ts +5 -0
- package/dist/src/utils/memoryDiscovery.js +7 -3
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +28 -0
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/stdio.d.ts +2 -2
- package/dist/src/utils/stdio.js +2 -2
- package/dist/src/utils/stdio.js.map +1 -1
- package/dist/src/utils/stdio.test.js +5 -5
- package/dist/src/utils/stdio.test.js.map +1 -1
- package/dist/src/utils/tokenCalculation.d.ts +19 -0
- package/dist/src/utils/tokenCalculation.js +70 -0
- package/dist/src/utils/tokenCalculation.js.map +1 -0
- package/dist/src/utils/tokenCalculation.test.d.ts +6 -0
- package/dist/src/utils/tokenCalculation.test.js +78 -0
- package/dist/src/utils/tokenCalculation.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { GenerateContentResponse, GenerateContentParameters, GenerateContentConfig, ContentListUnion, ToolConfig, ToolListUnion } from '@google/genai';
|
|
7
|
+
import type { MessageBus } from '../confirmation-bus/message-bus.js';
|
|
8
|
+
/**
|
|
9
|
+
* Result from firing the BeforeModel hook.
|
|
10
|
+
*/
|
|
11
|
+
export interface BeforeModelHookResult {
|
|
12
|
+
/** Whether the model call was blocked */
|
|
13
|
+
blocked: boolean;
|
|
14
|
+
/** Reason for blocking (if blocked) */
|
|
15
|
+
reason?: string;
|
|
16
|
+
/** Synthetic response to return instead of calling the model (if blocked) */
|
|
17
|
+
syntheticResponse?: GenerateContentResponse;
|
|
18
|
+
/** Modified config (if not blocked) */
|
|
19
|
+
modifiedConfig?: GenerateContentConfig;
|
|
20
|
+
/** Modified contents (if not blocked) */
|
|
21
|
+
modifiedContents?: ContentListUnion;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Result from firing the BeforeToolSelection hook.
|
|
25
|
+
*/
|
|
26
|
+
export interface BeforeToolSelectionHookResult {
|
|
27
|
+
/** Modified tool config */
|
|
28
|
+
toolConfig?: ToolConfig;
|
|
29
|
+
/** Modified tools */
|
|
30
|
+
tools?: ToolListUnion;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Result from firing the AfterModel hook.
|
|
34
|
+
* Contains either a modified response or indicates to use the original chunk.
|
|
35
|
+
*/
|
|
36
|
+
export interface AfterModelHookResult {
|
|
37
|
+
/** The response to yield (either modified or original) */
|
|
38
|
+
response: GenerateContentResponse;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Fires the BeforeModel hook and returns the result.
|
|
42
|
+
*
|
|
43
|
+
* @param messageBus The message bus to use for hook communication
|
|
44
|
+
* @param llmRequest The LLM request parameters
|
|
45
|
+
* @returns The hook result with blocking info or modifications
|
|
46
|
+
*/
|
|
47
|
+
export declare function fireBeforeModelHook(messageBus: MessageBus, llmRequest: GenerateContentParameters): Promise<BeforeModelHookResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Fires the BeforeToolSelection hook and returns the result.
|
|
50
|
+
*
|
|
51
|
+
* @param messageBus The message bus to use for hook communication
|
|
52
|
+
* @param llmRequest The LLM request parameters
|
|
53
|
+
* @returns The hook result with tool configuration modifications
|
|
54
|
+
*/
|
|
55
|
+
export declare function fireBeforeToolSelectionHook(messageBus: MessageBus, llmRequest: GenerateContentParameters): Promise<BeforeToolSelectionHookResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Fires the AfterModel hook and returns the result.
|
|
58
|
+
*
|
|
59
|
+
* @param messageBus The message bus to use for hook communication
|
|
60
|
+
* @param originalRequest The original LLM request parameters
|
|
61
|
+
* @param chunk The current response chunk from the model
|
|
62
|
+
* @returns The hook result containing the response to yield
|
|
63
|
+
*/
|
|
64
|
+
export declare function fireAfterModelHook(messageBus: MessageBus, originalRequest: GenerateContentParameters, chunk: GenerateContentResponse): Promise<AfterModelHookResult>;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { MessageBusType, } from '../confirmation-bus/types.js';
|
|
7
|
+
import { createHookOutput, } from '../hooks/types.js';
|
|
8
|
+
import { debugLogger } from '../utils/debugLogger.js';
|
|
9
|
+
/**
|
|
10
|
+
* Fires the BeforeModel hook and returns the result.
|
|
11
|
+
*
|
|
12
|
+
* @param messageBus The message bus to use for hook communication
|
|
13
|
+
* @param llmRequest The LLM request parameters
|
|
14
|
+
* @returns The hook result with blocking info or modifications
|
|
15
|
+
*/
|
|
16
|
+
export async function fireBeforeModelHook(messageBus, llmRequest) {
|
|
17
|
+
try {
|
|
18
|
+
const response = await messageBus.request({
|
|
19
|
+
type: MessageBusType.HOOK_EXECUTION_REQUEST,
|
|
20
|
+
eventName: 'BeforeModel',
|
|
21
|
+
input: {
|
|
22
|
+
llm_request: llmRequest,
|
|
23
|
+
},
|
|
24
|
+
}, MessageBusType.HOOK_EXECUTION_RESPONSE);
|
|
25
|
+
// Reconstruct result from response
|
|
26
|
+
const beforeResultFinalOutput = response.output
|
|
27
|
+
? createHookOutput('BeforeModel', response.output)
|
|
28
|
+
: undefined;
|
|
29
|
+
const hookOutput = beforeResultFinalOutput;
|
|
30
|
+
// Check if hook blocked the model call or requested to stop execution
|
|
31
|
+
const blockingError = hookOutput?.getBlockingError();
|
|
32
|
+
if (blockingError?.blocked || hookOutput?.shouldStopExecution()) {
|
|
33
|
+
const beforeModelOutput = hookOutput;
|
|
34
|
+
const syntheticResponse = beforeModelOutput.getSyntheticResponse();
|
|
35
|
+
const reason = hookOutput?.getEffectiveReason() || 'Model call blocked by hook';
|
|
36
|
+
return {
|
|
37
|
+
blocked: true,
|
|
38
|
+
reason,
|
|
39
|
+
syntheticResponse,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
// Apply modifications from hook
|
|
43
|
+
if (hookOutput) {
|
|
44
|
+
const beforeModelOutput = hookOutput;
|
|
45
|
+
const modifiedRequest = beforeModelOutput.applyLLMRequestModifications(llmRequest);
|
|
46
|
+
return {
|
|
47
|
+
blocked: false,
|
|
48
|
+
modifiedConfig: modifiedRequest.config,
|
|
49
|
+
modifiedContents: modifiedRequest.contents,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return { blocked: false };
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
debugLogger.warn(`BeforeModel hook failed:`, error);
|
|
56
|
+
return { blocked: false };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Fires the BeforeToolSelection hook and returns the result.
|
|
61
|
+
*
|
|
62
|
+
* @param messageBus The message bus to use for hook communication
|
|
63
|
+
* @param llmRequest The LLM request parameters
|
|
64
|
+
* @returns The hook result with tool configuration modifications
|
|
65
|
+
*/
|
|
66
|
+
export async function fireBeforeToolSelectionHook(messageBus, llmRequest) {
|
|
67
|
+
try {
|
|
68
|
+
const response = await messageBus.request({
|
|
69
|
+
type: MessageBusType.HOOK_EXECUTION_REQUEST,
|
|
70
|
+
eventName: 'BeforeToolSelection',
|
|
71
|
+
input: {
|
|
72
|
+
llm_request: llmRequest,
|
|
73
|
+
},
|
|
74
|
+
}, MessageBusType.HOOK_EXECUTION_RESPONSE);
|
|
75
|
+
// Reconstruct result from response
|
|
76
|
+
const toolSelectionResultFinalOutput = response.output
|
|
77
|
+
? createHookOutput('BeforeToolSelection', response.output)
|
|
78
|
+
: undefined;
|
|
79
|
+
// Apply tool configuration modifications
|
|
80
|
+
if (toolSelectionResultFinalOutput) {
|
|
81
|
+
const beforeToolSelectionOutput = toolSelectionResultFinalOutput;
|
|
82
|
+
const modifiedConfig = beforeToolSelectionOutput.applyToolConfigModifications({
|
|
83
|
+
toolConfig: llmRequest.config?.toolConfig,
|
|
84
|
+
tools: llmRequest.config?.tools,
|
|
85
|
+
});
|
|
86
|
+
return {
|
|
87
|
+
toolConfig: modifiedConfig.toolConfig,
|
|
88
|
+
tools: modifiedConfig.tools,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return {};
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
debugLogger.warn(`BeforeToolSelection hook failed:`, error);
|
|
95
|
+
return {};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Fires the AfterModel hook and returns the result.
|
|
100
|
+
*
|
|
101
|
+
* @param messageBus The message bus to use for hook communication
|
|
102
|
+
* @param originalRequest The original LLM request parameters
|
|
103
|
+
* @param chunk The current response chunk from the model
|
|
104
|
+
* @returns The hook result containing the response to yield
|
|
105
|
+
*/
|
|
106
|
+
export async function fireAfterModelHook(messageBus, originalRequest, chunk) {
|
|
107
|
+
try {
|
|
108
|
+
const response = await messageBus.request({
|
|
109
|
+
type: MessageBusType.HOOK_EXECUTION_REQUEST,
|
|
110
|
+
eventName: 'AfterModel',
|
|
111
|
+
input: {
|
|
112
|
+
llm_request: originalRequest,
|
|
113
|
+
llm_response: chunk,
|
|
114
|
+
},
|
|
115
|
+
}, MessageBusType.HOOK_EXECUTION_RESPONSE);
|
|
116
|
+
// Reconstruct result from response
|
|
117
|
+
const afterResultFinalOutput = response.output
|
|
118
|
+
? createHookOutput('AfterModel', response.output)
|
|
119
|
+
: undefined;
|
|
120
|
+
// Apply modifications from hook (handles both normal modifications and stop execution)
|
|
121
|
+
if (afterResultFinalOutput) {
|
|
122
|
+
const afterModelOutput = afterResultFinalOutput;
|
|
123
|
+
const modifiedResponse = afterModelOutput.getModifiedResponse();
|
|
124
|
+
if (modifiedResponse) {
|
|
125
|
+
return { response: modifiedResponse };
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return { response: chunk };
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
debugLogger.warn(`AfterModel hook failed:`, error);
|
|
132
|
+
// On error, return original chunk to avoid interrupting the stream.
|
|
133
|
+
return { response: chunk };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=geminiChatHookTriggers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geminiChatHookTriggers.js","sourceRoot":"","sources":["../../../src/core/geminiChatHookTriggers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,EACL,cAAc,GAGf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,gBAAgB,GAIjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAqCtD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,UAAsB,EACtB,UAAqC;IAErC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAIvC;YACE,IAAI,EAAE,cAAc,CAAC,sBAAsB;YAC3C,SAAS,EAAE,aAAa;YACxB,KAAK,EAAE;gBACL,WAAW,EAAE,UAAgD;aAC9D;SACF,EACD,cAAc,CAAC,uBAAuB,CACvC,CAAC;QAEF,mCAAmC;QACnC,MAAM,uBAAuB,GAAG,QAAQ,CAAC,MAAM;YAC7C,CAAC,CAAC,gBAAgB,CAAC,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC;YAClD,CAAC,CAAC,SAAS,CAAC;QAEd,MAAM,UAAU,GAAG,uBAAuB,CAAC;QAE3C,sEAAsE;QACtE,MAAM,aAAa,GAAG,UAAU,EAAE,gBAAgB,EAAE,CAAC;QACrD,IAAI,aAAa,EAAE,OAAO,IAAI,UAAU,EAAE,mBAAmB,EAAE,EAAE,CAAC;YA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,IAAI,gBAAgB,EAAE,CAAC;gBACrB,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;YACxC,CAAC;QACH,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,WAAW,CAAC,IAAI,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;QACnD,oEAAoE;QACpE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -22,9 +22,14 @@ export class LoggingContentGenerator {
|
|
|
22
22
|
getWrapped() {
|
|
23
23
|
return this.wrapped;
|
|
24
24
|
}
|
|
25
|
-
logApiRequest(contents, model, promptId) {
|
|
25
|
+
logApiRequest(contents, model, promptId, generationConfig, serverDetails) {
|
|
26
26
|
const requestText = JSON.stringify(contents);
|
|
27
|
-
logApiRequest(this.config, new ApiRequestEvent(model,
|
|
27
|
+
logApiRequest(this.config, new ApiRequestEvent(model, {
|
|
28
|
+
prompt_id: promptId,
|
|
29
|
+
contents,
|
|
30
|
+
generate_content_config: generationConfig,
|
|
31
|
+
server: serverDetails,
|
|
32
|
+
}, requestText));
|
|
28
33
|
}
|
|
29
34
|
_getEndpointUrl(req, method) {
|
|
30
35
|
// Case 1: Authenticated with a Google account (`gcloud auth login`).
|
|
@@ -83,8 +88,8 @@ export class LoggingContentGenerator {
|
|
|
83
88
|
spanMetadata.input = { request: req, userPromptId, model: req.model };
|
|
84
89
|
const startTime = Date.now();
|
|
85
90
|
const contents = toContents(req.contents);
|
|
86
|
-
this.logApiRequest(toContents(req.contents), req.model, userPromptId);
|
|
87
91
|
const serverDetails = this._getEndpointUrl(req, 'generateContent');
|
|
92
|
+
this.logApiRequest(contents, req.model, userPromptId, req.config, serverDetails);
|
|
88
93
|
try {
|
|
89
94
|
const response = await this.wrapped.generateContent(req, userPromptId);
|
|
90
95
|
spanMetadata.output = {
|
|
@@ -109,8 +114,8 @@ export class LoggingContentGenerator {
|
|
|
109
114
|
}, async ({ metadata: spanMetadata, endSpan }) => {
|
|
110
115
|
spanMetadata.input = { request: req, userPromptId, model: req.model };
|
|
111
116
|
const startTime = Date.now();
|
|
112
|
-
this.logApiRequest(toContents(req.contents), req.model, userPromptId);
|
|
113
117
|
const serverDetails = this._getEndpointUrl(req, 'generateContentStream');
|
|
118
|
+
this.logApiRequest(toContents(req.contents), req.model, userPromptId, req.config, serverDetails);
|
|
114
119
|
let stream;
|
|
115
120
|
try {
|
|
116
121
|
stream = await this.wrapped.generateContentStream(req, userPromptId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loggingContentGenerator.js","sourceRoot":"","sources":["../../../src/core/loggingContentGenerator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAeH,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,WAAW,EACX,aAAa,EACb,cAAc,GACf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAqB,MAAM,uBAAuB,CAAC;AAM7E;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAEf;IACA;IAFnB,YACmB,OAAyB,EACzB,MAAc;QADd,YAAO,GAAP,OAAO,CAAkB;QACzB,WAAM,GAAN,MAAM,CAAQ;IAC9B,CAAC;IAEJ,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEO,aAAa,CACnB,QAAmB,EACnB,KAAa,EACb,QAAgB;
|
|
1
|
+
{"version":3,"file":"loggingContentGenerator.js","sourceRoot":"","sources":["../../../src/core/loggingContentGenerator.ts"],"names":[],"mappings":"AAA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C;YAC1C,IAAI,CAAC,YAAY,CACf,UAAU,EACV,KAAK,EACL,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,IAAI,GAAG,CAAC,KAAK,EACvC,YAAY,EACZ,eAAe,EACf,GAAG,CAAC,MAAM,EACV,aAAa,CACd,CAAC;YACF,MAAM,KAAK,CAAC;QACd,CAAC;gBAAS,CAAC;YACT,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,GAA0B;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,GAA2B;QAE3B,OAAO,iBAAiB,CACtB;YACE,IAAI,EAAE,cAAc;SACrB,EACD,KAAK,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,EAAE;YACnC,YAAY,CAAC,KAAK,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;YACtC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;YACpD,YAAY,CAAC,MAAM,GAAG,MAAM,CAAC;YAC7B,OAAO,MAAM,CAAC;QAChB,CAAC,CACF,CAAC;IACJ,CAAC;CACF"}
|
package/dist/src/core/prompts.js
CHANGED
|
@@ -75,7 +75,11 @@ export function getCoreSystemPrompt(config, userMemory) {
|
|
|
75
75
|
}
|
|
76
76
|
// TODO(joshualitt): Replace with system instructions on model configs.
|
|
77
77
|
const desiredModel = getEffectiveModel(config.isInFallbackMode(), config.getModel(), config.getPreviewFeatures());
|
|
78
|
-
const
|
|
78
|
+
const isGemini3 = desiredModel === PREVIEW_GEMINI_MODEL;
|
|
79
|
+
const mandatesVariant = isGemini3
|
|
80
|
+
? `
|
|
81
|
+
- **Do not call tools in silence:** You must provide to the user very short and concise natural explanation (one sentence) before calling tools.`
|
|
82
|
+
: ``;
|
|
79
83
|
const enableCodebaseInvestigator = config
|
|
80
84
|
.getToolRegistry()
|
|
81
85
|
.getAllToolNames()
|
|
@@ -89,13 +93,14 @@ export function getCoreSystemPrompt(config, userMemory) {
|
|
|
89
93
|
.getAllToolNames()
|
|
90
94
|
.map((name) => `'${name}'`)
|
|
91
95
|
.join(', ');
|
|
96
|
+
const interactiveMode = config.isInteractiveShellEnabled();
|
|
92
97
|
let basePrompt;
|
|
93
98
|
if (systemMdEnabled) {
|
|
94
99
|
basePrompt = fs.readFileSync(systemMdPath, 'utf8');
|
|
95
100
|
}
|
|
96
101
|
else {
|
|
97
102
|
const promptConfig = {
|
|
98
|
-
preamble: `You are an interactive CLI agent specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.`,
|
|
103
|
+
preamble: `You are ${interactiveMode ? 'an interactive ' : 'a non-interactive '}CLI agent specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.`,
|
|
99
104
|
coreMandates: `
|
|
100
105
|
# Core Mandates
|
|
101
106
|
|
|
@@ -105,9 +110,12 @@ export function getCoreSystemPrompt(config, userMemory) {
|
|
|
105
110
|
- **Idiomatic Changes:** When editing, understand the local context (imports, functions/classes) to ensure your changes integrate naturally and idiomatically.
|
|
106
111
|
- **Comments:** Add code comments sparingly. Focus on *why* something is done, especially for complex logic, rather than *what* is done. Only add high-value comments if necessary for clarity or if requested by the user. Do not edit comments that are separate from the code you are changing. *NEVER* talk to the user or describe your changes through comments.
|
|
107
112
|
- **Proactiveness:** Fulfill the user's request thoroughly. When adding features or fixing bugs, this includes adding tests to ensure quality. Consider all created files, especially tests, to be permanent artifacts unless the user says otherwise.
|
|
108
|
-
-
|
|
113
|
+
- ${interactiveMode ? `**Confirm Ambiguity/Expansion:** Do not take significant actions beyond the clear scope of the request without confirming with the user. If asked *how* to do something, explain first, don't just do it.` : `**Handle Ambiguity/Expansion:** Do not take significant actions beyond the clear scope of the request.`}
|
|
109
114
|
- **Explaining Changes:** After completing a code modification or file operation *do not* provide summaries unless asked.
|
|
110
|
-
- **Do Not revert changes:** Do not revert changes to the codebase unless asked to do so by the user. Only revert changes made by you if they have resulted in an error or if the user has explicitly asked you to revert the changes
|
|
115
|
+
- **Do Not revert changes:** Do not revert changes to the codebase unless asked to do so by the user. Only revert changes made by you if they have resulted in an error or if the user has explicitly asked you to revert the changes.${mandatesVariant}${!interactiveMode
|
|
116
|
+
? `
|
|
117
|
+
- **Continue the work** You are not to interact with the user. Do your best to complete the task at hand, using your best judgement and avoid asking user for any additional information.`
|
|
118
|
+
: ''}`,
|
|
111
119
|
primaryWorkflows_prefix: `
|
|
112
120
|
# Primary Workflows
|
|
113
121
|
|
|
@@ -140,14 +148,14 @@ When requested to perform tasks like fixing bugs, adding features, refactoring,
|
|
|
140
148
|
primaryWorkflows_suffix: `3. **Implement:** Use the available tools (${availableTools}) to act on the plan, strictly adhering to the project's established conventions (detailed under 'Core
|
|
141
149
|
Mandates').
|
|
142
150
|
4. **Verify (Tests):** If applicable and feasible, verify the changes using the project's testing procedures. Identify the correct test commands and frameworks by examining 'README' files, build/package configuration (e.g., 'package.json'), or existing test execution patterns. NEVER assume standard test commands.
|
|
143
|
-
5. **Verify (Standards):** VERY IMPORTANT: After making code changes, execute the project-specific build, linting and type-checking commands (e.g., 'tsc', 'npm run lint', 'ruff check .') that you have identified for this project (or obtained from the user). This ensures code quality and adherence to standards
|
|
151
|
+
5. **Verify (Standards):** VERY IMPORTANT: After making code changes, execute the project-specific build, linting and type-checking commands (e.g., 'tsc', 'npm run lint', 'ruff check .') that you have identified for this project (or obtained from the user). This ensures code quality and adherence to standards.${interactiveMode ? " If unsure about these commands, you can ask the user if they'd like you to run them and if so how to." : ''}
|
|
144
152
|
6. **Finalize:** After all verification passes, consider the task complete. Do not remove or revert any changes or created files (like tests). Await the user's next instruction.
|
|
145
153
|
|
|
146
154
|
## New Applications
|
|
147
155
|
|
|
148
156
|
**Goal:** Autonomously implement and deliver a visually appealing, substantially complete, and functional prototype. Utilize all tools at your disposal (${availableTools}) to implement the application.
|
|
149
157
|
|
|
150
|
-
1. **Understand Requirements:** Analyze the user's request to identify core features, desired user experience (UX), visual aesthetic, application type/platform (web, mobile, desktop, CLI, library, 2D or 3D game), and explicit constraints
|
|
158
|
+
1. **Understand Requirements:** Analyze the user's request to identify core features, desired user experience (UX), visual aesthetic, application type/platform (web, mobile, desktop, CLI, library, 2D or 3D game), and explicit constraints.${interactiveMode ? ' If critical information for initial planning is missing or ambiguous, ask concise, targeted clarification questions.' : ''}
|
|
151
159
|
2. **Propose Plan:** Formulate an internal development plan. Present a clear, concise, high-level summary to the user. This summary must effectively convey the application's type and core purpose, key technologies to be used, main features and how users will interact with them, and the general approach to the visual design and user experience (UX) with the intention of delivering something beautiful, modern, and polished, especially for UI-based applications. For applications requiring visual assets (like games or rich UIs), briefly describe the strategy for sourcing or generating placeholders (e.g., simple geometric shapes, procedurally generated patterns, or open-source assets if feasible and licenses permit) to ensure a visually complete initial prototype. Ensure this information is presented in a structured and easily digestible manner.
|
|
152
160
|
- When key technologies aren't specified, prefer the following:
|
|
153
161
|
- **Websites (Frontend):** React (JavaScript/TypeScript) or Angular with Bootstrap CSS, incorporating Material Design principles for UI/UX.
|
|
@@ -157,10 +165,18 @@ Mandates').
|
|
|
157
165
|
- **Mobile App:** Compose Multiplatform (Kotlin Multiplatform) or Flutter (Dart) using Material Design libraries and principles, when sharing code between Android and iOS. Jetpack Compose (Kotlin JVM) with Material Design principles or SwiftUI (Swift) for native apps targeted at either Android or iOS, respectively.
|
|
158
166
|
- **3d Games:** HTML/CSS/JavaScript with Three.js.
|
|
159
167
|
- **2d Games:** HTML/CSS/JavaScript.
|
|
160
|
-
|
|
161
|
-
|
|
168
|
+
${(function () {
|
|
169
|
+
if (interactiveMode) {
|
|
170
|
+
return `3. **User Approval:** Obtain user approval for the proposed plan.
|
|
171
|
+
4. **Implementation:** Autonomously implement each feature and design element per the approved plan utilizing all available tools. When starting ensure you scaffold the application using '${SHELL_TOOL_NAME}' for commands like 'npm init', 'npx create-react-app'. Aim for full scope completion. Proactively create or source necessary placeholder assets (e.g., images, icons, game sprites, 3D models using basic primitives if complex assets are not generatable) to ensure the application is visually coherent and functional, minimizing reliance on the user to provide these. If the model can generate simple assets (e.g., a uniformly colored square sprite, a simple 3D cube), it should do so. Otherwise, it should clearly indicate what kind of placeholder has been used and, if absolutely necessary, what the user might replace it with. Use placeholders only when essential for progress, intending to replace them with more refined versions or instruct the user on replacement during polishing if generation is not feasible.
|
|
162
172
|
5. **Verify:** Review work against the original request, the approved plan. Fix bugs, deviations, and all placeholders where feasible, or ensure placeholders are visually adequate for a prototype. Ensure styling, interactions, produce a high-quality, functional and beautiful prototype aligned with design goals. Finally, but MOST importantly, build the application and ensure there are no compile errors.
|
|
163
|
-
6. **Solicit Feedback:** If still applicable, provide instructions on how to start the application and request user feedback on the prototype
|
|
173
|
+
6. **Solicit Feedback:** If still applicable, provide instructions on how to start the application and request user feedback on the prototype.`;
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
return `3. **Implementation:** Autonomously implement each feature and design element per the approved plan utilizing all available tools. When starting ensure you scaffold the application using '${SHELL_TOOL_NAME}' for commands like 'npm init', 'npx create-react-app'. Aim for full scope completion. Proactively create or source necessary placeholder assets (e.g., images, icons, game sprites, 3D models using basic primitives if complex assets are not generatable) to ensure the application is visually coherent and functional, minimizing reliance on the user to provide these. If the model can generate simple assets (e.g., a uniformly colored square sprite, a simple 3D cube), it should do so. Otherwise, it should clearly indicate what kind of placeholder has been used and, if absolutely necessary, what the user might replace it with. Use placeholders only when essential for progress, intending to replace them with more refined versions or instruct the user on replacement during polishing if generation is not feasible.
|
|
177
|
+
4. **Verify:** Review work against the original request, the approved plan. Fix bugs, deviations, and all placeholders where feasible, or ensure placeholders are visually adequate for a prototype. Ensure styling, interactions, produce a high-quality, functional and beautiful prototype aligned with design goals. Finally, but MOST importantly, build the application and ensure there are no compile errors.`;
|
|
178
|
+
}
|
|
179
|
+
})()}`,
|
|
164
180
|
operationalGuidelines: `
|
|
165
181
|
# Operational Guidelines
|
|
166
182
|
${(function () {
|
|
@@ -184,13 +200,13 @@ IT IS CRITICAL TO FOLLOW THESE GUIDELINES TO AVOID EXCESSIVE TOKEN CONSUMPTION.
|
|
|
184
200
|
## Tone and Style (CLI Interaction)
|
|
185
201
|
- **Concise & Direct:** Adopt a professional, direct, and concise tone suitable for a CLI environment.
|
|
186
202
|
- **Minimal Output:** Aim for fewer than 3 lines of text output (excluding tool use/code generation) per response whenever practical. Focus strictly on the user's query.
|
|
187
|
-
- **Clarity over Brevity (When Needed):** While conciseness is key, prioritize clarity for essential explanations or when seeking necessary clarification if a request is ambiguous
|
|
188
|
-
|
|
189
|
-
if (useChattySystemPrompt) {
|
|
203
|
+
- **Clarity over Brevity (When Needed):** While conciseness is key, prioritize clarity for essential explanations or when seeking necessary clarification if a request is ambiguous.${(function () {
|
|
204
|
+
if (isGemini3) {
|
|
190
205
|
return '';
|
|
191
206
|
}
|
|
192
207
|
else {
|
|
193
|
-
return
|
|
208
|
+
return `
|
|
209
|
+
- **No Chitchat:** Avoid conversational filler, preambles ("Okay, I will now..."), or postambles ("I have finished the changes..."). Get straight to the action or answer.`;
|
|
194
210
|
}
|
|
195
211
|
})()}
|
|
196
212
|
- **Formatting:** Use GitHub-flavored Markdown. Responses will be rendered in monospace.
|
|
@@ -204,16 +220,17 @@ ${(function () {
|
|
|
204
220
|
## Tool Usage
|
|
205
221
|
- **Parallelism:** Execute multiple independent tool calls in parallel when feasible (i.e. searching the codebase).
|
|
206
222
|
- **Command Execution:** Use the '${SHELL_TOOL_NAME}' tool for running shell commands, remembering the safety rule to explain modifying commands first.
|
|
207
|
-
- **Background Processes:** Use background processes (via \`&\`) for commands that are unlikely to stop on their own, e.g. \`node server.js &\`. If unsure, ask the user.
|
|
208
223
|
${(function () {
|
|
209
|
-
if (
|
|
210
|
-
return `- **
|
|
224
|
+
if (interactiveMode) {
|
|
225
|
+
return `- **Background Processes:** Use background processes (via \`&\`) for commands that are unlikely to stop on their own, e.g. \`node server.js &\`. If unsure, ask the user.
|
|
226
|
+
- **Interactive Commands:** Prefer non-interactive commands when it makes sense; however, some commands are only interactive and expect user input during their execution (e.g. ssh, vim). If you choose to execute an interactive command consider letting the user know they can press \`ctrl + f\` to focus into the shell to provide input.`;
|
|
211
227
|
}
|
|
212
228
|
else {
|
|
213
|
-
return `- **
|
|
229
|
+
return `- **Background Processes:** Use background processes (via \`&\`) for commands that are unlikely to stop on their own, e.g. \`node server.js &\`.
|
|
230
|
+
- **Interactive Commands:** Only execute non-interactive commands.`;
|
|
214
231
|
}
|
|
215
232
|
})()}
|
|
216
|
-
- **Remembering Facts:** Use the '${MEMORY_TOOL_NAME}' tool to remember specific, *user-related* facts or preferences when the user explicitly asks, or when they state a clear, concise piece of information that would help personalize or streamline *your future interactions with them* (e.g., preferred coding style, common project paths they use, personal tool aliases). This tool is for user-specific information that should persist across sessions. Do *not* use it for general project context or information
|
|
233
|
+
- **Remembering Facts:** Use the '${MEMORY_TOOL_NAME}' tool to remember specific, *user-related* facts or preferences when the user explicitly asks, or when they state a clear, concise piece of information that would help personalize or streamline *your future interactions with them* (e.g., preferred coding style, common project paths they use, personal tool aliases). This tool is for user-specific information that should persist across sessions. Do *not* use it for general project context or information.${interactiveMode ? ` If unsure whether to save something, you can ask the user, "Should I remember that for you?"` : ''}
|
|
217
234
|
- **Respect User Confirmations:** Most tool calls (also denoted as 'function calls') will first require confirmation from the user, where they will either approve or cancel the function call. If a user cancels a function call, respect their choice and do _not_ try to make the function call again. It is okay to request the tool call again _only_ if the user requests that same tool call on a subsequent prompt. When a user cancels a function call, assume best intentions from the user and consider inquiring if they prefer any alternative paths forward.
|
|
218
235
|
|
|
219
236
|
## Interaction Details
|
|
@@ -256,8 +273,10 @@ ${(function () {
|
|
|
256
273
|
- \`git log -n 3\` to review recent commit messages and match their style (verbosity, formatting, signature line, etc.)
|
|
257
274
|
- Combine shell commands whenever possible to save time/steps, e.g. \`git status && git diff HEAD && git log -n 3\`.
|
|
258
275
|
- Always propose a draft commit message. Never just ask the user to give you the full commit message.
|
|
259
|
-
- Prefer commit messages that are clear, concise, and focused more on "why" and less on "what"
|
|
260
|
-
|
|
276
|
+
- Prefer commit messages that are clear, concise, and focused more on "why" and less on "what".${interactiveMode
|
|
277
|
+
? `
|
|
278
|
+
- Keep the user informed and ask for clarification or confirmation where needed.`
|
|
279
|
+
: ''}
|
|
261
280
|
- After each commit, confirm that it was successful by running \`git status\`.
|
|
262
281
|
- If a commit fails, never attempt to work around the issues without being asked to do so.
|
|
263
282
|
- Never push changes to a remote repository without being asked explicitly by the user.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/core/prompts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE/E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE9E,MAAM,UAAU,kBAAkB,CAAC,MAAe;IAKhD,wFAAwF;IACxF,MAAM,aAAa,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC;IACrC,IAAI,CAA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,CAAC,GAAG,CAAC,sBAAsB,CAAC,CACpC,CAAC;IAEF,yEAAyE;IACzE,wDAAwD;IACxD,IAAI,uBAAuB,CAAC,KAAK,IAAI,CAAC,uBAAuB,CAAC,UAAU,EAAE,CAAC;QACzE,MAAM,SAAS,GAAG,uBAAuB,CAAC,QAAQ;YAChD,CAAC,CAAC,YAAY;YACd,CAAC,CAAC,uBAAuB,CAAC,KAAK,CAAC;QAElC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3D,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,YAAY,GAChB,UAAU,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QACxC,CAAC,CAAC,cAAc,UAAU,CAAC,IAAI,EAAE,EAAE;QACnC,CAAC,CAAC,EAAE,CAAC;IAET,OAAO,GAAG,UAAU,GAAG,YAAY,EAAE,CAAC;AACxC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDR,CAAC,IAAI,EAAE,CAAC;AACT,CAAC"}
|
|
@@ -11,10 +11,19 @@ import { openBrowserSecurely } from '../utils/secure-browser-launcher.js';
|
|
|
11
11
|
import { debugLogger } from '../utils/debugLogger.js';
|
|
12
12
|
import { getErrorMessage } from '../utils/errors.js';
|
|
13
13
|
import { ModelNotFoundError } from '../utils/httpErrors.js';
|
|
14
|
-
import { TerminalQuotaError } from '../utils/googleQuotaErrors.js';
|
|
14
|
+
import { RetryableQuotaError, TerminalQuotaError, } from '../utils/googleQuotaErrors.js';
|
|
15
|
+
import { buildFallbackPolicyContext, resolvePolicyChain, resolvePolicyAction, } from '../availability/policyHelpers.js';
|
|
15
16
|
const UPGRADE_URL_PAGE = 'https://goo.gle/set-up-gemini-code-assist';
|
|
16
17
|
export async function handleFallback(config, failedModel, authType, error) {
|
|
17
|
-
|
|
18
|
+
if (config.isModelAvailabilityServiceEnabled()) {
|
|
19
|
+
return handlePolicyDrivenFallback(config, failedModel, authType, error);
|
|
20
|
+
}
|
|
21
|
+
return legacyHandleFallback(config, failedModel, authType, error);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Old fallback logic relying on hard coded strings
|
|
25
|
+
*/
|
|
26
|
+
async function legacyHandleFallback(config, failedModel, authType, error) {
|
|
18
27
|
if (authType !== AuthType.LOGIN_WITH_GOOGLE)
|
|
19
28
|
return null;
|
|
20
29
|
// Guardrail: If it's a ModelNotFoundError but NOT the preview model, do not handle it.
|
|
@@ -46,34 +55,58 @@ export async function handleFallback(config, failedModel, authType, error) {
|
|
|
46
55
|
// Pass the specific failed model to the UI handler.
|
|
47
56
|
const intent = await fallbackModelHandler(failedModel, fallbackModel, error);
|
|
48
57
|
// Process Intent and Update State
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
58
|
+
return await processIntent(config, intent, failedModel, fallbackModel, authType, error);
|
|
59
|
+
}
|
|
60
|
+
catch (handlerError) {
|
|
61
|
+
console.error('Fallback UI handler failed:', handlerError);
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* New fallback logic using the ModelAvailabilityService
|
|
67
|
+
*/
|
|
68
|
+
async function handlePolicyDrivenFallback(config, failedModel, authType, error) {
|
|
69
|
+
if (authType !== AuthType.LOGIN_WITH_GOOGLE) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
const chain = resolvePolicyChain(config);
|
|
73
|
+
const { failedPolicy, candidates } = buildFallbackPolicyContext(chain, failedModel);
|
|
74
|
+
if (!candidates.length) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
const availability = config.getModelAvailabilityService();
|
|
78
|
+
const selection = availability.selectFirstAvailable(candidates.map((policy) => policy.model));
|
|
79
|
+
const lastResortPolicy = candidates.find((policy) => policy.isLastResort);
|
|
80
|
+
const fallbackModel = selection.selectedModel ?? lastResortPolicy?.model;
|
|
81
|
+
const selectedPolicy = candidates.find((policy) => policy.model === fallbackModel);
|
|
82
|
+
if (!fallbackModel || fallbackModel === failedModel || !selectedPolicy) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
const failureKind = classifyFailureKind(error);
|
|
86
|
+
const action = resolvePolicyAction(failureKind, selectedPolicy);
|
|
87
|
+
if (action === 'silent') {
|
|
88
|
+
return processIntent(config, 'retry_always', failedModel, fallbackModel, authType, error);
|
|
89
|
+
}
|
|
90
|
+
// This will be used in the future when FallbackRecommendation is passed through UI
|
|
91
|
+
const recommendation = {
|
|
92
|
+
...selection,
|
|
93
|
+
selectedModel: fallbackModel,
|
|
94
|
+
action,
|
|
95
|
+
failureKind,
|
|
96
|
+
failedPolicy,
|
|
97
|
+
selectedPolicy,
|
|
98
|
+
};
|
|
99
|
+
void recommendation;
|
|
100
|
+
const handler = config.getFallbackModelHandler();
|
|
101
|
+
if (typeof handler !== 'function') {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
const intent = await handler(failedModel, fallbackModel, error);
|
|
106
|
+
return await processIntent(config, intent, failedModel, fallbackModel, authType);
|
|
74
107
|
}
|
|
75
108
|
catch (handlerError) {
|
|
76
|
-
debugLogger.error('Fallback
|
|
109
|
+
debugLogger.error('Fallback handler failed:', handlerError);
|
|
77
110
|
return null;
|
|
78
111
|
}
|
|
79
112
|
}
|
|
@@ -85,6 +118,33 @@ async function handleUpgrade() {
|
|
|
85
118
|
debugLogger.warn('Failed to open browser automatically:', getErrorMessage(error));
|
|
86
119
|
}
|
|
87
120
|
}
|
|
121
|
+
async function processIntent(config, intent, failedModel, fallbackModel, authType, error) {
|
|
122
|
+
switch (intent) {
|
|
123
|
+
case 'retry_always':
|
|
124
|
+
// If the error is non-retryable, e.g. TerminalQuota Error, trigger a regular fallback to flash.
|
|
125
|
+
// For all other errors, activate previewModel fallback.
|
|
126
|
+
if (failedModel === PREVIEW_GEMINI_MODEL &&
|
|
127
|
+
!(error instanceof TerminalQuotaError)) {
|
|
128
|
+
activatePreviewModelFallbackMode(config);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
activateFallbackMode(config, authType);
|
|
132
|
+
}
|
|
133
|
+
return true;
|
|
134
|
+
case 'retry_once':
|
|
135
|
+
return true;
|
|
136
|
+
case 'stop':
|
|
137
|
+
activateFallbackMode(config, authType);
|
|
138
|
+
return false;
|
|
139
|
+
case 'retry_later':
|
|
140
|
+
return false;
|
|
141
|
+
case 'upgrade':
|
|
142
|
+
await handleUpgrade();
|
|
143
|
+
return false;
|
|
144
|
+
default:
|
|
145
|
+
throw new Error(`Unexpected fallback intent received from fallbackModelHandler: "${intent}"`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
88
148
|
function activateFallbackMode(config, authType) {
|
|
89
149
|
if (!config.isInFallbackMode()) {
|
|
90
150
|
config.setFallbackMode(true);
|
|
@@ -100,4 +160,16 @@ function activatePreviewModelFallbackMode(config) {
|
|
|
100
160
|
// We might want a specific event for Preview Model fallback, but for now we just set the mode.
|
|
101
161
|
}
|
|
102
162
|
}
|
|
163
|
+
function classifyFailureKind(error) {
|
|
164
|
+
if (error instanceof TerminalQuotaError) {
|
|
165
|
+
return 'terminal';
|
|
166
|
+
}
|
|
167
|
+
if (error instanceof RetryableQuotaError) {
|
|
168
|
+
return 'transient';
|
|
169
|
+
}
|
|
170
|
+
if (error instanceof ModelNotFoundError) {
|
|
171
|
+
return 'not_found';
|
|
172
|
+
}
|
|
173
|
+
return 'unknown';
|
|
174
|
+
}
|
|
103
175
|
//# sourceMappingURL=handler.js.map
|