genaicode 0.9.5 → 0.10.0
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/ai-service/ai-studio.d.ts +1 -1
- package/dist/ai-service/ai-studio.js +114 -31
- package/dist/ai-service/ai-studio.js.map +1 -1
- package/dist/ai-service/anthropic.js +82 -32
- package/dist/ai-service/anthropic.js.map +1 -1
- package/dist/ai-service/common-types.d.ts +28 -7
- package/dist/ai-service/local-llm.d.ts +6 -0
- package/dist/ai-service/local-llm.js +77 -0
- package/dist/ai-service/local-llm.js.map +1 -0
- package/dist/ai-service/openai.d.ts +3 -13
- package/dist/ai-service/openai.js +107 -51
- package/dist/ai-service/openai.js.map +1 -1
- package/dist/ai-service/service-configurations-types.d.ts +14 -4
- package/dist/ai-service/service-configurations-types.js +0 -4
- package/dist/ai-service/service-configurations-types.js.map +1 -1
- package/dist/ai-service/service-configurations.d.ts +9 -1
- package/dist/ai-service/service-configurations.js +110 -14
- package/dist/ai-service/service-configurations.js.map +1 -1
- package/dist/ai-service/vertex-ai-claude.d.ts +1 -1
- package/dist/ai-service/vertex-ai-claude.js +80 -39
- package/dist/ai-service/vertex-ai-claude.js.map +1 -1
- package/dist/ai-service/vertex-ai.d.ts +1 -1
- package/dist/ai-service/vertex-ai.js +261 -155
- package/dist/ai-service/vertex-ai.js.map +1 -1
- package/dist/cli/cli-options.js +1 -1
- package/dist/cli/cli-options.js.map +1 -1
- package/dist/cli/validate-cli-params.js +1 -1
- package/dist/cli/validate-cli-params.js.map +1 -1
- package/dist/main/codegen-utils.js +9 -1
- package/dist/main/codegen-utils.js.map +1 -1
- package/dist/main/codegen.js +2 -0
- package/dist/main/codegen.js.map +1 -1
- package/dist/main/common/user-actions.d.ts +2 -0
- package/dist/main/common/user-actions.js.map +1 -1
- package/dist/main/config-schema.js +16 -0
- package/dist/main/config-schema.js.map +1 -1
- package/dist/main/config-types.d.ts +15 -0
- package/dist/main/config.js +1 -0
- package/dist/main/config.js.map +1 -1
- package/dist/main/interactive/select-ai-service.js +1 -0
- package/dist/main/interactive/select-ai-service.js.map +1 -1
- package/dist/main/plugin-loader.d.ts +1 -2
- package/dist/main/plugin-loader.js.map +1 -1
- package/dist/main/ui/backend/endpoints/question-endpoint.js +34 -3
- package/dist/main/ui/backend/endpoints/question-endpoint.js.map +1 -1
- package/dist/main/ui/backend/service.d.ts +6 -5
- package/dist/main/ui/backend/service.js +54 -17
- package/dist/main/ui/backend/service.js.map +1 -1
- package/dist/main/ui/common/api-types.d.ts +1 -0
- package/dist/main/ui/frontend/assets/index-BlVGo0E6.js +1902 -0
- package/dist/main/ui/frontend/index.html +2 -2
- package/dist/project-profiles/types.d.ts +1 -1
- package/dist/project-profiles/types.js +1 -1
- package/dist/project-profiles/types.js.map +1 -1
- package/dist/prompt/function-calling.js +6 -0
- package/dist/prompt/function-calling.js.map +1 -1
- package/dist/prompt/function-defs/ask-question.js +8 -4
- package/dist/prompt/function-defs/ask-question.js.map +1 -1
- package/dist/prompt/function-defs/conversation-summary.d.ts +2 -0
- package/dist/prompt/function-defs/conversation-summary.js +15 -0
- package/dist/prompt/function-defs/conversation-summary.js.map +1 -0
- package/dist/prompt/function-defs/explore-external-directories.d.ts +16 -0
- package/dist/prompt/function-defs/explore-external-directories.js +48 -0
- package/dist/prompt/function-defs/explore-external-directories.js.map +1 -0
- package/dist/prompt/function-defs/read-external-files.d.ts +9 -0
- package/dist/prompt/function-defs/read-external-files.js +30 -0
- package/dist/prompt/function-defs/read-external-files.js.map +1 -0
- package/dist/prompt/limits.js +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-code-generation.js +44 -41
- package/dist/prompt/steps/step-ask-question/handlers/handle-code-generation.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-confirm-code-generation.js +11 -11
- package/dist/prompt/steps/step-ask-question/handlers/handle-confirm-code-generation.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-context-optimization.js +13 -13
- package/dist/prompt/steps/step-ask-question/handlers/handle-context-optimization.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-conversation-graph.js +60 -28
- package/dist/prompt/steps/step-ask-question/handlers/handle-conversation-graph.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-create-file.js +88 -88
- package/dist/prompt/steps/step-ask-question/handlers/handle-create-file.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-end-conversation.d.ts +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-end-conversation.js +15 -17
- package/dist/prompt/steps/step-ask-question/handlers/handle-end-conversation.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-explore-external-directories.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-explore-external-directories.js +277 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-explore-external-directories.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-genaicode-help.js +13 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-genaicode-help.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-generate-image.js +13 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-generate-image.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-lint.d.ts +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-lint.js +54 -61
- package/dist/prompt/steps/step-ask-question/handlers/handle-lint.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-perform-analysis.js +22 -10
- package/dist/prompt/steps/step-ask-question/handlers/handle-perform-analysis.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-pull-app-context.js +13 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-pull-app-context.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-push-app-context.js +13 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-push-app-context.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-read-external-files.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-read-external-files.js +144 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-read-external-files.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-reasoning-inference.js +27 -6
- package/dist/prompt/steps/step-ask-question/handlers/handle-reasoning-inference.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-remove-files-from-context.js +13 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-remove-files-from-context.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-content.js +14 -5
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-content.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-fragments.js +26 -2
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-fragments.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-permissions.js +13 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-permissions.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-search-code.js +14 -2
- package/dist/prompt/steps/step-ask-question/handlers/handle-search-code.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.js +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-update-file.js +71 -75
- package/dist/prompt/steps/step-ask-question/handlers/handle-update-file.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts +5 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question.js +14 -7
- package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -1
- package/dist/prompt/steps/step-codegen-planning.js +14 -5
- package/dist/prompt/steps/step-codegen-planning.js.map +1 -1
- package/dist/prompt/steps/step-context-compression.js +14 -5
- package/dist/prompt/steps/step-context-compression.js.map +1 -1
- package/dist/prompt/steps/step-context-optimization.js +10 -5
- package/dist/prompt/steps/step-context-optimization.js.map +1 -1
- package/dist/prompt/steps/step-generate-codegen-summary.js +14 -5
- package/dist/prompt/steps/step-generate-codegen-summary.js.map +1 -1
- package/dist/prompt/steps/step-generate-summary.d.ts +6 -0
- package/dist/prompt/steps/step-generate-summary.js +36 -16
- package/dist/prompt/steps/step-generate-summary.js.map +1 -1
- package/dist/prompt/steps/step-history-update.js +14 -5
- package/dist/prompt/steps/step-history-update.js.map +1 -1
- package/dist/prompt/steps/step-process-file-updates.js +10 -5
- package/dist/prompt/steps/step-process-file-updates.js.map +1 -1
- package/dist/prompt/steps/step-summarization.js +14 -2
- package/dist/prompt/steps/step-summarization.js.map +1 -1
- package/dist/prompt/steps/step-validate-recover.d.ts +2 -4
- package/dist/prompt/steps/step-validate-recover.js +18 -9
- package/dist/prompt/steps/step-validate-recover.js.map +1 -1
- package/dist/prompt/steps/step-verify-patch.js +14 -5
- package/dist/prompt/steps/step-verify-patch.js.map +1 -1
- package/dist/prompt/systemprompt.js +5 -3
- package/dist/prompt/systemprompt.js.map +1 -1
- package/package.json +9 -9
- package/dist/main/ui/frontend/assets/index-Dizqxzws.js +0 -1814
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.d.ts +0 -4
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.js +0 -167
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.js.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.d.ts +0 -2
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js +0 -34
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.d.ts +0 -2
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js +0 -32
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/genaicode-help-document.d.ts +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/genaicode-help-document.js +0 -251
- package/dist/prompt/steps/step-ask-question/handlers/genaicode-help-document.js.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/lint.d.ts +0 -6
- package/dist/prompt/steps/step-ask-question/handlers/lint.js +0 -103
- package/dist/prompt/steps/step-ask-question/handlers/lint.js.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.d.ts +0 -2
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js +0 -82
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.d.ts +0 -8
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js +0 -179
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.d.ts +0 -2
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js +0 -69
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js.map +0 -1
- /package/dist/main/ui/frontend/assets/{index-S_ocA1xG.css → index-5QDg_0vR.css} +0 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { isAncestorDirectory } from '../../../../files/file-utils.js';
|
|
4
|
+
import { askUserForConfirmation } from '../../../../main/common/user-actions.js';
|
|
5
|
+
import { putSystemMessage } from '../../../../main/common/content-bus.js';
|
|
6
|
+
import { rcConfig } from '../../../../main/config.js';
|
|
7
|
+
import { registerActionHandler } from '../step-ask-question-handlers.js';
|
|
8
|
+
import { exploreExternalDirectories as exploreExternalDirectoriesDef, } from '../../../function-defs/explore-external-directories.js';
|
|
9
|
+
import { ModelType } from '../../../../ai-service/common-types.js';
|
|
10
|
+
import { getFunctionDefs } from '../../../function-calling.js';
|
|
11
|
+
// Threshold for triggering synthesis instead of listing all files
|
|
12
|
+
const SYNTHESIS_FILE_COUNT_THRESHOLD = 10;
|
|
13
|
+
registerActionHandler('exploreExternalDirectories', handleExploreExternalDirectories);
|
|
14
|
+
export async function handleExploreExternalDirectories({ askQuestionCall, options, prompt, generateContentFn, }) {
|
|
15
|
+
// 1. Infer arguments using LLM
|
|
16
|
+
const inferencePrompt = [
|
|
17
|
+
...prompt,
|
|
18
|
+
{
|
|
19
|
+
type: 'assistant',
|
|
20
|
+
text: askQuestionCall.args?.message ?? '',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
type: 'user',
|
|
24
|
+
text: 'Given the conversation, identify the directories, reason, and any exploration parameters (recursive, depth, searchPhrases, maxResults) for exploring external directories.',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
const inferenceResult = await generateContentFn(inferencePrompt, {
|
|
28
|
+
modelType: ModelType.CHEAP,
|
|
29
|
+
functionDefs: getFunctionDefs(),
|
|
30
|
+
requiredFunctionName: exploreExternalDirectoriesDef.name,
|
|
31
|
+
}, options);
|
|
32
|
+
const inferredCall = inferenceResult.find((part) => part.type === 'functionCall')?.functionCall;
|
|
33
|
+
if (!inferredCall || !inferredCall.args) {
|
|
34
|
+
putSystemMessage('Could not infer arguments for exploreExternalDirectories action from the assistant message and context.');
|
|
35
|
+
return { breakLoop: false, items: [] }; // Or respond with error
|
|
36
|
+
}
|
|
37
|
+
const inferredCallId = inferredCall.id;
|
|
38
|
+
// Ensure depth is handled correctly as it's now required
|
|
39
|
+
const { directories, reason: inferredReason, depth, ...restParams } = inferredCall.args;
|
|
40
|
+
const requestedDirectories = directories;
|
|
41
|
+
const reason = inferredReason;
|
|
42
|
+
const executorParams = { depth, ...restParams }; // Includes recursive, searchPhrases, maxResults if provided
|
|
43
|
+
if (!requestedDirectories || requestedDirectories.length === 0 || !reason || typeof depth !== 'number' || depth < 0) {
|
|
44
|
+
let errorMsg = 'Missing or invalid arguments after inferring for exploreExternalDirectories action.';
|
|
45
|
+
if (!requestedDirectories || requestedDirectories.length === 0)
|
|
46
|
+
errorMsg += ' Missing directories.';
|
|
47
|
+
if (!reason)
|
|
48
|
+
errorMsg += ' Missing reason.';
|
|
49
|
+
if (typeof depth !== 'number' || depth < 0)
|
|
50
|
+
errorMsg += ' Missing or invalid depth (must be >= 0).';
|
|
51
|
+
putSystemMessage(errorMsg);
|
|
52
|
+
// Respond with an error in the function response
|
|
53
|
+
prompt.push({
|
|
54
|
+
type: 'assistant',
|
|
55
|
+
text: askQuestionCall.args?.message ?? '',
|
|
56
|
+
functionCalls: inferredCall ? [inferredCall] : undefined, // Include the inferred call attempt
|
|
57
|
+
}, {
|
|
58
|
+
type: 'user',
|
|
59
|
+
functionResponses: [
|
|
60
|
+
{
|
|
61
|
+
name: exploreExternalDirectoriesDef.name,
|
|
62
|
+
call_id: inferredCallId,
|
|
63
|
+
content: JSON.stringify({
|
|
64
|
+
error: `Invalid arguments inferred: ${errorMsg}`,
|
|
65
|
+
}),
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
});
|
|
69
|
+
return { breakLoop: false, items: [] };
|
|
70
|
+
}
|
|
71
|
+
// 2. Validate directories are external
|
|
72
|
+
const externalDirsToExplore = [];
|
|
73
|
+
const internalDirsSkipped = [];
|
|
74
|
+
const invalidDirs = [];
|
|
75
|
+
for (const dir of requestedDirectories) {
|
|
76
|
+
try {
|
|
77
|
+
const absolutePath = path.resolve(dir);
|
|
78
|
+
// Basic check if it's inside the project root (and not ignored)
|
|
79
|
+
if (isAncestorDirectory(rcConfig.rootDir, absolutePath) &&
|
|
80
|
+
!rcConfig.ignorePaths?.some((ignorePath) => path.join(rcConfig.rootDir, ignorePath) === absolutePath ||
|
|
81
|
+
isAncestorDirectory(path.join(rcConfig.rootDir, ignorePath), absolutePath))) {
|
|
82
|
+
internalDirsSkipped.push(absolutePath);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// Further validation (existence, directory type) could happen here or in exploreDirectories
|
|
86
|
+
externalDirsToExplore.push(absolutePath);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
// path.resolve might throw if the path format is invalid on some OS
|
|
91
|
+
invalidDirs.push(`${dir} (invalid path format)`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Define userResponse structure
|
|
95
|
+
let userResponse = {};
|
|
96
|
+
// 3. Handle validation results and Ask for confirmation
|
|
97
|
+
if (invalidDirs.length > 0) {
|
|
98
|
+
userResponse = {
|
|
99
|
+
error: `Invalid or inaccessible directory paths provided: ${invalidDirs.join(', ')}`,
|
|
100
|
+
invalid: invalidDirs,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
else if (externalDirsToExplore.length === 0) {
|
|
104
|
+
userResponse.error = 'No valid external directories provided to explore.';
|
|
105
|
+
if (internalDirsSkipped.length > 0) {
|
|
106
|
+
userResponse.skipped = internalDirsSkipped;
|
|
107
|
+
userResponse.error += ` Skipped internal directories: ${internalDirsSkipped.join(', ')}`;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
// Ask for confirmation
|
|
112
|
+
const confirmationMessage = `The AI wants to explore the following external directorie(s):\n${externalDirsToExplore.join('\n')}\nDo you allow exploring these directories?`;
|
|
113
|
+
const confirmationResult = await askUserForConfirmation(confirmationMessage, false, options);
|
|
114
|
+
if (confirmationResult.confirmed) {
|
|
115
|
+
try {
|
|
116
|
+
const filePaths = await exploreDirectories({
|
|
117
|
+
directories: externalDirsToExplore,
|
|
118
|
+
// Pass validated executorParams
|
|
119
|
+
recursive: executorParams.recursive,
|
|
120
|
+
depth: executorParams.depth,
|
|
121
|
+
searchPhrases: executorParams.searchPhrases,
|
|
122
|
+
maxResults: executorParams.maxResults,
|
|
123
|
+
});
|
|
124
|
+
userResponse.confirmed = true;
|
|
125
|
+
if (internalDirsSkipped.length > 0) {
|
|
126
|
+
userResponse.skipped = internalDirsSkipped;
|
|
127
|
+
}
|
|
128
|
+
// ---- Synthesis Logic ----
|
|
129
|
+
if (filePaths.length > SYNTHESIS_FILE_COUNT_THRESHOLD) {
|
|
130
|
+
putSystemMessage(`Found ${filePaths.length} files. Synthesizing results...`);
|
|
131
|
+
userResponse.fileCount = filePaths.length;
|
|
132
|
+
const synthesisPrompt = [
|
|
133
|
+
{
|
|
134
|
+
type: 'user',
|
|
135
|
+
text: `You explored directories and found ${filePaths.length} files because: ${reason}.\nFiles:\n${filePaths.join('\\n')}\n\nBased on this reason, provide a concise and helpful output. Choose the most suitable format from summary, categorized list, or plain file list.`,
|
|
136
|
+
},
|
|
137
|
+
];
|
|
138
|
+
try {
|
|
139
|
+
const synthesisResult = await generateContentFn(synthesisPrompt, {
|
|
140
|
+
modelType: ModelType.CHEAP,
|
|
141
|
+
// Ensure we only expect text
|
|
142
|
+
expectedResponseType: { text: true, functionCall: false, media: false },
|
|
143
|
+
}, { ...options, askQuestion: false });
|
|
144
|
+
const synthesizedText = synthesisResult.find((part) => part.type === 'text')?.text;
|
|
145
|
+
if (synthesizedText) {
|
|
146
|
+
userResponse.synthesis = synthesizedText;
|
|
147
|
+
putSystemMessage(`Synthesis complete.`);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
putSystemMessage('Synthesis failed: No text content returned from LLM.');
|
|
151
|
+
userResponse.error = 'Exploration succeeded, but synthesis failed to generate content.';
|
|
152
|
+
// Fallback? Maybe include filePaths if synthesis fails?
|
|
153
|
+
// userResponse.filePaths = filePaths; // Or just report error
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch (synthError) {
|
|
157
|
+
const synthErrorMessage = synthError instanceof Error ? synthError.message : 'Unknown synthesis error.';
|
|
158
|
+
putSystemMessage(`Synthesis failed: ${synthErrorMessage}`);
|
|
159
|
+
userResponse.error = `Exploration succeeded, but synthesis failed: ${synthErrorMessage}`;
|
|
160
|
+
// userResponse.filePaths = filePaths; // Optional fallback
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
// No synthesis needed, include the paths directly
|
|
165
|
+
userResponse.filePaths = filePaths;
|
|
166
|
+
}
|
|
167
|
+
// ---- End Synthesis Logic ----
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error during execution.';
|
|
171
|
+
putSystemMessage(`Error exploring external directories: ${errorMessage}`);
|
|
172
|
+
userResponse = { ...userResponse, confirmed: true, error: `Exploration failed: ${errorMessage}` }; // Keep skipped/invalid if already set
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
userResponse = {
|
|
177
|
+
...userResponse,
|
|
178
|
+
confirmed: false,
|
|
179
|
+
error: 'User denied permission to explore external directories.',
|
|
180
|
+
}; // Keep skipped/invalid
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// 4. Update conversation history
|
|
184
|
+
prompt.push({
|
|
185
|
+
type: 'assistant',
|
|
186
|
+
text: askQuestionCall.args?.message ?? '',
|
|
187
|
+
functionCalls: inferredCall ? [inferredCall] : undefined, // Use the inferred call
|
|
188
|
+
}, {
|
|
189
|
+
type: 'user',
|
|
190
|
+
functionResponses: [
|
|
191
|
+
{
|
|
192
|
+
name: exploreExternalDirectoriesDef.name,
|
|
193
|
+
call_id: inferredCallId, // Use the ID from the inferred call
|
|
194
|
+
content: JSON.stringify({
|
|
195
|
+
// Include original request details for context, even if modified by synthesis
|
|
196
|
+
requestedDirectories,
|
|
197
|
+
reason,
|
|
198
|
+
...executorParams,
|
|
199
|
+
// Add the results (potentially synthesized)
|
|
200
|
+
...userResponse,
|
|
201
|
+
}),
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
});
|
|
205
|
+
return {
|
|
206
|
+
breakLoop: false,
|
|
207
|
+
items: [], // No immediate items to add, handled by history push
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
// Keep exploreDirectories function as is, ensuring it respects maxResults
|
|
211
|
+
async function exploreDirectories(args) {
|
|
212
|
+
const { directories, recursive = false, depth, searchPhrases, maxResults = 50 } = args;
|
|
213
|
+
const foundFiles = [];
|
|
214
|
+
// Depth is now required, maxDepth calculation is simpler
|
|
215
|
+
const maxDepth = depth;
|
|
216
|
+
const lowerCaseSearchPhrases = searchPhrases?.map((p) => p.toLowerCase());
|
|
217
|
+
async function traverse(dirPath, currentDepth) {
|
|
218
|
+
// Stop if max depth exceeded OR max results reached
|
|
219
|
+
if (currentDepth > maxDepth || foundFiles.length >= maxResults) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
let entries;
|
|
223
|
+
try {
|
|
224
|
+
// Check access first to provide better error for invalidDirs later?
|
|
225
|
+
await fs.access(dirPath, fs.constants.R_OK);
|
|
226
|
+
entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
// Log or handle specific errors like permission denied
|
|
230
|
+
// console.warn(`Could not read directory ${dirPath}: ${error}`);
|
|
231
|
+
// Consider throwing if it's the initial directory?
|
|
232
|
+
return; // Silently ignore inaccessible subdirectories
|
|
233
|
+
}
|
|
234
|
+
for (const entry of entries) {
|
|
235
|
+
if (foundFiles.length >= maxResults) {
|
|
236
|
+
break; // Stop processing entries in this directory if max results hit
|
|
237
|
+
}
|
|
238
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
239
|
+
if (entry.isDirectory()) {
|
|
240
|
+
foundFiles.push(fullPath);
|
|
241
|
+
// Only recurse if currentDepth < maxDepth
|
|
242
|
+
if (recursive && currentDepth < maxDepth) {
|
|
243
|
+
await traverse(fullPath, currentDepth + 1);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else if (entry.isFile()) {
|
|
247
|
+
if (lowerCaseSearchPhrases && lowerCaseSearchPhrases.length > 0) {
|
|
248
|
+
try {
|
|
249
|
+
// Consider limiting file size read?
|
|
250
|
+
const content = await fs.readFile(fullPath, 'utf-8');
|
|
251
|
+
const lowerCaseContent = content.toLowerCase();
|
|
252
|
+
if (lowerCaseSearchPhrases.every((phrase) => lowerCaseContent.includes(phrase))) {
|
|
253
|
+
foundFiles.push(fullPath);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
catch (readError) {
|
|
257
|
+
// Ignore file read errors?
|
|
258
|
+
// console.warn(`Could not read file ${fullPath}: ${readError}`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
// No search phrases, just add the file
|
|
263
|
+
foundFiles.push(fullPath);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
// Ignore other entry types (symlinks, etc.)
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
for (const startDir of directories) {
|
|
270
|
+
if (foundFiles.length < maxResults) {
|
|
271
|
+
// Start traversal at depth 0
|
|
272
|
+
await traverse(startDir, 0);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return foundFiles;
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=handle-explore-external-directories.js.map
|
package/dist/prompt/steps/step-ask-question/handlers/handle-explore-external-directories.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-explore-external-directories.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-explore-external-directories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAEL,0BAA0B,IAAI,6BAA6B,GAC5D,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,SAAS,EAAmD,MAAM,wCAAwC,CAAC;A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AC7C,CAAC;YACH,CAAC;iBAAM,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;gBAC1B,IAAI,sBAAsB,IAAI,sBAAsB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAChE,IAAI,CAAC;wBACH,oCAAoC;wBACpC,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;wBACrD,MAAM,gBAAgB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;wBAC/C,IAAI,sBAAsB,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;4BAChF,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;wBAC5B,CAAC;oBACH,CAAC;oBAAC,OAAO,SAAS,EAAE,CAAC;wBACnB,2BAA2B;wBAC3B,iEAAiE;oBACnE,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,uCAAuC;oBACvC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;YACD,4CAA4C;QAC9C,CAAC;IACH,CAAC;IAED,KAAK,MAAM,QAAQ,IAAI,WAAW,EAAE,CAAC;QACnC,IAAI,UAAU,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;YACnC,6BAA6B;YAC7B,MAAM,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -87,7 +87,19 @@ async function getGenaicodeHelpCall(generateContentFn, prompt) {
|
|
|
87
87
|
`,
|
|
88
88
|
},
|
|
89
89
|
...prompt,
|
|
90
|
-
],
|
|
90
|
+
], {
|
|
91
|
+
functionDefs: getFunctionDefs(),
|
|
92
|
+
requiredFunctionName: 'genaicodeHelp',
|
|
93
|
+
temperature: 0.7,
|
|
94
|
+
modelType: ModelType.CHEAP,
|
|
95
|
+
expectedResponseType: {
|
|
96
|
+
text: false,
|
|
97
|
+
functionCall: true,
|
|
98
|
+
media: false,
|
|
99
|
+
},
|
|
100
|
+
}, {}))
|
|
101
|
+
.filter((item) => item.type === 'functionCall')
|
|
102
|
+
.map((item) => item.functionCall);
|
|
91
103
|
return [genaicodeHelpCall];
|
|
92
104
|
}
|
|
93
105
|
//# sourceMappingURL=handle-genaicode-help.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-genaicode-help.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-genaicode-help.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAC3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,qBAAqB,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EACxC,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,OAAO,GACY;IACnB,IAAI,CAAC;QACH,mBAAmB;QACnB,MAAM,CAAC,iBAAiB,CAAC,GAAG,MAAM,oBAAoB,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;QAElF,IAAI,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC;YAC7B,OAAO;gBACL,SAAS,EAAE,KAAK;gBAChB,KAAK,EAAE;oBACL;wBACE,SAAS,EAAE;4BACT,IAAI,EAAE,WAAW;4BACjB,IAAI,EAAE,eAAe,CAAC,IAAI,EAA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AAK,UAAU,oBAAoB,CAAC,iBAA0D,EAAE,MAAoB;IAClH,MAAM,CAAC,iBAAiB,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"handle-genaicode-help.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-genaicode-help.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAC3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,qBAAqB,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EACxC,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,OAAO,GACY;IACnB,IAAI,CAAC;QACH,mBAAmB;QACnB,MAAM,CAAC,iBAAiB,CAAC,GAAG,MAAM,oBAAoB,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;QAElF,IAAI,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC;YAC7B,OAAO;gBACL,SAAS,EAAE,KAAK;gBAChB,KAAK,EAAE;oBACL;wBACE,SAAS,EAAE;4BACT,IAAI,EAAE,WAAW;4BACjB,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,qBAAqB;yBAC7D;wBACD,IAAI,EAAE;4BACJ,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,2CAA2C;yBAClD;qBACF;iBACF;aACF,CAAC;QACJ,CAAC;QAED,mBAAmB,CAAC,iBAAiB,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,EAAE,iBAAiB,CAAC,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BAAuB;;CAE9B;SACQ;QACD,GAAG,MAAM;KACV,EACD;QACE,YAAY,EAAE,eAAe,EAAE;QAC/B,oBAAoB,EAAE,eAAe;QACrC,WAAW,EAAE,GAAG;QAChB,SAAS,EAAE,SAAS,CAAC,KAAK;QAC1B,oBAAoB,EAAE;YACpB,IAAI,EAAE,KAAK;YACX,YAAY,EAAE,IAAI;YAClB,KAAK,EAAE,KAAK;SACb;KACF,EACD,EAAE,CACH,CACF;SACE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC;SAC9C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAkD,CAAC;IAErF,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -24,7 +24,19 @@ export async function handleGenerateImage({ askQuestionCall, options, generateCo
|
|
|
24
24
|
type: 'user',
|
|
25
25
|
text: 'Yes, you can generate an image.',
|
|
26
26
|
},
|
|
27
|
-
],
|
|
27
|
+
], {
|
|
28
|
+
functionDefs: getFunctionDefs(),
|
|
29
|
+
requiredFunctionName: 'generateImage',
|
|
30
|
+
temperature: 0.7,
|
|
31
|
+
modelType: ModelType.CHEAP,
|
|
32
|
+
expectedResponseType: {
|
|
33
|
+
text: false,
|
|
34
|
+
functionCall: true,
|
|
35
|
+
media: false,
|
|
36
|
+
},
|
|
37
|
+
}, options))
|
|
38
|
+
.filter((item) => item.type === 'functionCall')
|
|
39
|
+
.map((item) => item.functionCall);
|
|
28
40
|
if (!generateImageCall?.args) {
|
|
29
41
|
return {
|
|
30
42
|
breakLoop: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-generate-image.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-generate-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE/F,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,qBAAqB,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC;AAE5D,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EACxC,eAAe,EACf,OAAO,EACP,iBAAiB,EACjB,MAAM,EACN,eAAe,GACI;IACnB,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACpB,gBAAgB,CAAC,6EAA6E,CAAC,CAAC;QAChG,OAAO;YACL,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,iBAAiB,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"handle-generate-image.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-generate-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE/F,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,qBAAqB,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC;AAE5D,MA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;IAEjE,+CAA+C;IAC/C,MAAM,aAAa,GAAG,MAAM,eAAe,CAAC,aAAa,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IAEzG,iFAAiF;IACjF,OAAO;QACL,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE;YACL;gBACE,SAAS,EAAE;oBACT,IAAI,EAAE,WAAW;oBACjB,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE;oBACzC,aAAa,EAAE,CAAC,iBAAiB,CAAC;iBACnC;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,aAAa,CAAC,MAAM;oBAC1B,MAAM,EAAE,CAAC,SAAS,CAAC;oBACnB,iBAAiB,EAAE,CAAC,EAAE,IAAI,EAAE,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,iBAAiB,CAAC,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;iBACzG;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -3,4 +3,4 @@ import { ActionHandlerProps, ActionResult } from '../step-ask-question-types.js'
|
|
|
3
3
|
* Handles the lint action by executing the lint command and processing its results.
|
|
4
4
|
* If the lint command fails, it will ask for user confirmation to continue with code generation.
|
|
5
5
|
*/
|
|
6
|
-
export declare function handleLint({ askQuestionCall }: ActionHandlerProps): Promise<ActionResult>;
|
|
6
|
+
export declare function handleLint({ askQuestionCall, prompt }: ActionHandlerProps): Promise<ActionResult>;
|
|
@@ -9,96 +9,89 @@ registerActionHandler('lint', handleLint);
|
|
|
9
9
|
* Handles the lint action by executing the lint command and processing its results.
|
|
10
10
|
* If the lint command fails, it will ask for user confirmation to continue with code generation.
|
|
11
11
|
*/
|
|
12
|
-
export async function handleLint({ askQuestionCall }) {
|
|
12
|
+
export async function handleLint({ askQuestionCall, prompt }) {
|
|
13
13
|
if (!rcConfig.lintCommand) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
putSystemMessage('Lint command not configured. Skipping lint check.');
|
|
15
|
+
prompt.push({
|
|
16
|
+
type: 'assistant',
|
|
17
|
+
text: askQuestionCall.args?.message ?? '',
|
|
18
|
+
functionCalls: [{ name: 'lint', id: askQuestionCall.id + '_lint' }],
|
|
19
|
+
}, {
|
|
20
|
+
type: 'user',
|
|
21
|
+
text: 'Lint command not configured. Skipping lint check.',
|
|
22
|
+
functionResponses: [
|
|
17
23
|
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
functionCalls: [{ name: 'lint', id: askQuestionCall.id + '_lint' }],
|
|
22
|
-
},
|
|
23
|
-
user: {
|
|
24
|
-
type: 'user',
|
|
25
|
-
text: 'Lint command not configured. Skipping lint check.',
|
|
26
|
-
functionResponses: [
|
|
27
|
-
{
|
|
28
|
-
name: 'lint',
|
|
29
|
-
call_id: askQuestionCall.id + '_lint',
|
|
30
|
-
content: JSON.stringify({ error: 'Lint command not configured' }),
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
},
|
|
24
|
+
name: 'lint',
|
|
25
|
+
call_id: askQuestionCall.id + '_lint',
|
|
26
|
+
content: JSON.stringify({ error: 'Lint command not configured' }),
|
|
34
27
|
},
|
|
35
28
|
],
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
breakLoop: false,
|
|
32
|
+
items: [],
|
|
36
33
|
};
|
|
37
34
|
}
|
|
38
35
|
let lintResult;
|
|
39
36
|
try {
|
|
40
37
|
putSystemMessage(`Executing lint command: ${rcConfig.lintCommand}`);
|
|
41
38
|
await execPromise(rcConfig.lintCommand, { cwd: rcConfig.rootDir });
|
|
39
|
+
putSystemMessage('Lint command executed successfully, no issues found.');
|
|
42
40
|
lintResult = {
|
|
43
41
|
success: true,
|
|
44
42
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
prompt.push({
|
|
44
|
+
type: 'assistant',
|
|
45
|
+
text: askQuestionCall.args?.message ?? '',
|
|
46
|
+
functionCalls: [{ name: 'lint', id: askQuestionCall.id + '_lint' }],
|
|
47
|
+
}, {
|
|
48
|
+
type: 'user',
|
|
49
|
+
text: 'Lint command executed successfully, no issues found.',
|
|
50
|
+
functionResponses: [
|
|
49
51
|
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
functionCalls: [{ name: 'lint', id: askQuestionCall.id + '_lint' }],
|
|
54
|
-
},
|
|
55
|
-
user: {
|
|
56
|
-
type: 'user',
|
|
57
|
-
text: 'Lint command executed successfully, no issues found.',
|
|
58
|
-
functionResponses: [
|
|
59
|
-
{
|
|
60
|
-
name: 'lint',
|
|
61
|
-
call_id: askQuestionCall.id + '_lint',
|
|
62
|
-
content: JSON.stringify(lintResult),
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
},
|
|
52
|
+
name: 'lint',
|
|
53
|
+
call_id: askQuestionCall.id + '_lint',
|
|
54
|
+
content: JSON.stringify(lintResult),
|
|
66
55
|
},
|
|
67
56
|
],
|
|
57
|
+
});
|
|
58
|
+
return {
|
|
59
|
+
breakLoop: false,
|
|
60
|
+
lintResult,
|
|
61
|
+
items: [],
|
|
68
62
|
};
|
|
69
63
|
}
|
|
70
64
|
catch (error) {
|
|
71
65
|
const { stdout, stderr } = error;
|
|
66
|
+
putSystemMessage('Lint command failed.', {
|
|
67
|
+
stdout,
|
|
68
|
+
stderr,
|
|
69
|
+
});
|
|
72
70
|
lintResult = {
|
|
73
71
|
success: false,
|
|
74
72
|
stdout,
|
|
75
73
|
stderr,
|
|
76
74
|
};
|
|
77
75
|
// User confirmed to continue despite lint errors
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
prompt.push({
|
|
77
|
+
type: 'assistant',
|
|
78
|
+
text: askQuestionCall.args?.message ?? '',
|
|
79
|
+
functionCalls: [{ name: 'lint', id: askQuestionCall.id + '_lint' }],
|
|
80
|
+
}, {
|
|
81
|
+
type: 'user',
|
|
82
|
+
text: 'Lint command failed, please analyze the output.',
|
|
83
|
+
functionResponses: [
|
|
82
84
|
{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
functionCalls: [{ name: 'lint', id: askQuestionCall.id + '_lint' }],
|
|
87
|
-
},
|
|
88
|
-
user: {
|
|
89
|
-
type: 'user',
|
|
90
|
-
text: 'Lint command failed, please analyze the output.',
|
|
91
|
-
data: { stdout, stderr },
|
|
92
|
-
functionResponses: [
|
|
93
|
-
{
|
|
94
|
-
name: 'lint',
|
|
95
|
-
call_id: askQuestionCall.id + '_lint',
|
|
96
|
-
content: JSON.stringify(lintResult),
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
},
|
|
85
|
+
name: 'lint',
|
|
86
|
+
call_id: askQuestionCall.id + '_lint',
|
|
87
|
+
content: JSON.stringify(lintResult),
|
|
100
88
|
},
|
|
101
89
|
],
|
|
90
|
+
});
|
|
91
|
+
return {
|
|
92
|
+
breakLoop: false,
|
|
93
|
+
lintResult,
|
|
94
|
+
items: [],
|
|
102
95
|
};
|
|
103
96
|
}
|
|
104
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-lint.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-lint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAEpC,qBAAqB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,EAAE,eAAe,EAAsB;
|
|
1
|
+
{"version":3,"file":"handle-lint.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-lint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAEpC,qBAAqB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,EAAE,eAAe,EAAE,MAAM,EAAsB;IAC9E,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC1B,gBAAgB,CAAC,mDAAmD,CAAC,CAAC;QAEtE,MAAM,CAAC,IAAI,CACT;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE;YACzC,aAAa,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,eAAe,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;SACpE,EACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,mDAAmD;YACzD,iBAAiB,EAAE;gBACjB;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE,eAAe,CAAC,EAAE,GAAG,OAAO;oBACrC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,6BAA6B,EAAE,CAAC;iBAClE;aACF;SACF,CACF,CAAC;QAEF,OAAO;YACL,SAAS,EAAE,KAA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AAE,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE;YACzC,aAAa,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,eAAe,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;SACpE,EACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,iDAAiD;YACvD,iBAAiB,EAAE;gBACjB;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE,eAAe,CAAC,EAAE,GAAG,OAAO;oBACrC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC;iBACpC;aACF;SACF,CACF,CAAC;QAEF,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,UAAU;YACV,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -71,14 +71,20 @@ export async function handlePerformAnalysis({ askQuestionCall, prompt, options,
|
|
|
71
71
|
async function getPerformAnalysisCall(generateContentFn, prompt, functionDefs, options) {
|
|
72
72
|
const performAnalysisRequest = [
|
|
73
73
|
prompt,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
{
|
|
75
|
+
functionDefs,
|
|
76
|
+
requiredFunctionName: 'performAnalysis',
|
|
77
|
+
modelType: ModelType.CHEAP,
|
|
78
|
+
temperature: 0.7,
|
|
79
|
+
expectedResponseType: { text: false, functionCall: true, media: false },
|
|
80
|
+
},
|
|
78
81
|
options,
|
|
79
82
|
];
|
|
80
83
|
const performAnalysisResult = await generateContentFn(...performAnalysisRequest);
|
|
81
|
-
return performAnalysisResult
|
|
84
|
+
return performAnalysisResult
|
|
85
|
+
.filter((item) => item.type === 'functionCall')
|
|
86
|
+
.map((item) => item.functionCall)
|
|
87
|
+
.find((call) => call.name === 'performAnalysis');
|
|
82
88
|
}
|
|
83
89
|
/**
|
|
84
90
|
* Executes the analysis with the enhanced context
|
|
@@ -86,13 +92,19 @@ async function getPerformAnalysisCall(generateContentFn, prompt, functionDefs, o
|
|
|
86
92
|
async function executeAnalysis(generateContentFn, prompt, functionDefs, options) {
|
|
87
93
|
const analysisRequest = [
|
|
88
94
|
prompt,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
{
|
|
96
|
+
functionDefs,
|
|
97
|
+
requiredFunctionName: 'analysisResult',
|
|
98
|
+
modelType: ModelType.DEFAULT,
|
|
99
|
+
temperature: 0.7,
|
|
100
|
+
expectedResponseType: { text: false, functionCall: true, media: false },
|
|
101
|
+
},
|
|
93
102
|
options,
|
|
94
103
|
];
|
|
95
104
|
const analysisResult = await generateContentFn(...analysisRequest);
|
|
96
|
-
return analysisResult
|
|
105
|
+
return analysisResult
|
|
106
|
+
.filter((item) => item.type === 'functionCall')
|
|
107
|
+
.map((item) => item.functionCall)
|
|
108
|
+
.find((call) => call.name === 'analysisResult');
|
|
97
109
|
}
|
|
98
110
|
//# sourceMappingURL=handle-perform-analysis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-perform-analysis.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-perform-analysis.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handle-perform-analysis.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-perform-analysis.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AAOnE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,qBAAqB,CAAC,iBAAiB,EAAE,qBAAqB,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C;SAChC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,gBAAgB,CAAmC,CAAC;AACtF,CAAC"}
|
|
@@ -13,7 +13,19 @@ registerActionHandler('pullAppContext', handlePullAppContext);
|
|
|
13
13
|
*/
|
|
14
14
|
export async function handlePullAppContext({ generateContentFn, prompt, options, }) {
|
|
15
15
|
putSystemMessage('Retrieving context...');
|
|
16
|
-
const [pullAppContextCall] = (await generateContentFn(prompt,
|
|
16
|
+
const [pullAppContextCall] = (await generateContentFn(prompt, {
|
|
17
|
+
functionDefs: getFunctionDefs(),
|
|
18
|
+
requiredFunctionName: 'pullAppContext',
|
|
19
|
+
temperature: 0.7,
|
|
20
|
+
modelType: ModelType.CHEAP,
|
|
21
|
+
expectedResponseType: {
|
|
22
|
+
text: false,
|
|
23
|
+
functionCall: true,
|
|
24
|
+
media: false,
|
|
25
|
+
},
|
|
26
|
+
}, options))
|
|
27
|
+
.filter((item) => item.type === 'functionCall')
|
|
28
|
+
.map((item) => item.functionCall);
|
|
17
29
|
if (!pullAppContextCall?.args) {
|
|
18
30
|
putSystemMessage('Failed to get valid pullAppContext request');
|
|
19
31
|
return { breakLoop: false, items: [] };
|