genaicode 0.8.1 → 0.8.3
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/README.md +0 -1
- package/dist/ai-service/ai-studio.d.ts.map +1 -0
- package/dist/ai-service/ai-studio.js +9 -9
- package/dist/ai-service/ai-studio.js.map +1 -1
- package/dist/ai-service/anthropic.d.ts.map +1 -0
- package/dist/ai-service/anthropic.js +171 -162
- package/dist/ai-service/anthropic.js.map +1 -1
- package/dist/ai-service/chat-gpt.d.ts.map +1 -0
- package/dist/ai-service/chat-gpt.js +16 -8
- package/dist/ai-service/chat-gpt.js.map +1 -1
- package/dist/ai-service/common.d.ts.map +1 -0
- package/dist/ai-service/dall-e.d.ts.map +1 -0
- package/dist/ai-service/service-configurations.d.ts +30 -0
- package/dist/ai-service/service-configurations.js +116 -0
- package/dist/ai-service/service-configurations.js.map +1 -0
- package/dist/ai-service/unescape-function-call.d.ts.map +1 -0
- package/dist/ai-service/vertex-ai-claude.d.ts.map +1 -0
- package/dist/ai-service/vertex-ai-claude.js +9 -10
- package/dist/ai-service/vertex-ai-claude.js.map +1 -1
- package/dist/ai-service/vertex-ai-imagen.d.ts.map +1 -0
- package/dist/ai-service/vertex-ai.d.ts.map +1 -0
- package/dist/ai-service/vertex-ai.js +161 -146
- package/dist/ai-service/vertex-ai.js.map +1 -1
- package/dist/cli/cli-options.d.ts.map +1 -0
- package/dist/cli/cli-options.js +0 -4
- package/dist/cli/cli-options.js.map +1 -1
- package/dist/cli/cli-params.d.ts +0 -1
- package/dist/cli/cli-params.d.ts.map +1 -0
- package/dist/cli/cli-params.js +0 -1
- package/dist/cli/cli-params.js.map +1 -1
- package/dist/cli/service-autodetect.d.ts.map +1 -0
- package/dist/cli/validate-cli-params.d.ts.map +1 -0
- package/dist/cli/validate-cli-params.js +0 -1
- package/dist/cli/validate-cli-params.js.map +1 -1
- package/dist/eval/data/current-prompt.d.ts +93 -0
- package/dist/eval/data/current-prompt.js +239 -29
- package/dist/eval/data/current-prompt.js.map +1 -1
- package/dist/eval/prompt-debug.test.js +20 -3
- package/dist/eval/prompt-debug.test.js.map +1 -1
- package/dist/files/cache-file.d.ts.map +1 -0
- package/dist/files/file-utils.d.ts.map +1 -0
- package/dist/files/find-files.d.ts.map +1 -0
- package/dist/files/path-utils.d.ts.map +1 -0
- package/dist/files/read-files.d.ts.map +1 -0
- package/dist/files/search-files.d.ts +53 -0
- package/dist/files/search-files.d.ts.map +1 -0
- package/dist/files/search-files.js +97 -0
- package/dist/files/search-files.js.map +1 -0
- package/dist/files/source-code-tree.d.ts.map +1 -0
- package/dist/files/temp-buffer.d.ts.map +1 -0
- package/dist/files/update-files.d.ts.map +1 -0
- package/dist/images/ensure-alpha.d.ts.map +1 -0
- package/dist/images/imgly-remove-background.d.ts.map +1 -0
- package/dist/images/resize-image.d.ts.map +1 -0
- package/dist/images/split-image.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/main/codegen-non-interactive.d.ts +2 -0
- package/dist/main/codegen-non-interactive.d.ts.map +1 -0
- package/dist/main/codegen-non-interactive.js +20 -0
- package/dist/main/codegen-non-interactive.js.map +1 -0
- package/dist/main/codegen-types.d.ts +5 -2
- package/dist/main/codegen-types.d.ts.map +1 -0
- package/dist/main/codegen-utils.d.ts.map +1 -0
- package/dist/main/codegen.d.ts +4 -2
- package/dist/main/codegen.d.ts.map +1 -0
- package/dist/main/codegen.js +6 -85
- package/dist/main/codegen.js.map +1 -1
- package/dist/main/codegen.test-utils.d.ts +0 -1
- package/dist/main/codegen.test-utils.d.ts.map +1 -0
- package/dist/main/codegen.test-utils.js +0 -1
- package/dist/main/codegen.test-utils.js.map +1 -1
- package/dist/main/common/content-bus-types.d.ts +4 -1
- package/dist/main/common/content-bus-types.d.ts.map +1 -0
- package/dist/main/common/content-bus-types.js +1 -0
- package/dist/main/common/content-bus-types.js.map +1 -1
- package/dist/main/common/content-bus.d.ts +3 -1
- package/dist/main/common/content-bus.d.ts.map +1 -0
- package/dist/main/common/content-bus.js +16 -2
- package/dist/main/common/content-bus.js.map +1 -1
- package/dist/main/common/cost-collector.d.ts.map +1 -0
- package/dist/main/common/user-actions.d.ts.map +1 -0
- package/dist/main/config-lib.d.ts.map +1 -0
- package/dist/main/config.d.ts.map +1 -0
- package/dist/main/interactive/codegen-interactive.d.ts.map +1 -0
- package/dist/main/interactive/codegen-worker.d.ts.map +1 -0
- package/dist/main/interactive/common.d.ts.map +1 -0
- package/dist/main/interactive/configure.d.ts.map +1 -0
- package/dist/main/interactive/configure.js +0 -2
- package/dist/main/interactive/configure.js.map +1 -1
- package/dist/main/interactive/error-handling.d.ts.map +1 -0
- package/dist/main/interactive/help.d.ts.map +1 -0
- package/dist/main/interactive/select-ai-service.d.ts.map +1 -0
- package/dist/main/interactive/task-file.d.ts.map +1 -0
- package/dist/main/interactive/text-prompt.d.ts.map +1 -0
- package/dist/main/interactive/user-action-handlers.d.ts.map +1 -0
- package/dist/main/interactive/user-interrupt.d.ts.map +1 -0
- package/dist/main/plugin-loader.d.ts +5 -1
- package/dist/main/plugin-loader.d.ts.map +1 -0
- package/dist/main/plugin-loader.js.map +1 -1
- package/dist/main/ui/backend/api-utils.d.ts.map +1 -0
- package/dist/main/ui/backend/api.d.ts.map +1 -0
- package/dist/main/ui/backend/api.js +114 -0
- package/dist/main/ui/backend/api.js.map +1 -1
- package/dist/main/ui/backend/server.d.ts.map +1 -0
- package/dist/main/ui/backend/service.d.ts +23 -0
- package/dist/main/ui/backend/service.d.ts.map +1 -0
- package/dist/main/ui/backend/service.js +81 -2
- package/dist/main/ui/backend/service.js.map +1 -1
- package/dist/main/ui/codegen-ui.d.ts.map +1 -0
- package/dist/main/ui/common/api-types.d.ts +96 -0
- package/dist/main/ui/common/api-types.d.ts.map +1 -0
- package/dist/main/ui/frontend/assets/index-jwSqt8cG.js +1337 -0
- package/dist/main/ui/frontend/index.html +1 -1
- package/dist/main/ui/user-action-handlers.d.ts.map +1 -0
- package/dist/operations/create-directory/create-directory-def.d.ts.map +1 -0
- package/dist/operations/create-directory/create-directory-executor.d.ts.map +1 -0
- package/dist/operations/create-file/create-file-def.d.ts.map +1 -0
- package/dist/operations/create-file/create-file-def.js +3 -1
- package/dist/operations/create-file/create-file-def.js.map +1 -1
- package/dist/operations/create-file/create-file-executor.d.ts.map +1 -0
- package/dist/operations/delete-file/delete-file-def.d.ts.map +1 -0
- package/dist/operations/delete-file/delete-file-executor.d.ts.map +1 -0
- package/dist/operations/download-file/download-file-def.d.ts.map +1 -0
- package/dist/operations/download-file/download-file-executor.d.ts.map +1 -0
- package/dist/operations/imgly-remove-background/imgly-remove-background-def.d.ts.map +1 -0
- package/dist/operations/imgly-remove-background/imgly-remove-background-executor.d.ts.map +1 -0
- package/dist/operations/move-file/move-file-def.d.ts.map +1 -0
- package/dist/operations/move-file/move-file-executor.d.ts.map +1 -0
- package/dist/operations/operations-index.d.ts.map +1 -0
- package/dist/operations/patch-file/patch-file-def.d.ts.map +1 -0
- package/dist/operations/patch-file/patch-file-executor.d.ts.map +1 -0
- package/dist/operations/resize-image/resize-image-def.d.ts.map +1 -0
- package/dist/operations/resize-image/resize-image-executor.d.ts.map +1 -0
- package/dist/operations/split-image/split-image-def.d.ts.map +1 -0
- package/dist/operations/split-image/split-image-executor.d.ts.map +1 -0
- package/dist/operations/update-file/update-file-def.d.ts.map +1 -0
- package/dist/operations/update-file/update-file-executor.d.ts.map +1 -0
- package/dist/project-profiles/detection.d.ts.map +1 -0
- package/dist/project-profiles/index.d.ts.map +1 -0
- package/dist/project-profiles/profiles/golang.d.ts.map +1 -0
- package/dist/project-profiles/profiles/java-maven.d.ts.map +1 -0
- package/dist/project-profiles/profiles/javascript-npm.d.ts.map +1 -0
- package/dist/project-profiles/profiles/javascript-react.d.ts.map +1 -0
- package/dist/project-profiles/profiles/python-django.d.ts.map +1 -0
- package/dist/project-profiles/types.d.ts.map +1 -0
- package/dist/prompt/ai-service-fallback.d.ts.map +1 -0
- package/dist/prompt/function-calling-validate.d.ts.map +1 -0
- package/dist/prompt/function-calling.d.ts.map +1 -0
- package/dist/prompt/function-calling.js +2 -1
- package/dist/prompt/function-calling.js.map +1 -1
- package/dist/prompt/function-defs/ask-question.d.ts +2 -1
- package/dist/prompt/function-defs/ask-question.d.ts.map +1 -0
- package/dist/prompt/function-defs/ask-question.js +50 -0
- package/dist/prompt/function-defs/ask-question.js.map +1 -1
- package/dist/prompt/function-defs/codegen-planning.d.ts.map +1 -0
- package/dist/prompt/function-defs/codegen-summary.d.ts.map +1 -0
- package/dist/prompt/function-defs/codegen-summary.js +6 -6
- package/dist/prompt/function-defs/codegen-summary.js.map +1 -1
- package/dist/prompt/function-defs/explanation.d.ts.map +1 -0
- package/dist/prompt/function-defs/generate-image.d.ts.map +1 -0
- package/dist/prompt/function-defs/get-image-assets.d.ts.map +1 -0
- package/dist/prompt/function-defs/get-source-code.d.ts.map +1 -0
- package/dist/prompt/function-defs/optimize-context.d.ts.map +1 -0
- package/dist/prompt/function-defs/optimize-context.js +14 -10
- package/dist/prompt/function-defs/optimize-context.js.map +1 -1
- package/dist/prompt/function-defs/read-history.d.ts.map +1 -0
- package/dist/prompt/function-defs/set-summaries.d.ts.map +1 -0
- package/dist/prompt/function-defs/update-history.d.ts.map +1 -0
- package/dist/prompt/limits.d.ts.map +1 -0
- package/dist/prompt/prompt-codegen.d.ts.map +1 -0
- package/dist/prompt/prompt-service.d.ts.map +1 -0
- package/dist/prompt/prompt-service.js +24 -9
- package/dist/prompt/prompt-service.js.map +1 -1
- package/dist/prompt/prompt-service.test-utils.d.ts.map +1 -0
- package/dist/prompt/static-prompts.d.ts +1 -1
- package/dist/prompt/static-prompts.d.ts.map +1 -0
- package/dist/prompt/static-prompts.js +1 -1
- package/dist/prompt/static-prompts.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.d.ts.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.d.ts.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.js +98 -22
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.d.ts.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.d.ts.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/default-action.d.ts.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-search-code.d.ts +5 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-search-code.d.ts.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-search-code.js +87 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-search-code.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message-with-image.d.ts.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.d.ts.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/lint.d.ts +6 -0
- package/dist/prompt/steps/step-ask-question/handlers/lint.d.ts.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/lint.js +83 -0
- package/dist/prompt/steps/step-ask-question/handlers/lint.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.d.ts.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.d.ts.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js +25 -9
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.d.ts.map +1 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts +30 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts.map +1 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question.d.ts.map +1 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question.js +9 -2
- package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -1
- package/dist/prompt/steps/step-codegen-planning.d.ts.map +1 -0
- package/dist/prompt/steps/step-codegen-planning.js +8 -2
- package/dist/prompt/steps/step-codegen-planning.js.map +1 -1
- package/dist/prompt/steps/step-codegen-summary.d.ts.map +1 -0
- package/dist/prompt/steps/step-codegen-summary.js.map +1 -1
- package/dist/prompt/steps/step-context-optimization.d.ts.map +1 -0
- package/dist/prompt/steps/step-context-optimization.js +2 -0
- package/dist/prompt/steps/step-context-optimization.js.map +1 -1
- package/dist/prompt/steps/step-ensure-context.d.ts +1 -1
- package/dist/prompt/steps/step-ensure-context.d.ts.map +1 -0
- package/dist/prompt/steps/step-ensure-context.js +29 -15
- package/dist/prompt/steps/step-ensure-context.js.map +1 -1
- package/dist/prompt/steps/step-ensure-context.test.js +94 -10
- package/dist/prompt/steps/step-ensure-context.test.js.map +1 -1
- package/dist/prompt/steps/step-generate-codegen-summary.d.ts +11 -0
- package/dist/prompt/steps/step-generate-codegen-summary.js +51 -0
- package/dist/prompt/steps/step-generate-codegen-summary.js.map +1 -0
- package/dist/prompt/steps/step-generate-image.d.ts.map +1 -0
- package/dist/prompt/steps/step-generate-summary.d.ts.map +1 -0
- package/dist/prompt/steps/step-history-update.d.ts.map +1 -0
- package/dist/prompt/steps/step-process-file-updates.d.ts +8 -0
- package/dist/prompt/steps/step-process-file-updates.js +71 -0
- package/dist/prompt/steps/step-process-file-updates.js.map +1 -0
- package/dist/prompt/steps/step-summarization.d.ts.map +1 -0
- package/dist/prompt/steps/step-validate-recover.d.ts.map +1 -0
- package/dist/prompt/steps/step-verify-patch.d.ts +2 -1
- package/dist/prompt/steps/step-verify-patch.d.ts.map +1 -0
- package/dist/prompt/steps/step-verify-patch.js +2 -2
- package/dist/prompt/steps/step-verify-patch.js.map +1 -1
- package/dist/prompt/steps/steps-types.d.ts.map +1 -0
- package/dist/prompt/steps/steps-utils.d.ts.map +1 -0
- package/dist/prompt/systemprompt.d.ts.map +1 -0
- package/dist/prompt/token-estimator.d.ts.map +1 -0
- package/dist/vite-genaicode/vite-genaicode-frontend.d.ts.map +1 -0
- package/dist/vite-genaicode/vite-genaicode-plugin.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/main/ui/frontend/assets/index-QOcNx5ac.js +0 -812
|
@@ -16,7 +16,7 @@ export const SOURCE_CODE_RESPONSE = 'Sure, here is the application source code,
|
|
|
16
16
|
/** Assistant's acknowledgment after receiving source code */
|
|
17
17
|
export const READY_TO_ASSIST = "Thank you, I'm ready to assist you with your request.";
|
|
18
18
|
/** Assistant's response when generating code */
|
|
19
|
-
export const CODEGEN_SUMMARY_PROMPT = 'Planning phase completed.
|
|
19
|
+
export const CODEGEN_SUMMARY_PROMPT = 'Planning phase completed. Would you like to proceed with the planned changes?';
|
|
20
20
|
/** Template for partial prompt when requesting changes for a specific file */
|
|
21
21
|
export const getPartialPromptTemplate = (path) => `Please now generate update for the \`${path}\` file using appropriate tools according to code generation summary.`;
|
|
22
22
|
//# sourceMappingURL=static-prompts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static-prompts.js","sourceRoot":"","sources":["../../src/prompt/static-prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,qCAAqC;AACrC,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AAEpD,mEAAmE;AACnE,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;aAKtB,CAAC;AAEd,4DAA4D;AAC5D,MAAM,CAAC,MAAM,oBAAoB,GAAG,2EAA2E,CAAC;AAEhH,6DAA6D;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,uDAAuD,CAAC;AAEvF,gDAAgD;AAChD,MAAM,CAAC,MAAM,sBAAsB,GAAG,
|
|
1
|
+
{"version":3,"file":"static-prompts.js","sourceRoot":"","sources":["../../src/prompt/static-prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,qCAAqC;AACrC,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AAEpD,mEAAmE;AACnE,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;aAKtB,CAAC;AAEd,4DAA4D;AAC5D,MAAM,CAAC,MAAM,oBAAoB,GAAG,2EAA2E,CAAC;AAEhH,6DAA6D;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,uDAAuD,CAAC;AAEvF,gDAAgD;AAChD,MAAM,CAAC,MAAM,sBAAsB,GAAG,+EAA+E,CAAC;AAEtH,8EAA8E;AAC9E,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,IAAY,EAAU,EAAE,CAC/D,wCAAwC,IAAI,uEAAuE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancel-code-generation.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/cancel-code-generation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAEjF,wBAAsB,0BAA0B,CAAC,EAAE,eAAe,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAW/G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-generation.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/code-generation.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGjF,wBAAsB,oBAAoB,CAAC,EACzC,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,MAAM,EACN,OAAO,GACR,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAoG5C"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { putAssistantMessage, putUserMessage } from '../../../../main/common/content-bus.js';
|
|
1
|
+
import { putAssistantMessage, putSystemMessage, putUserMessage } from '../../../../main/common/content-bus.js';
|
|
2
2
|
import { askUserForConfirmationWithAnswer } from '../../../../main/common/user-actions.js';
|
|
3
3
|
import { getFunctionDefs } from '../../../function-calling.js';
|
|
4
|
+
import { CODEGEN_SUMMARY_PROMPT } from '../../../static-prompts.js';
|
|
4
5
|
import { executeStepCodegenPlanning } from '../../step-codegen-planning.js';
|
|
5
|
-
import {
|
|
6
|
+
import { generateCodegenSummary } from '../../step-generate-codegen-summary.js';
|
|
7
|
+
import { processFileUpdates } from '../../step-process-file-updates.js';
|
|
6
8
|
import { StepResult } from '../../steps-types.js';
|
|
9
|
+
import { updateFiles } from '../../../../files/update-files.js';
|
|
7
10
|
export async function handleCodeGeneration({ generateContentFn, generateImageFn, waitIfPaused, prompt, options, }) {
|
|
8
11
|
const planningResult = await executeStepCodegenPlanning(generateContentFn, prompt, options);
|
|
9
12
|
if (planningResult === StepResult.BREAK) {
|
|
@@ -22,7 +25,7 @@ export async function handleCodeGeneration({ generateContentFn, generateImageFn,
|
|
|
22
25
|
{
|
|
23
26
|
assistant: {
|
|
24
27
|
type: 'assistant',
|
|
25
|
-
text:
|
|
28
|
+
text: CODEGEN_SUMMARY_PROMPT,
|
|
26
29
|
functionCalls: [],
|
|
27
30
|
},
|
|
28
31
|
user: {
|
|
@@ -33,26 +36,99 @@ export async function handleCodeGeneration({ generateContentFn, generateImageFn,
|
|
|
33
36
|
],
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
// Add user's planning confirmation answer to prompt history
|
|
40
|
+
const assistantItem = {
|
|
41
|
+
type: 'assistant',
|
|
42
|
+
text: CODEGEN_SUMMARY_PROMPT,
|
|
43
|
+
};
|
|
44
|
+
putAssistantMessage(assistantItem.text, undefined, undefined, undefined, assistantItem);
|
|
45
|
+
prompt.push(assistantItem);
|
|
46
|
+
const userItem = {
|
|
47
|
+
type: 'user',
|
|
48
|
+
text: planningConfirmation.answer || 'Accept planning and continue',
|
|
49
|
+
};
|
|
50
|
+
putUserMessage(userItem.text, undefined, undefined, undefined, userItem);
|
|
51
|
+
prompt.push(userItem);
|
|
52
|
+
try {
|
|
53
|
+
// First step: Generate and validate codegen summary
|
|
54
|
+
const { codegenSummaryRequest, baseResult } = await generateCodegenSummary(generateContentFn, prompt, getFunctionDefs(), options);
|
|
55
|
+
// Ask user to confirm the codegen summary
|
|
56
|
+
const codegenSummaryConfirmation = await askUserForConfirmationWithAnswer('Codegen summary is generated. Would you like to proceed with the code changes?', 'Accept codegen summary and continue', 'Reject codegen summary and return to conversation', true);
|
|
57
|
+
if (!codegenSummaryConfirmation.confirmed) {
|
|
58
|
+
// User rejected the codegen summary, return to conversation
|
|
59
|
+
return {
|
|
60
|
+
breakLoop: false,
|
|
61
|
+
items: [
|
|
62
|
+
{
|
|
63
|
+
assistant: {
|
|
64
|
+
type: 'assistant',
|
|
65
|
+
text: 'Codegen summary is generated. Would you like to proceed with the code changes?',
|
|
66
|
+
},
|
|
67
|
+
user: {
|
|
68
|
+
type: 'user',
|
|
69
|
+
text: codegenSummaryConfirmation.answer || 'Codegen summary rejected. Returning to conversation.',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
prompt.push({
|
|
76
|
+
type: 'assistant',
|
|
77
|
+
text: 'Codegen summary is generated. Would you like to proceed with the code changes?',
|
|
78
|
+
}, {
|
|
79
|
+
type: 'user',
|
|
80
|
+
text: codegenSummaryConfirmation.answer || 'Accept codegen summary and continue',
|
|
81
|
+
});
|
|
82
|
+
// Second step: Process file updates
|
|
83
|
+
const updateResults = await processFileUpdates(generateContentFn, prompt, getFunctionDefs(), options, codegenSummaryRequest, waitIfPaused, generateImageFn);
|
|
84
|
+
const functionCalls = [...baseResult, ...updateResults];
|
|
85
|
+
const confirmed = await askUserForConfirmationWithAnswer('Code changes are generated, now what?', 'Apply code changes', 'Continue conversation', true);
|
|
86
|
+
if (confirmed.confirmed) {
|
|
87
|
+
putSystemMessage('Applying code changes...');
|
|
88
|
+
if (options.dryRun) {
|
|
89
|
+
putSystemMessage('Dry run mode, not updating files');
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// Apply the code changes
|
|
93
|
+
await updateFiles(functionCalls.filter((call) => call.name !== 'explanation' && call.name !== 'getSourceCode'), options);
|
|
94
|
+
putSystemMessage('Code changes applied successfully');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
breakLoop: confirmed.confirmed ?? true,
|
|
99
|
+
stepResult: functionCalls,
|
|
100
|
+
items: [
|
|
101
|
+
{
|
|
102
|
+
assistant: {
|
|
103
|
+
type: 'assistant',
|
|
104
|
+
text: 'Code changes are generated, now what?',
|
|
105
|
+
},
|
|
106
|
+
user: {
|
|
107
|
+
type: 'user',
|
|
108
|
+
text: confirmed.answer || 'Apply code changes.',
|
|
109
|
+
},
|
|
49
110
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
111
|
+
],
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
putSystemMessage(`Error during code generation: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
116
|
+
return {
|
|
117
|
+
breakLoop: false,
|
|
118
|
+
items: [
|
|
119
|
+
{
|
|
120
|
+
assistant: {
|
|
121
|
+
type: 'assistant',
|
|
122
|
+
text: 'An error occurred during code generation. Would you like to try again or continue the conversation?',
|
|
123
|
+
functionCalls: [],
|
|
124
|
+
},
|
|
125
|
+
user: {
|
|
126
|
+
type: 'user',
|
|
127
|
+
text: 'Error occurred during code generation.',
|
|
128
|
+
},
|
|
53
129
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
130
|
+
],
|
|
131
|
+
};
|
|
132
|
+
}
|
|
57
133
|
}
|
|
58
134
|
//# sourceMappingURL=code-generation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-generation.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/code-generation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"code-generation.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/code-generation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC/G,OAAO,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,EACzC,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,MAAM,EACN,OAAO,GACY;IACnB,MAAM,cAAc,GAAG,MAAM,0BAA0B,CAAC,iBAAiB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5F,IAAI,cAAc,KAAK,UAAU,CAAC,KAAK,EAAE,CAAC;QACxC,OAAO;YACL,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;IAED,0CAA0C;IAC1C,MAAM,oBAAoB,GAAG,MAAM,gCAAgC,CACjE,+EAA+E,EAC/E,8BAA8B,EAC9B,4CAA4C,EAC5C,IAAI,CACL,CAAC;IAEF,IAAI,CAAC,oBAAoB,CAAC,S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AAS,CAAC,SAAS,IAAI,IAAI;YACtC,UAAU,EAAE,aAAa;YACzB,KAAK,EAAE;gBACL;oBACE,SAAS,EAAE;wBACT,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,uCAAuC;qBAC9C;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,SAAS,CAAC,MAAM,IAAI,qBAAqB;qBAChD;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gBAAgB,CAAC,iCAAiC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;QAC9G,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE;gBACL;oBACE,SAAS,EAAE;wBACT,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,qGAAqG;wBAC3G,aAAa,EAAE,EAAE;qBAClB;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,wCAAwC;qBAC/C;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm-code-generation.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/confirm-code-generation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAEjF,wBAAsB,2BAA2B,CAAC,EAChD,eAAe,EACf,OAAO,GACR,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAsC5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-optimization.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/context-optimization.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAA2B,MAAM,+BAA+B,CAAC;AAE1G,wBAAsB,yBAAyB,CAAC,EAC9C,eAAe,EACf,MAAM,EACN,OAAO,EACP,iBAAiB,GAClB,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAuC5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-action.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/default-action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAEjF,wBAAsB,mBAAmB,CAAC,EAAE,eAAe,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAaxG"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ActionHandlerProps, ActionResult } from '../step-ask-question-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Handler for the searchCode action
|
|
4
|
+
*/
|
|
5
|
+
export declare function handleSearchCode({ askQuestionCall, generateContentFn, prompt, options, }: ActionHandlerProps): Promise<ActionResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-search-code.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-search-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAmC,MAAM,+BAA+B,CAAC;AAUlH,wBAAsB,gBAAgB,CAAC,EACrC,eAAe,EACf,iBAAiB,EACjB,MAAM,EACN,OAAO,GACR,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAuE5C"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { searchSourceCode } from '../../../../files/search-files.js';
|
|
2
|
+
import { getFunctionDefs } from '../../../function-calling.js';
|
|
3
|
+
import { putSystemMessage } from '../../../../main/common/content-bus.js';
|
|
4
|
+
/**
|
|
5
|
+
* Handler for the searchCode action
|
|
6
|
+
*/
|
|
7
|
+
export async function handleSearchCode({ askQuestionCall, generateContentFn, prompt, options, }) {
|
|
8
|
+
try {
|
|
9
|
+
const searchCodeCall = await generateSearchCodeCall(generateContentFn, prompt, askQuestionCall, options, false);
|
|
10
|
+
// Extract search parameters from the call arguments
|
|
11
|
+
const args = searchCodeCall?.args;
|
|
12
|
+
if (!searchCodeCall || !args?.query) {
|
|
13
|
+
throw new Error('Missing search query in searchCode call');
|
|
14
|
+
}
|
|
15
|
+
// Set default values for optional parameters
|
|
16
|
+
const searchParams = {
|
|
17
|
+
searchInContent: true,
|
|
18
|
+
searchInFilenames: true,
|
|
19
|
+
caseSensitive: false,
|
|
20
|
+
maxResults: 50,
|
|
21
|
+
contextLines: 2,
|
|
22
|
+
...args,
|
|
23
|
+
};
|
|
24
|
+
putSystemMessage('Searching code', searchParams);
|
|
25
|
+
// Execute the search
|
|
26
|
+
const searchResults = searchSourceCode(searchParams);
|
|
27
|
+
putSystemMessage('Search completed', searchResults);
|
|
28
|
+
// Return results in ActionResult format
|
|
29
|
+
return {
|
|
30
|
+
breakLoop: false,
|
|
31
|
+
items: [
|
|
32
|
+
{
|
|
33
|
+
assistant: {
|
|
34
|
+
type: 'assistant',
|
|
35
|
+
text: askQuestionCall.args?.message ?? '',
|
|
36
|
+
functionCalls: [searchCodeCall],
|
|
37
|
+
},
|
|
38
|
+
user: {
|
|
39
|
+
type: 'user',
|
|
40
|
+
text: 'Search completed, lets continue the conversation.',
|
|
41
|
+
functionResponses: [
|
|
42
|
+
{
|
|
43
|
+
name: 'searchCode',
|
|
44
|
+
call_id: searchCodeCall.id,
|
|
45
|
+
content: JSON.stringify(searchResults),
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
// Handle errors and return appropriate message
|
|
55
|
+
const errorMessage = error instanceof Error ? error.message : 'An unknown error occurred during search';
|
|
56
|
+
return {
|
|
57
|
+
breakLoop: false,
|
|
58
|
+
items: [
|
|
59
|
+
{
|
|
60
|
+
assistant: {
|
|
61
|
+
type: 'assistant',
|
|
62
|
+
text: `Error performing search: ${errorMessage}\nPlease try again with valid search parameters.`,
|
|
63
|
+
},
|
|
64
|
+
user: {
|
|
65
|
+
type: 'user',
|
|
66
|
+
text: 'Let me try again with different search parameters.',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async function generateSearchCodeCall(generateContentFn, prompt, askQuestionCall, options, cheap) {
|
|
74
|
+
const [searchCodeCall] = await generateContentFn([
|
|
75
|
+
...prompt,
|
|
76
|
+
{
|
|
77
|
+
type: 'assistant',
|
|
78
|
+
text: askQuestionCall.args?.message ?? '',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: 'user',
|
|
82
|
+
text: 'Yes, you can search the code.',
|
|
83
|
+
},
|
|
84
|
+
], getFunctionDefs(), 'searchCode', 0.7, cheap, options);
|
|
85
|
+
return searchCodeCall;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=handle-search-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-search-code.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-search-code.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EACrC,eAAe,EACf,iBAAiB,EACjB,MAAM,EACN,OAAO,GACY;IACnB,IAAI,CAAC;QACH,MAAM,cAAc,GAAG,MAAM,sBAAsB,CAAC,iBAAiB,EAAE,MAAM,EAAE,eAAe,EAAE,O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CAAC;QAExG,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE;gBACL;oBACE,SAAS,EAAE;wBACT,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,4BAA4B,YAAY,kDAAkD;qBACjG;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,oDAAoD;qBAC3D;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,sBAAsB,CACnC,iBAA0C,EAC1C,MAAoB,EACpB,eAAgC,EAChC,OAAuB,EACvB,KAAc;IAEd,MAAM,CAAC,cAAc,CAAC,GAAG,MAAM,iBAAiB,CAC9C;QACE,GAAG,MAAM;QACT;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE;SAC1C;QACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,+BAA+B;SACtC;KACF,EACD,eAAe,EAAE,EACjB,YAAY,EACZ,GAAG,EACH,KAAK,EACL,OAAO,CACR,CAAC;IAEF,OAAO,cAA0D,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-send-message-with-image.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-send-message-with-image.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAA4B,MAAM,+BAA+B,CAAC;AAK3G,wBAAsB,0BAA0B,CAAC,EAC/C,eAAe,EACf,OAAO,EACP,iBAAiB,EACjB,MAAM,EACN,eAAe,GAChB,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CA6G5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-send-message.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-send-message.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAEjF,wBAAsB,iBAAiB,CAAC,EAAE,eAAe,EAAE,OAAO,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAiB/G"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ActionHandlerProps, ActionResult } from '../step-ask-question-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Handles the lint action by executing the lint command and processing its results.
|
|
4
|
+
* If the lint command fails, it will ask for user confirmation to continue with code generation.
|
|
5
|
+
*/
|
|
6
|
+
export declare function handleLint({ askQuestionCall }: ActionHandlerProps): Promise<ActionResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/lint.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAc,MAAM,+BAA+B,CAAC;AAQ7F,wBAAsB,UAAU,CAAC,EAAE,eAAe,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CA6E/F"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { exec } from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import { putSystemMessage } from '../../../../main/common/content-bus.js';
|
|
4
|
+
import { rcConfig } from '../../../../main/config.js';
|
|
5
|
+
const execPromise = promisify(exec);
|
|
6
|
+
/**
|
|
7
|
+
* Handles the lint action by executing the lint command and processing its results.
|
|
8
|
+
* If the lint command fails, it will ask for user confirmation to continue with code generation.
|
|
9
|
+
*/
|
|
10
|
+
export async function handleLint({ askQuestionCall }) {
|
|
11
|
+
if (!rcConfig.lintCommand) {
|
|
12
|
+
return {
|
|
13
|
+
breakLoop: false,
|
|
14
|
+
items: [
|
|
15
|
+
{
|
|
16
|
+
assistant: {
|
|
17
|
+
type: 'assistant',
|
|
18
|
+
text: askQuestionCall.args?.message ?? '',
|
|
19
|
+
},
|
|
20
|
+
user: {
|
|
21
|
+
type: 'user',
|
|
22
|
+
text: 'Lint command not configured. Skipping lint check.',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
let lintResult;
|
|
29
|
+
try {
|
|
30
|
+
putSystemMessage(`Executing lint command: ${rcConfig.lintCommand}`);
|
|
31
|
+
await execPromise(rcConfig.lintCommand, { cwd: rcConfig.rootDir });
|
|
32
|
+
lintResult = {
|
|
33
|
+
success: true,
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
breakLoop: false,
|
|
37
|
+
lintResult,
|
|
38
|
+
items: [
|
|
39
|
+
{
|
|
40
|
+
assistant: {
|
|
41
|
+
type: 'assistant',
|
|
42
|
+
text: askQuestionCall.args?.message ?? '',
|
|
43
|
+
},
|
|
44
|
+
user: {
|
|
45
|
+
type: 'user',
|
|
46
|
+
text: 'Lint command executed successfully, no issues found.',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
const { stdout, stderr } = error;
|
|
54
|
+
lintResult = {
|
|
55
|
+
success: false,
|
|
56
|
+
stdout,
|
|
57
|
+
stderr,
|
|
58
|
+
};
|
|
59
|
+
// User confirmed to continue despite lint errors
|
|
60
|
+
return {
|
|
61
|
+
breakLoop: false,
|
|
62
|
+
lintResult,
|
|
63
|
+
items: [
|
|
64
|
+
{
|
|
65
|
+
assistant: {
|
|
66
|
+
type: 'assistant',
|
|
67
|
+
text: askQuestionCall.args?.message ?? '',
|
|
68
|
+
functionCalls: [askQuestionCall],
|
|
69
|
+
},
|
|
70
|
+
user: {
|
|
71
|
+
type: 'user',
|
|
72
|
+
text: 'Lint command failed',
|
|
73
|
+
data: { stdout, stderr },
|
|
74
|
+
functionResponses: [
|
|
75
|
+
{ name: 'askQuestion', call_id: askQuestionCall.id, content: JSON.stringify({ stdout, stderr }) },
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=lint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/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;AAGtD,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAEpC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,EAAE,eAAe,EAAsB;IACtE,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC1B,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE;gBACL;oBACE,SAAS,EAAE;wBACT,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE;qBAC1C;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,mDAAmD;qBAC1D;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAED,IAAI,UAAsB,CAAC;IAE3B,IAAI,CAAC;QACH,gBAAgB,CAAC,2BAA2B,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;QACpE,MAAM,WAAW,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,GAAG,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;QAEnE,UAAU,GAAG;YACX,OAAO,EAAE,IAAI;SACd,CAAC;QAEF,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,UAAU;YACV,KAAK,EAAE;gBACL;oBACE,SAAS,EAAE;wBACT,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE;qBAC1C;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,sDAAsD;qBAC7D;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAA2C,CAAC;QAEvE,UAAU,GAAG;YACX,OAAO,EAAE,KAAK;YACd,MAAM;YACN,MAAM;SACP,CAAC;QAEF,iDAAiD;QACjD,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,UAAU;YACV,KAAK,EAAE;gBACL;oBACE,SAAS,EAAE;wBACT,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE;wBACzC,aAAa,EAAE,CAAC,eAAe,CAAC;qBACjC;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,qBAAqB;wBAC3B,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;wBACxB,iBAAiB,EAAE;4BACjB,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE;yBAClG;qBACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-files-from-context.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/remove-files-from-context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAA8B,MAAM,+BAA+B,CAAC;AAE7G,wBAAsB,4BAA4B,CAAC,EACjD,eAAe,EACf,iBAAiB,EACjB,MAAM,EACN,OAAO,GACR,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAyD5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-files-content.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/request-files-content.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,kBAAkB,EAClB,YAAY,EAKb,MAAM,+BAA+B,CAAC;AAsCvC,wBAAsB,yBAAyB,CAAC,EAC9C,eAAe,EACf,OAAO,EACP,MAAM,EACN,iBAAiB,GAClB,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CA4H5C"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getSourceFiles, refreshFiles } from '../../../../files/find-files.js';
|
|
2
2
|
import { getSourceCode } from '../../../../files/read-files.js';
|
|
3
3
|
import { getSourceCodeTree } from '../../../../files/source-code-tree.js';
|
|
4
|
+
import { putSystemMessage } from '../../../../main/common/content-bus.js';
|
|
4
5
|
import { getFunctionDefs } from '../../../function-calling.js';
|
|
5
6
|
/**
|
|
6
7
|
* Checks if a file's content is already provided in the conversation history
|
|
@@ -21,7 +22,10 @@ function isFileContentAlreadyProvided(filePath, prompt) {
|
|
|
21
22
|
const sourceCodeTree = JSON.parse(response.content);
|
|
22
23
|
const dirPath = filePath.substring(0, filePath.lastIndexOf('/'));
|
|
23
24
|
const fileName = filePath.substring(filePath.lastIndexOf('/') + 1);
|
|
24
|
-
return (sourceCodeTree[dirPath] &&
|
|
25
|
+
return (sourceCodeTree[dirPath] &&
|
|
26
|
+
sourceCodeTree[dirPath][fileName] &&
|
|
27
|
+
'content' in sourceCodeTree[dirPath][fileName] &&
|
|
28
|
+
sourceCodeTree[dirPath][fileName].content !== null);
|
|
25
29
|
}
|
|
26
30
|
catch (error) {
|
|
27
31
|
console.warn('Error parsing getSourceCode response:', error);
|
|
@@ -31,7 +35,7 @@ function isFileContentAlreadyProvided(filePath, prompt) {
|
|
|
31
35
|
});
|
|
32
36
|
}
|
|
33
37
|
export async function handleRequestFilesContent({ askQuestionCall, options, prompt, generateContentFn, }) {
|
|
34
|
-
let requestFilesContentCall = await generateRequestFilesContentCall(generateContentFn, prompt, askQuestionCall, options,
|
|
38
|
+
let requestFilesContentCall = await generateRequestFilesContentCall(generateContentFn, prompt, askQuestionCall, options, true);
|
|
35
39
|
if (!requestFilesContentCall) {
|
|
36
40
|
return {
|
|
37
41
|
breakLoop: true,
|
|
@@ -39,6 +43,7 @@ export async function handleRequestFilesContent({ askQuestionCall, options, prom
|
|
|
39
43
|
};
|
|
40
44
|
}
|
|
41
45
|
let requestedFiles = requestFilesContentCall.args?.filePaths ?? [];
|
|
46
|
+
putSystemMessage('Requesting files content', requestFilesContentCall.args);
|
|
42
47
|
// Check which files are already provided in the conversation history
|
|
43
48
|
const alreadyProvidedFiles = requestedFiles.filter((file) => isFileContentAlreadyProvided(file, prompt));
|
|
44
49
|
if (alreadyProvidedFiles.length === requestedFiles.length) {
|
|
@@ -51,6 +56,7 @@ export async function handleRequestFilesContent({ askQuestionCall, options, prom
|
|
|
51
56
|
const user = {
|
|
52
57
|
type: 'user',
|
|
53
58
|
text: 'The requested file contents are already provided in the conversation history.',
|
|
59
|
+
data: { requestedFiles },
|
|
54
60
|
functionResponses: [
|
|
55
61
|
{
|
|
56
62
|
name: 'requestFilesContent',
|
|
@@ -68,7 +74,9 @@ export async function handleRequestFilesContent({ askQuestionCall, options, prom
|
|
|
68
74
|
refreshFiles();
|
|
69
75
|
let { legitimateFiles, illegitimateFiles } = categorizeLegitimateFiles(requestedFiles);
|
|
70
76
|
if (illegitimateFiles.length > 0) {
|
|
71
|
-
requestFilesContentCall = await generateRequestFilesContentCall(generateContentFn, prompt, askQuestionCall, options,
|
|
77
|
+
requestFilesContentCall = await generateRequestFilesContentCall(generateContentFn, prompt, askQuestionCall, options,
|
|
78
|
+
// use non cheap mode, as maybe the cheap mode didn't provide correct files
|
|
79
|
+
false);
|
|
72
80
|
if (!requestFilesContentCall) {
|
|
73
81
|
return {
|
|
74
82
|
breakLoop: true,
|
|
@@ -92,16 +100,24 @@ export async function handleRequestFilesContent({ askQuestionCall, options, prom
|
|
|
92
100
|
const sourceCode = getSourceCodeTree(getSourceCode({ filterPaths: legitimateFiles, forceAll: true, ignoreImportantFiles: true }, options));
|
|
93
101
|
const user = {
|
|
94
102
|
type: 'user',
|
|
95
|
-
text:
|
|
96
|
-
? `Some files
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
103
|
+
text: (alreadyProvidedFiles.length > 0
|
|
104
|
+
? `Some files were already provided in the conversation history:
|
|
105
|
+
${alreadyProvidedFiles.map((path) => `- ${path}`).join('\n')}
|
|
106
|
+
|
|
107
|
+
Providing content for the remaining files:
|
|
108
|
+
${requestedFiles.map((path) => `- ${path}`).join('\n')}`
|
|
109
|
+
: `All requested file contents have been provided:
|
|
110
|
+
${legitimateFiles.map((path) => `- ${path}`).join('\n')}`) +
|
|
111
|
+
(illegitimateFiles.length > 0
|
|
112
|
+
? `\n\nSome files are not legitimate and their content cannot be provided:
|
|
113
|
+
${illegitimateFiles.map((path) => `- ${path}`).join('\n')}`
|
|
114
|
+
: ''),
|
|
115
|
+
data: { legitimateFiles, illegitimateFiles },
|
|
100
116
|
functionResponses: [
|
|
101
117
|
{
|
|
102
118
|
name: 'requestFilesContent',
|
|
103
119
|
call_id: requestFilesContentCall.id,
|
|
104
|
-
content: JSON.stringify({ filePaths:
|
|
120
|
+
content: JSON.stringify({ filePaths: legitimateFiles }),
|
|
105
121
|
},
|
|
106
122
|
{
|
|
107
123
|
name: 'getSourceCode',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-files-content.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/request-files-content.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAU/D;;;;;GAKG;AACH,SAAS,4BAA4B,CAAC,QAAgB,EAAE,MAAoB;IAC1E,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QAC1B,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACpD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC9C,IAAI,QAAQ,CAAC,IAAI,KAAK,eAAe,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;gBAC3D,OAAO,KAAK,CAAC;YACf,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;gBACpD,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;gBACjE,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;gBAEnE,OAAO,CACL,cAAc,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"request-files-content.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/request-files-content.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAA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AAO,cAAc,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-permissions.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/request-permissions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAoC,MAAM,+BAA+B,CAAC;AAEnH,wBAAsB,wBAAwB,CAAC,EAC7C,eAAe,EACf,OAAO,EACP,MAAM,EACN,iBAAiB,GAClB,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CA6D5C"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { FunctionCall, GenerateContentFunction, GenerateImageFunction, PromptItem, PromptItemImage } from '../../../ai-service/common.js';
|
|
2
2
|
import { CodegenOptions } from '../../../main/codegen-types.js';
|
|
3
3
|
import { PluginActionType } from '../../../main/codegen-types.js';
|
|
4
|
-
export type ActionType = 'codeGeneration' | 'sendMessage' | 'sendMessageWithImage' | 'requestPermissions' | 'requestFilesContent' | 'removeFilesFromContext' | 'confirmCodeGeneration' | 'cancelCodeGeneration' | 'contextOptimization' | PluginActionType;
|
|
4
|
+
export type ActionType = 'codeGeneration' | 'sendMessage' | 'sendMessageWithImage' | 'requestPermissions' | 'requestFilesContent' | 'removeFilesFromContext' | 'confirmCodeGeneration' | 'cancelCodeGeneration' | 'contextOptimization' | 'searchCode' | 'lint' | PluginActionType;
|
|
5
5
|
type AskQuestionArgs = {
|
|
6
6
|
actionType: ActionType;
|
|
7
7
|
message: string;
|
|
8
|
+
decisionMakingProcess?: string;
|
|
8
9
|
};
|
|
9
10
|
export type SendMessageWithImageArgs = {
|
|
10
11
|
prompt: string;
|
|
@@ -20,6 +21,32 @@ export type RemoveFilesFromContextArgs = {
|
|
|
20
21
|
export type ContextOptimizationArgs = {
|
|
21
22
|
filePaths: string[];
|
|
22
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Arguments for the searchCode action
|
|
26
|
+
*/
|
|
27
|
+
export type SearchCodeArgs = {
|
|
28
|
+
/** The search query string */
|
|
29
|
+
query: string;
|
|
30
|
+
/** Optional glob patterns to include files */
|
|
31
|
+
includePatterns?: string[];
|
|
32
|
+
/** Optional glob patterns to exclude files */
|
|
33
|
+
excludePatterns?: string[];
|
|
34
|
+
/** Whether to search in file contents (default: true) */
|
|
35
|
+
searchInContent?: boolean;
|
|
36
|
+
/** Whether to search in file names (default: true) */
|
|
37
|
+
searchInFilenames?: boolean;
|
|
38
|
+
/** Case sensitive search (default: false) */
|
|
39
|
+
caseSensitive?: boolean;
|
|
40
|
+
/** Maximum number of results to return */
|
|
41
|
+
maxResults?: number;
|
|
42
|
+
/** Number of context lines to include around content matches */
|
|
43
|
+
contextLines?: number;
|
|
44
|
+
};
|
|
45
|
+
export type LintResult = {
|
|
46
|
+
success: boolean;
|
|
47
|
+
stdout?: string;
|
|
48
|
+
stderr?: string;
|
|
49
|
+
};
|
|
23
50
|
export type AskQuestionCall = FunctionCall<AskQuestionArgs>;
|
|
24
51
|
export interface AssistantItem {
|
|
25
52
|
type: 'assistant';
|
|
@@ -31,6 +58,7 @@ export interface AssistantItem {
|
|
|
31
58
|
export interface UserItem {
|
|
32
59
|
type: 'user';
|
|
33
60
|
text: string;
|
|
61
|
+
data?: Record<string, unknown>;
|
|
34
62
|
functionResponses?: Array<{
|
|
35
63
|
name: string;
|
|
36
64
|
call_id: string | undefined;
|
|
@@ -47,6 +75,7 @@ export interface ActionResult {
|
|
|
47
75
|
assistant: AssistantItem;
|
|
48
76
|
user: UserItem;
|
|
49
77
|
}>;
|
|
78
|
+
lintResult?: LintResult;
|
|
50
79
|
}
|
|
51
80
|
export type ActionHandlerProps = {
|
|
52
81
|
askQuestionCall: AskQuestionCall;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-ask-question-types.d.ts","sourceRoot":"","sources":["../../../../src/prompt/steps/step-ask-question/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IACH,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,eAAe,EAAE,eAAe,CAAC;IACjC,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,OAAO,EAAE,cAAc,CAAC;IACxB,iBAAiB,EAAE,uBAAuB,CAAC;IAC3C,eAAe,EAAE,qBAAqB,CAAC;IACvC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-ask-question.d.ts","sourceRoot":"","sources":["../../../../src/prompt/steps/step-ask-question/step-ask-question.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,uBAAuB,EAEvB,UAAU,EACV,qBAAqB,EACrB,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAmBhE,wBAAsB,sBAAsB,CAC1C,iBAAiB,EAAE,uBAAuB,EAC1C,eAAe,EAAE,qBAAqB,EACtC,MAAM,EAAE,UAAU,EAAE,EACpB,YAAY,EAAE,WAAW,EAAE,EAC3B,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EACjC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,YAAY,EAAE,CAAC,CAmEzB"}
|