genaicode 0.8.6 → 0.9.1
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 +2 -3
- package/dist/ai-service/ai-studio.js +55 -27
- package/dist/ai-service/ai-studio.js.map +1 -1
- package/dist/ai-service/anthropic.d.ts +2 -3
- package/dist/ai-service/anthropic.js +24 -8
- package/dist/ai-service/anthropic.js.map +1 -1
- package/dist/{src/ai-service/common.d.ts → ai-service/common-types.d.ts} +24 -26
- package/dist/ai-service/common-types.js +10 -0
- package/dist/ai-service/common-types.js.map +1 -0
- package/dist/ai-service/common.d.ts +3 -55
- package/dist/ai-service/common.js +16 -4
- package/dist/ai-service/common.js.map +1 -1
- package/dist/ai-service/dall-e.d.ts +2 -9
- package/dist/ai-service/dall-e.js +4 -11
- package/dist/ai-service/dall-e.js.map +1 -1
- package/dist/ai-service/openai.d.ts +15 -4
- package/dist/ai-service/openai.js +45 -20
- package/dist/ai-service/openai.js.map +1 -1
- package/dist/ai-service/service-configurations-types.d.ts +55 -0
- package/dist/ai-service/service-configurations-types.js +6 -0
- package/dist/ai-service/service-configurations-types.js.map +1 -0
- package/dist/ai-service/service-configurations.d.ts +3 -2
- package/dist/ai-service/service-configurations.js +5 -0
- package/dist/ai-service/service-configurations.js.map +1 -1
- package/dist/ai-service/unescape-function-call.d.ts +1 -1
- package/dist/ai-service/vertex-ai-claude.d.ts +2 -2
- package/dist/ai-service/vertex-ai-claude.js +22 -8
- package/dist/ai-service/vertex-ai-claude.js.map +1 -1
- package/dist/ai-service/vertex-ai-imagen.d.ts +2 -9
- package/dist/ai-service/vertex-ai-imagen.js +4 -11
- package/dist/ai-service/vertex-ai-imagen.js.map +1 -1
- package/dist/ai-service/vertex-ai.d.ts +2 -3
- package/dist/ai-service/vertex-ai.js +17 -12
- package/dist/ai-service/vertex-ai.js.map +1 -1
- package/dist/cli/cli-params.d.ts +1 -1
- package/dist/cli/cli-params.js +22 -1
- package/dist/cli/cli-params.js.map +1 -1
- package/dist/cli/validate-cli-params.js +19 -11
- package/dist/cli/validate-cli-params.js.map +1 -1
- package/dist/files/read-files.d.ts +1 -28
- package/dist/files/read-files.js +9 -3
- package/dist/files/read-files.js.map +1 -1
- package/dist/files/source-code-tree.d.ts +5 -6
- package/dist/files/source-code-tree.js +3 -32
- package/dist/files/source-code-tree.js.map +1 -1
- package/dist/files/source-code-types.d.ts +31 -0
- package/dist/files/source-code-types.js +2 -0
- package/dist/files/source-code-types.js.map +1 -0
- package/dist/files/source-code-utils.d.ts +22 -0
- package/dist/files/source-code-utils.js +69 -0
- package/dist/files/source-code-utils.js.map +1 -0
- package/dist/files/summary-cache.d.ts +20 -0
- package/dist/files/summary-cache.js +15 -0
- package/dist/files/summary-cache.js.map +1 -0
- package/dist/files/update-files.d.ts +1 -1
- package/dist/help-docs/genaicode-help-document.d.ts +1 -0
- package/dist/help-docs/genaicode-help-document.js +286 -0
- package/dist/help-docs/genaicode-help-document.js.map +1 -0
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/main/codegen-types.d.ts +12 -10
- package/dist/main/codegen-utils.d.ts +1 -1
- package/dist/main/codegen.d.ts +4 -3
- package/dist/main/codegen.js.map +1 -1
- package/dist/main/codegen.test-utils.d.ts +1 -1
- package/dist/main/common/abort-controller.d.ts +2 -0
- package/dist/main/common/abort-controller.js +5 -0
- package/dist/main/common/abort-controller.js.map +1 -0
- package/dist/main/common/app-context-bus.d.ts +11 -0
- package/dist/main/common/app-context-bus.js +29 -0
- package/dist/main/common/app-context-bus.js.map +1 -0
- package/dist/main/common/content-bus-types.d.ts +1 -1
- package/dist/main/common/content-bus.d.ts +1 -1
- package/dist/main/common/cost-collector.d.ts +3 -2
- package/dist/main/common/cost-collector.js +3 -3
- package/dist/main/common/cost-collector.js.map +1 -1
- package/dist/main/common/user-actions.d.ts +3 -3
- package/dist/main/common/user-actions.js +19 -10
- package/dist/main/common/user-actions.js.map +1 -1
- package/dist/main/config-schema.js +10 -0
- package/dist/main/config-schema.js.map +1 -1
- package/dist/main/config-types.d.ts +22 -16
- package/dist/main/interactive/codegen-worker.d.ts +0 -1
- package/dist/main/interactive/codegen-worker.js +4 -3
- package/dist/main/interactive/codegen-worker.js.map +1 -1
- package/dist/main/interactive/select-ai-service.d.ts +1 -1
- package/dist/main/plugin-loader.d.ts +5 -3
- package/dist/main/plugin-loader.js.map +1 -1
- package/dist/main/ui/backend/endpoints/context-endpoint.js +67 -0
- package/dist/main/ui/backend/endpoints/context-endpoint.js.map +1 -0
- package/dist/main/ui/backend/endpoints/generate-content-endpoint.js +6 -4
- package/dist/main/ui/backend/endpoints/generate-content-endpoint.js.map +1 -1
- package/dist/main/ui/backend/endpoints/index.d.ts +1 -0
- package/dist/main/ui/backend/endpoints/index.js +1 -0
- package/dist/main/ui/backend/endpoints/index.js.map +1 -1
- package/dist/main/ui/backend/server.d.ts +2 -1
- package/dist/main/ui/backend/server.js +2 -1
- package/dist/main/ui/backend/server.js.map +1 -1
- package/dist/main/ui/backend/service.d.ts +29 -4
- package/dist/main/ui/backend/service.js +50 -10
- package/dist/main/ui/backend/service.js.map +1 -1
- package/dist/main/ui/codegen-ui.d.ts +5 -1
- package/dist/main/ui/codegen-ui.js +10 -1
- package/dist/main/ui/codegen-ui.js.map +1 -1
- package/dist/main/ui/common/api-types.d.ts +4 -51
- package/dist/main/ui/frontend/assets/favicon-DvroFOpS.png +0 -0
- package/dist/main/ui/frontend/assets/index-D8KFdZaU.js +1775 -0
- package/dist/main/ui/frontend/assets/wolf-bark-Bl17CX4O.mp3 +0 -0
- package/dist/main/ui/frontend/index.html +2 -2
- package/dist/operations/create-directory/create-directory-def.d.ts +1 -1
- package/dist/operations/create-file/create-file-def.d.ts +1 -1
- package/dist/operations/create-file/create-file-def.js +2 -1
- package/dist/operations/create-file/create-file-def.js.map +1 -1
- package/dist/operations/delete-file/delete-file-def.d.ts +1 -1
- package/dist/operations/download-file/download-file-def.d.ts +1 -1
- package/dist/operations/imgly-remove-background/imgly-remove-background-def.d.ts +1 -1
- package/dist/operations/move-file/move-file-def.d.ts +1 -1
- package/dist/operations/patch-file/patch-file-def.d.ts +1 -1
- package/dist/operations/patch-file/patch-file-def.js +2 -1
- package/dist/operations/patch-file/patch-file-def.js.map +1 -1
- package/dist/operations/resize-image/resize-image-def.d.ts +1 -1
- package/dist/operations/split-image/split-image-def.d.ts +1 -1
- package/dist/operations/update-file/update-file-def.d.ts +1 -1
- package/dist/operations/update-file/update-file-def.js +2 -1
- package/dist/operations/update-file/update-file-def.js.map +1 -1
- package/dist/prompt/ai-service-fallback.d.ts +4 -3
- package/dist/prompt/ai-service-fallback.js +10 -58
- package/dist/prompt/ai-service-fallback.js.map +1 -1
- package/dist/prompt/function-calling-validate.d.ts +2 -2
- package/dist/prompt/function-calling-validate.js +5 -5
- package/dist/prompt/function-calling-validate.js.map +1 -1
- package/dist/prompt/function-calling.d.ts +1 -1
- package/dist/prompt/function-calling.js +12 -2
- package/dist/prompt/function-calling.js.map +1 -1
- package/dist/prompt/function-defs/analysis-result.d.ts +7 -0
- package/dist/prompt/function-defs/analysis-result.js +24 -0
- package/dist/prompt/function-defs/analysis-result.js.map +1 -0
- package/dist/prompt/function-defs/ask-question.d.ts +3 -2
- package/dist/prompt/function-defs/ask-question.js +93 -81
- package/dist/prompt/function-defs/ask-question.js.map +1 -1
- package/dist/prompt/function-defs/codegen-planning.d.ts +1 -1
- package/dist/prompt/function-defs/codegen-planning.js +11 -1
- package/dist/prompt/function-defs/codegen-planning.js.map +1 -1
- package/dist/prompt/function-defs/codegen-summary.d.ts +1 -1
- package/dist/prompt/function-defs/codegen-summary.js +19 -10
- package/dist/prompt/function-defs/codegen-summary.js.map +1 -1
- package/dist/prompt/function-defs/explanation.d.ts +1 -1
- package/dist/prompt/function-defs/genaicode-help.d.ts +6 -0
- package/dist/prompt/function-defs/genaicode-help.js +23 -0
- package/dist/prompt/function-defs/genaicode-help.js.map +1 -0
- package/dist/prompt/function-defs/generate-image.d.ts +1 -1
- package/dist/prompt/function-defs/get-image-assets.d.ts +1 -1
- package/dist/prompt/function-defs/get-source-code.d.ts +1 -1
- package/dist/prompt/function-defs/get-source-code.js +8 -11
- package/dist/prompt/function-defs/get-source-code.js.map +1 -1
- package/dist/prompt/function-defs/optimize-context.d.ts +1 -1
- package/dist/prompt/function-defs/optimize-context.js +1 -1
- package/dist/prompt/function-defs/optimize-context.js.map +1 -1
- package/dist/prompt/function-defs/perform-analysis.d.ts +8 -0
- package/dist/prompt/function-defs/perform-analysis.js +28 -0
- package/dist/prompt/function-defs/perform-analysis.js.map +1 -0
- package/dist/prompt/function-defs/read-history.d.ts +1 -1
- package/dist/prompt/function-defs/reasoning-inference.d.ts +3 -0
- package/dist/prompt/function-defs/reasoning-inference.js +39 -0
- package/dist/prompt/function-defs/reasoning-inference.js.map +1 -0
- package/dist/prompt/function-defs/set-summaries.d.ts +1 -1
- package/dist/prompt/function-defs/set-summaries.js +10 -6
- package/dist/prompt/function-defs/set-summaries.js.map +1 -1
- package/dist/prompt/function-defs/update-history.d.ts +1 -1
- package/dist/prompt/limits.js +1 -1
- package/dist/prompt/prompt-service.d.ts +5 -2
- package/dist/prompt/prompt-service.js +3 -5
- package/dist/prompt/prompt-service.js.map +1 -1
- package/dist/prompt/prompt-service.test-utils.d.ts +2 -2
- package/dist/prompt/prompt-service.test-utils.js +2 -1
- package/dist/prompt/prompt-service.test-utils.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.js +11 -9
- 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.js +1 -5
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js +1 -5
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/genaicode-help-document.d.ts +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/genaicode-help-document.js +251 -0
- package/dist/prompt/steps/step-ask-question/handlers/genaicode-help-document.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-create-file.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-create-file.js +157 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-create-file.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-end-conversation.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-end-conversation.js +30 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-end-conversation.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-genaicode-help.d.ts +8 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-genaicode-help.js +91 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-genaicode-help.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-generate-image.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/{handle-send-message-with-image.js → handle-generate-image.js} +28 -29
- package/dist/prompt/steps/step-ask-question/handlers/handle-generate-image.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-perform-analysis.d.ts +6 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-perform-analysis.js +99 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-perform-analysis.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-pull-app-context.d.ts +9 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-pull-app-context.js +90 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-pull-app-context.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-push-app-context.d.ts +9 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-push-app-context.js +91 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-push-app-context.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-reasoning-inference.d.ts +7 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-reasoning-inference.js +97 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-reasoning-inference.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-search-code.js +4 -4
- 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 -4
- 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 +92 -61
- package/dist/prompt/steps/step-ask-question/handlers/handle-update-file.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js +17 -20
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.d.ts +7 -1
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js +52 -47
- 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.js +3 -2
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts +75 -6
- package/dist/prompt/steps/step-ask-question/step-ask-question.d.ts +5 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question.js +30 -13
- package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -1
- package/dist/prompt/steps/step-codegen-planning.d.ts +2 -1
- package/dist/prompt/steps/step-codegen-planning.js +2 -1
- package/dist/prompt/steps/step-codegen-planning.js.map +1 -1
- package/dist/prompt/steps/step-context-optimization.d.ts +2 -1
- package/dist/prompt/steps/step-context-optimization.js +13 -13
- 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.js +4 -2
- package/dist/prompt/steps/step-ensure-context.js.map +1 -1
- package/dist/prompt/steps/step-generate-codegen-summary-prompt.d.ts +2 -0
- package/dist/prompt/steps/step-generate-codegen-summary-prompt.js +133 -0
- package/dist/prompt/steps/step-generate-codegen-summary-prompt.js.map +1 -0
- package/dist/prompt/steps/step-generate-codegen-summary.d.ts +6 -3
- package/dist/prompt/steps/step-generate-codegen-summary.js +17 -2
- package/dist/prompt/steps/step-generate-codegen-summary.js.map +1 -1
- package/dist/prompt/steps/step-generate-image.d.ts +2 -1
- package/dist/prompt/steps/step-generate-image.js +4 -2
- package/dist/prompt/steps/step-generate-image.js.map +1 -1
- package/dist/prompt/steps/step-generate-summary.d.ts +2 -1
- package/dist/prompt/steps/step-generate-summary.js +3 -2
- package/dist/prompt/steps/step-generate-summary.js.map +1 -1
- package/dist/prompt/steps/step-history-update.d.ts +2 -1
- package/dist/prompt/steps/step-history-update.js +9 -1
- package/dist/prompt/steps/step-history-update.js.map +1 -1
- package/dist/prompt/steps/step-process-file-updates.d.ts +7 -3
- package/dist/prompt/steps/step-process-file-updates.js +10 -7
- package/dist/prompt/steps/step-process-file-updates.js.map +1 -1
- package/dist/prompt/steps/step-summarization.d.ts +7 -6
- package/dist/prompt/steps/step-summarization.js +79 -48
- package/dist/prompt/steps/step-summarization.js.map +1 -1
- package/dist/prompt/steps/step-validate-recover.d.ts +4 -2
- package/dist/prompt/steps/step-validate-recover.js +8 -6
- package/dist/prompt/steps/step-validate-recover.js.map +1 -1
- package/dist/prompt/steps/step-verify-patch.d.ts +4 -1
- package/dist/prompt/steps/step-verify-patch.js +15 -2
- package/dist/prompt/steps/step-verify-patch.js.map +1 -1
- package/dist/prompt/steps/steps-types.d.ts +0 -14
- package/dist/prompt/steps/steps-types.js.map +1 -1
- package/dist/prompt/steps/steps-utils.d.ts +1 -1
- package/dist/prompt/systemprompt.d.ts +1 -1
- package/dist/prompt/systemprompt.js +40 -11
- package/dist/prompt/systemprompt.js.map +1 -1
- package/dist/{eval → prompt-debug}/current-prompt-plugin.d.ts +1 -1
- package/dist/{eval → prompt-debug}/current-prompt-plugin.js +1 -1
- package/dist/prompt-debug/current-prompt-plugin.js.map +1 -0
- package/dist/vite-genaicode/vite-genaicode-context.d.ts +31 -0
- package/dist/vite-genaicode/vite-genaicode-context.js +120 -0
- package/dist/vite-genaicode/vite-genaicode-context.js.map +1 -0
- package/dist/vite-genaicode/vite-genaicode-frontend.js +206 -30
- package/dist/vite-genaicode/vite-genaicode-frontend.js.map +1 -1
- package/dist/vite-genaicode/vite-genaicode-plugin.d.ts +1 -0
- package/dist/vite-genaicode/vite-genaicode-plugin.js +22 -9
- package/dist/vite-genaicode/vite-genaicode-plugin.js.map +1 -1
- package/dist/vite-genaicode/vite-genaicode-types.d.ts +26 -0
- package/dist/vite-genaicode/vite-genaicode-types.js +11 -0
- package/dist/vite-genaicode/vite-genaicode-types.js.map +1 -0
- package/package.json +11 -4
- package/dist/ai-service/ai-studio.d.ts.map +0 -1
- package/dist/ai-service/anthropic.d.ts.map +0 -1
- package/dist/ai-service/chat-gpt.d.ts +0 -7
- package/dist/ai-service/chat-gpt.d.ts.map +0 -1
- package/dist/ai-service/chat-gpt.js +0 -174
- package/dist/ai-service/chat-gpt.js.map +0 -1
- package/dist/ai-service/common.d.ts.map +0 -1
- package/dist/ai-service/common.test.js +0 -86
- package/dist/ai-service/common.test.js.map +0 -1
- package/dist/ai-service/dall-e.d.ts.map +0 -1
- package/dist/ai-service/unescape-function-call.d.ts.map +0 -1
- package/dist/ai-service/unescape-function-call.test.d.ts +0 -1
- package/dist/ai-service/unescape-function-call.test.js +0 -18
- package/dist/ai-service/unescape-function-call.test.js.map +0 -1
- package/dist/ai-service/vertex-ai-claude.d.ts.map +0 -1
- package/dist/ai-service/vertex-ai-imagen.d.ts.map +0 -1
- package/dist/ai-service/vertex-ai.d.ts.map +0 -1
- package/dist/cli/cli-options.d.ts.map +0 -1
- package/dist/cli/cli-options.test.d.ts +0 -1
- package/dist/cli/cli-options.test.js +0 -34
- package/dist/cli/cli-options.test.js.map +0 -1
- package/dist/cli/cli-params.d.ts.map +0 -1
- package/dist/cli/cli-params.test.d.ts +0 -1
- package/dist/cli/cli-params.test.js +0 -38
- package/dist/cli/cli-params.test.js.map +0 -1
- package/dist/cli/service-autodetect.d.ts.map +0 -1
- package/dist/cli/service-autodetect.test.d.ts +0 -1
- package/dist/cli/service-autodetect.test.js +0 -38
- package/dist/cli/service-autodetect.test.js.map +0 -1
- package/dist/cli/validate-cli-params.d.ts.map +0 -1
- package/dist/cli/validate-cli-params.test.d.ts +0 -1
- package/dist/cli/validate-cli-params.test.js +0 -106
- package/dist/cli/validate-cli-params.test.js.map +0 -1
- package/dist/eval/codegen-summary.test.d.ts +0 -1
- package/dist/eval/codegen-summary.test.js +0 -93
- package/dist/eval/codegen-summary.test.js.map +0 -1
- package/dist/eval/current-prompt-plugin.js.map +0 -1
- package/dist/eval/data/current-prompt.d.ts +0 -149
- package/dist/eval/data/current-prompt.js +0 -314
- package/dist/eval/data/current-prompt.js.map +0 -1
- package/dist/eval/data/prompt-assistant-image.d.ts +0 -49
- package/dist/eval/data/prompt-assistant-image.js +0 -67
- package/dist/eval/data/prompt-assistant-image.js.map +0 -1
- package/dist/eval/data/prompt3.d.ts +0 -34
- package/dist/eval/data/prompt3.js +0 -71
- package/dist/eval/data/prompt3.js.map +0 -1
- package/dist/eval/prompt-debug.test.d.ts +0 -1
- package/dist/eval/prompt-debug.test.js +0 -93
- package/dist/eval/prompt-debug.test.js.map +0 -1
- package/dist/eval/prompt2.d.ts +0 -34
- package/dist/eval/prompt2.js +0 -125
- package/dist/eval/prompt2.js.map +0 -1
- package/dist/examples/genaicode_plugins/fake_ai_service.d.ts +0 -3
- package/dist/examples/genaicode_plugins/fake_ai_service.js +0 -11
- package/dist/examples/genaicode_plugins/fake_ai_service.js.map +0 -1
- package/dist/examples/genaicode_plugins/grok_ai_service.d.ts +0 -3
- package/dist/examples/genaicode_plugins/grok_ai_service.js +0 -153
- package/dist/examples/genaicode_plugins/grok_ai_service.js.map +0 -1
- package/dist/examples/genaicode_plugins/nonsense_operation.d.ts +0 -3
- package/dist/examples/genaicode_plugins/nonsense_operation.js +0 -23
- package/dist/examples/genaicode_plugins/nonsense_operation.js.map +0 -1
- package/dist/files/cache-file.d.ts.map +0 -1
- package/dist/files/file-utils.d.ts.map +0 -1
- package/dist/files/file-utils.test.d.ts +0 -1
- package/dist/files/file-utils.test.js +0 -18
- package/dist/files/file-utils.test.js.map +0 -1
- package/dist/files/find-files.d.ts.map +0 -1
- package/dist/files/path-utils.d.ts.map +0 -1
- package/dist/files/read-files.d.ts.map +0 -1
- package/dist/files/read-files.test.d.ts +0 -1
- package/dist/files/read-files.test.js +0 -95
- package/dist/files/read-files.test.js.map +0 -1
- package/dist/files/search-files.d.ts.map +0 -1
- package/dist/files/source-code-tree.d.ts.map +0 -1
- package/dist/files/temp-buffer.d.ts.map +0 -1
- package/dist/files/update-files.d.ts.map +0 -1
- package/dist/images/ensure-alpha.d.ts.map +0 -1
- package/dist/images/imgly-remove-background.d.ts.map +0 -1
- package/dist/images/resize-image.d.ts.map +0 -1
- package/dist/images/split-image.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/main/codegen-non-interactive.d.ts.map +0 -1
- package/dist/main/codegen-types.d.ts.map +0 -1
- package/dist/main/codegen-utils.d.ts.map +0 -1
- package/dist/main/codegen.ai-services.test.d.ts +0 -3
- package/dist/main/codegen.ai-services.test.js +0 -198
- package/dist/main/codegen.ai-services.test.js.map +0 -1
- package/dist/main/codegen.cli-options.test.d.ts +0 -3
- package/dist/main/codegen.cli-options.test.js +0 -171
- package/dist/main/codegen.cli-options.test.js.map +0 -1
- package/dist/main/codegen.d.ts.map +0 -1
- package/dist/main/codegen.image-generation.test.d.ts +0 -3
- package/dist/main/codegen.image-generation.test.js +0 -187
- package/dist/main/codegen.image-generation.test.js.map +0 -1
- package/dist/main/codegen.test-utils.d.ts.map +0 -1
- package/dist/main/codegen.test.d.ts +0 -3
- package/dist/main/codegen.test.js +0 -307
- package/dist/main/codegen.test.js.map +0 -1
- package/dist/main/common/content-bus-types.d.ts.map +0 -1
- package/dist/main/common/content-bus.d.ts.map +0 -1
- package/dist/main/common/cost-collector.d.ts.map +0 -1
- package/dist/main/common/user-actions.d.ts.map +0 -1
- package/dist/main/config-lib.d.ts.map +0 -1
- package/dist/main/config-lib.test.d.ts +0 -1
- package/dist/main/config-lib.test.js +0 -64
- package/dist/main/config-lib.test.js.map +0 -1
- package/dist/main/config.d.ts.map +0 -1
- package/dist/main/interactive/codegen-interactive.d.ts.map +0 -1
- package/dist/main/interactive/codegen-interactive.test.d.ts +0 -5
- package/dist/main/interactive/codegen-interactive.test.js +0 -73
- package/dist/main/interactive/codegen-interactive.test.js.map +0 -1
- package/dist/main/interactive/codegen-worker.d.ts.map +0 -1
- package/dist/main/interactive/common.d.ts.map +0 -1
- package/dist/main/interactive/configure.d.ts.map +0 -1
- package/dist/main/interactive/error-handling.d.ts.map +0 -1
- package/dist/main/interactive/help.d.ts.map +0 -1
- package/dist/main/interactive/process-comments.d.ts +0 -2
- package/dist/main/interactive/process-comments.js +0 -39
- package/dist/main/interactive/process-comments.js.map +0 -1
- package/dist/main/interactive/select-ai-service.d.ts.map +0 -1
- package/dist/main/interactive/task-file.d.ts.map +0 -1
- package/dist/main/interactive/text-prompt.d.ts.map +0 -1
- package/dist/main/interactive/user-action-handlers.d.ts.map +0 -1
- package/dist/main/interactive/user-interrupt.d.ts.map +0 -1
- package/dist/main/plugin-loader.d.ts.map +0 -1
- package/dist/main/ui/backend/api-utils.d.ts.map +0 -1
- package/dist/main/ui/backend/api.d.ts.map +0 -1
- package/dist/main/ui/backend/server.d.ts.map +0 -1
- package/dist/main/ui/backend/service.d.ts.map +0 -1
- package/dist/main/ui/codegen-ui.d.ts.map +0 -1
- package/dist/main/ui/common/api-types.d.ts.map +0 -1
- package/dist/main/ui/frontend/assets/index-BAAQr5b1.js +0 -1747
- package/dist/main/ui/user-action-handlers.d.ts.map +0 -1
- package/dist/operations/create-directory/create-directory-def.d.ts.map +0 -1
- package/dist/operations/create-directory/create-directory-executor.d.ts.map +0 -1
- package/dist/operations/create-file/create-file-def.d.ts.map +0 -1
- package/dist/operations/create-file/create-file-executor.d.ts.map +0 -1
- package/dist/operations/delete-file/delete-file-def.d.ts.map +0 -1
- package/dist/operations/delete-file/delete-file-executor.d.ts.map +0 -1
- package/dist/operations/download-file/download-file-def.d.ts.map +0 -1
- package/dist/operations/download-file/download-file-executor.d.ts.map +0 -1
- package/dist/operations/imgly-remove-background/imgly-remove-background-def.d.ts.map +0 -1
- package/dist/operations/imgly-remove-background/imgly-remove-background-executor.d.ts.map +0 -1
- package/dist/operations/move-file/move-file-def.d.ts.map +0 -1
- package/dist/operations/move-file/move-file-executor.d.ts.map +0 -1
- package/dist/operations/operations-index.d.ts.map +0 -1
- package/dist/operations/patch-file/patch-file-def.d.ts.map +0 -1
- package/dist/operations/patch-file/patch-file-executor.d.ts.map +0 -1
- package/dist/operations/resize-image/resize-image-def.d.ts.map +0 -1
- package/dist/operations/resize-image/resize-image-executor.d.ts.map +0 -1
- package/dist/operations/split-image/split-image-def.d.ts.map +0 -1
- package/dist/operations/split-image/split-image-executor.d.ts.map +0 -1
- package/dist/operations/update-file/update-file-def.d.ts.map +0 -1
- package/dist/operations/update-file/update-file-executor.d.ts.map +0 -1
- package/dist/project-profiles/detection.d.ts.map +0 -1
- package/dist/project-profiles/index.d.ts.map +0 -1
- package/dist/project-profiles/profiles/golang.d.ts.map +0 -1
- package/dist/project-profiles/profiles/java-maven.d.ts.map +0 -1
- package/dist/project-profiles/profiles/javascript-npm.d.ts.map +0 -1
- package/dist/project-profiles/profiles/javascript-react.d.ts.map +0 -1
- package/dist/project-profiles/profiles/python-django.d.ts.map +0 -1
- package/dist/project-profiles/types.d.ts.map +0 -1
- package/dist/prompt/ai-service-fallback.d.ts.map +0 -1
- package/dist/prompt/function-calling-validate.d.ts.map +0 -1
- package/dist/prompt/function-calling.d.ts.map +0 -1
- package/dist/prompt/function-defs/ask-question-reflect.d.ts +0 -2
- package/dist/prompt/function-defs/ask-question-reflect.js +0 -21
- package/dist/prompt/function-defs/ask-question-reflect.js.map +0 -1
- package/dist/prompt/function-defs/ask-question.d.ts.map +0 -1
- package/dist/prompt/function-defs/codegen-planning.d.ts.map +0 -1
- package/dist/prompt/function-defs/codegen-summary.d.ts.map +0 -1
- package/dist/prompt/function-defs/create-directory.d.ts +0 -21
- package/dist/prompt/function-defs/create-directory.js +0 -22
- package/dist/prompt/function-defs/create-directory.js.map +0 -1
- package/dist/prompt/function-defs/create-file.d.ts +0 -25
- package/dist/prompt/function-defs/create-file.js +0 -26
- package/dist/prompt/function-defs/create-file.js.map +0 -1
- package/dist/prompt/function-defs/delete-file.d.ts +0 -21
- package/dist/prompt/function-defs/delete-file.js +0 -22
- package/dist/prompt/function-defs/delete-file.js.map +0 -1
- package/dist/prompt/function-defs/download-file.d.ts +0 -25
- package/dist/prompt/function-defs/download-file.js +0 -26
- package/dist/prompt/function-defs/download-file.js.map +0 -1
- package/dist/prompt/function-defs/explanation.d.ts.map +0 -1
- package/dist/prompt/function-defs/generate-image.d.ts.map +0 -1
- package/dist/prompt/function-defs/get-image-assets.d.ts.map +0 -1
- package/dist/prompt/function-defs/get-source-code.d.ts.map +0 -1
- package/dist/prompt/function-defs/imgly-remove-background.d.ts +0 -25
- package/dist/prompt/function-defs/imgly-remove-background.js +0 -26
- package/dist/prompt/function-defs/imgly-remove-background.js.map +0 -1
- package/dist/prompt/function-defs/move-file.d.ts +0 -25
- package/dist/prompt/function-defs/move-file.js +0 -26
- package/dist/prompt/function-defs/move-file.js.map +0 -1
- package/dist/prompt/function-defs/optimize-context.d.ts.map +0 -1
- package/dist/prompt/function-defs/patch-file.d.ts +0 -25
- package/dist/prompt/function-defs/patch-file.js +0 -39
- package/dist/prompt/function-defs/patch-file.js.map +0 -1
- package/dist/prompt/function-defs/read-history.d.ts.map +0 -1
- package/dist/prompt/function-defs/resize-image.d.ts +0 -36
- package/dist/prompt/function-defs/resize-image.js +0 -37
- package/dist/prompt/function-defs/resize-image.js.map +0 -1
- package/dist/prompt/function-defs/set-summaries.d.ts.map +0 -1
- package/dist/prompt/function-defs/split-image.d.ts +0 -57
- package/dist/prompt/function-defs/split-image.js +0 -46
- package/dist/prompt/function-defs/split-image.js.map +0 -1
- package/dist/prompt/function-defs/update-file.d.ts +0 -25
- package/dist/prompt/function-defs/update-file.js +0 -26
- package/dist/prompt/function-defs/update-file.js.map +0 -1
- package/dist/prompt/function-defs/update-history.d.ts.map +0 -1
- package/dist/prompt/limits.d.ts.map +0 -1
- package/dist/prompt/limits.test.d.ts +0 -1
- package/dist/prompt/limits.test.js +0 -35
- package/dist/prompt/limits.test.js.map +0 -1
- package/dist/prompt/prompt-codegen.d.ts.map +0 -1
- package/dist/prompt/prompt-codegen.test.d.ts +0 -1
- package/dist/prompt/prompt-codegen.test.js +0 -92
- package/dist/prompt/prompt-codegen.test.js.map +0 -1
- package/dist/prompt/prompt-consts.d.ts +0 -1
- package/dist/prompt/prompt-consts.js +0 -2
- package/dist/prompt/prompt-consts.js.map +0 -1
- package/dist/prompt/prompt-service-ask-question.test.d.ts +0 -4
- package/dist/prompt/prompt-service-ask-question.test.js +0 -162
- package/dist/prompt/prompt-service-ask-question.test.js.map +0 -1
- package/dist/prompt/prompt-service.ai-services.test.d.ts +0 -1
- package/dist/prompt/prompt-service.ai-services.test.js +0 -149
- package/dist/prompt/prompt-service.ai-services.test.js.map +0 -1
- package/dist/prompt/prompt-service.context-optimization.test.d.ts +0 -1
- package/dist/prompt/prompt-service.context-optimization.test.js +0 -212
- package/dist/prompt/prompt-service.context-optimization.test.js.map +0 -1
- package/dist/prompt/prompt-service.d.ts.map +0 -1
- package/dist/prompt/prompt-service.image-handling.test.d.ts +0 -1
- package/dist/prompt/prompt-service.image-handling.test.js +0 -212
- package/dist/prompt/prompt-service.image-handling.test.js.map +0 -1
- package/dist/prompt/prompt-service.test-utils.d.ts.map +0 -1
- package/dist/prompt/prompt-service.test.d.ts +0 -2
- package/dist/prompt/prompt-service.test.js +0 -629
- package/dist/prompt/prompt-service.test.js.map +0 -1
- package/dist/prompt/prompt-service.validation-recovery.test.d.ts +0 -1
- package/dist/prompt/prompt-service.validation-recovery.test.js +0 -263
- package/dist/prompt/prompt-service.validation-recovery.test.js.map +0 -1
- package/dist/prompt/static-prompts.d.ts.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.d.ts +0 -2
- package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.d.ts.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.js +0 -14
- package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.js.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.d.ts.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.d.ts.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.d.ts.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/default-action.d.ts +0 -2
- package/dist/prompt/steps/step-ask-question/handlers/default-action.d.ts.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/default-action.js +0 -15
- package/dist/prompt/steps/step-ask-question/handlers/default-action.js.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer-with-image.d.ts +0 -2
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer-with-image.js +0 -86
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer-with-image.js.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer.d.ts +0 -2
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer.js +0 -20
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer.js.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-search-code.d.ts.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message-with-image.d.ts +0 -2
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message-with-image.d.ts.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message-with-image.js.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.d.ts.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/handler-utils.d.ts +0 -0
- package/dist/prompt/steps/step-ask-question/handlers/handler-utils.js +0 -2
- package/dist/prompt/steps/step-ask-question/handlers/handler-utils.js.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/lint.d.ts.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.d.ts.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.d.ts.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.d.ts.map +0 -1
- package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.d.ts +0 -2
- package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.js +0 -16
- package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.js.map +0 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question-handlers.d.ts +0 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-handlers.js +0 -2
- package/dist/prompt/steps/step-ask-question/step-ask-question-handlers.js.map +0 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.d.ts +0 -4
- package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.js +0 -92
- package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.js.map +0 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts.map +0 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question.d.ts.map +0 -1
- package/dist/prompt/steps/step-ask-question-handlers.d.ts +0 -10
- package/dist/prompt/steps/step-ask-question-handlers.js +0 -257
- package/dist/prompt/steps/step-ask-question-handlers.js.map +0 -1
- package/dist/prompt/steps/step-ask-question-reflect.d.ts +0 -4
- package/dist/prompt/steps/step-ask-question-reflect.js +0 -48
- package/dist/prompt/steps/step-ask-question-reflect.js.map +0 -1
- package/dist/prompt/steps/step-ask-question-types.d.ts +0 -55
- package/dist/prompt/steps/step-ask-question-types.js +0 -2
- package/dist/prompt/steps/step-ask-question-types.js.map +0 -1
- package/dist/prompt/steps/step-ask-question.d.ts +0 -6
- package/dist/prompt/steps/step-ask-question.js +0 -80
- package/dist/prompt/steps/step-ask-question.js.map +0 -1
- package/dist/prompt/steps/step-codegen-planning.d.ts.map +0 -1
- package/dist/prompt/steps/step-codegen-summary.d.ts +0 -7
- package/dist/prompt/steps/step-codegen-summary.d.ts.map +0 -1
- package/dist/prompt/steps/step-codegen-summary.js +0 -106
- package/dist/prompt/steps/step-codegen-summary.js.map +0 -1
- package/dist/prompt/steps/step-codegen-summary.test.d.ts +0 -1
- package/dist/prompt/steps/step-codegen-summary.test.js +0 -136
- package/dist/prompt/steps/step-codegen-summary.test.js.map +0 -1
- package/dist/prompt/steps/step-context-optimization.d.ts.map +0 -1
- package/dist/prompt/steps/step-context-optimization.test.d.ts +0 -2
- package/dist/prompt/steps/step-context-optimization.test.js +0 -475
- package/dist/prompt/steps/step-context-optimization.test.js.map +0 -1
- package/dist/prompt/steps/step-ensure-context.d.ts.map +0 -1
- package/dist/prompt/steps/step-ensure-context.test.d.ts +0 -1
- package/dist/prompt/steps/step-ensure-context.test.js +0 -326
- package/dist/prompt/steps/step-ensure-context.test.js.map +0 -1
- package/dist/prompt/steps/step-generate-image.d.ts.map +0 -1
- package/dist/prompt/steps/step-generate-summary.d.ts.map +0 -1
- package/dist/prompt/steps/step-history-update.d.ts.map +0 -1
- package/dist/prompt/steps/step-summarization.d.ts.map +0 -1
- package/dist/prompt/steps/step-validate-recover.d.ts.map +0 -1
- package/dist/prompt/steps/step-verify-patch.d.ts.map +0 -1
- package/dist/prompt/steps/steps-types.d.ts.map +0 -1
- package/dist/prompt/steps/steps-utils.d.ts.map +0 -1
- package/dist/prompt/systemprompt.d.ts.map +0 -1
- package/dist/prompt/systemprompt.test.d.ts +0 -3
- package/dist/prompt/systemprompt.test.js +0 -42
- package/dist/prompt/systemprompt.test.js.map +0 -1
- package/dist/prompt/token-estimator.d.ts.map +0 -1
- package/dist/src/ai-service/ai-studio.d.ts +0 -6
- package/dist/src/ai-service/ai-studio.js +0 -190
- package/dist/src/ai-service/ai-studio.js.map +0 -1
- package/dist/src/ai-service/anthropic.d.ts +0 -6
- package/dist/src/ai-service/anthropic.js +0 -150
- package/dist/src/ai-service/anthropic.js.map +0 -1
- package/dist/src/ai-service/chat-gpt.d.ts +0 -5
- package/dist/src/ai-service/chat-gpt.js +0 -146
- package/dist/src/ai-service/chat-gpt.js.map +0 -1
- package/dist/src/ai-service/common.js +0 -38
- package/dist/src/ai-service/common.js.map +0 -1
- package/dist/src/ai-service/common.test.d.ts +0 -1
- package/dist/src/ai-service/common.test.js +0 -86
- package/dist/src/ai-service/common.test.js.map +0 -1
- package/dist/src/ai-service/dall-e.d.ts +0 -14
- package/dist/src/ai-service/dall-e.js +0 -50
- package/dist/src/ai-service/dall-e.js.map +0 -1
- package/dist/src/ai-service/unescape-function-call.d.ts +0 -7
- package/dist/src/ai-service/unescape-function-call.js +0 -59
- package/dist/src/ai-service/unescape-function-call.js.map +0 -1
- package/dist/src/ai-service/unescape-function-call.test.d.ts +0 -1
- package/dist/src/ai-service/unescape-function-call.test.js +0 -18
- package/dist/src/ai-service/unescape-function-call.test.js.map +0 -1
- package/dist/src/ai-service/vertex-ai-claude.d.ts +0 -5
- package/dist/src/ai-service/vertex-ai-claude.js +0 -104
- package/dist/src/ai-service/vertex-ai-claude.js.map +0 -1
- package/dist/src/ai-service/vertex-ai-imagen.d.ts +0 -14
- package/dist/src/ai-service/vertex-ai-imagen.js +0 -77
- package/dist/src/ai-service/vertex-ai-imagen.js.map +0 -1
- package/dist/src/ai-service/vertex-ai.d.ts +0 -6
- package/dist/src/ai-service/vertex-ai.js +0 -202
- package/dist/src/ai-service/vertex-ai.js.map +0 -1
- package/dist/src/cli/cli-options.d.ts +0 -10
- package/dist/src/cli/cli-options.js +0 -132
- package/dist/src/cli/cli-options.js.map +0 -1
- package/dist/src/cli/cli-options.test.d.ts +0 -1
- package/dist/src/cli/cli-options.test.js +0 -34
- package/dist/src/cli/cli-options.test.js.map +0 -1
- package/dist/src/cli/cli-params.d.ts +0 -32
- package/dist/src/cli/cli-params.js +0 -106
- package/dist/src/cli/cli-params.js.map +0 -1
- package/dist/src/cli/cli-params.test.d.ts +0 -1
- package/dist/src/cli/cli-params.test.js +0 -38
- package/dist/src/cli/cli-params.test.js.map +0 -1
- package/dist/src/cli/service-autodetect.d.ts +0 -2
- package/dist/src/cli/service-autodetect.js +0 -17
- package/dist/src/cli/service-autodetect.js.map +0 -1
- package/dist/src/cli/service-autodetect.test.d.ts +0 -1
- package/dist/src/cli/service-autodetect.test.js +0 -38
- package/dist/src/cli/service-autodetect.test.js.map +0 -1
- package/dist/src/cli/validate-cli-params.d.ts +0 -18
- package/dist/src/cli/validate-cli-params.js +0 -145
- package/dist/src/cli/validate-cli-params.js.map +0 -1
- package/dist/src/cli/validate-cli-params.test.d.ts +0 -1
- package/dist/src/cli/validate-cli-params.test.js +0 -106
- package/dist/src/cli/validate-cli-params.test.js.map +0 -1
- package/dist/src/files/cache-file.d.ts +0 -3
- package/dist/src/files/cache-file.js +0 -36
- package/dist/src/files/cache-file.js.map +0 -1
- package/dist/src/files/file-utils.d.ts +0 -2
- package/dist/src/files/file-utils.js +0 -7
- package/dist/src/files/file-utils.js.map +0 -1
- package/dist/src/files/file-utils.test.d.ts +0 -1
- package/dist/src/files/file-utils.test.js +0 -18
- package/dist/src/files/file-utils.test.js.map +0 -1
- package/dist/src/files/find-files.d.ts +0 -9
- package/dist/src/files/find-files.js +0 -81
- package/dist/src/files/find-files.js.map +0 -1
- package/dist/src/files/path-utils.d.ts +0 -1
- package/dist/src/files/path-utils.js +0 -12
- package/dist/src/files/path-utils.js.map +0 -1
- package/dist/src/files/read-files.d.ts +0 -21
- package/dist/src/files/read-files.js +0 -68
- package/dist/src/files/read-files.js.map +0 -1
- package/dist/src/files/read-files.test.d.ts +0 -1
- package/dist/src/files/read-files.test.js +0 -89
- package/dist/src/files/read-files.test.js.map +0 -1
- package/dist/src/files/temp-buffer.d.ts +0 -2
- package/dist/src/files/temp-buffer.js +0 -12
- package/dist/src/files/temp-buffer.js.map +0 -1
- package/dist/src/files/update-files.d.ts +0 -6
- package/dist/src/files/update-files.js +0 -19
- package/dist/src/files/update-files.js.map +0 -1
- package/dist/src/images/ensure-alpha.d.ts +0 -1
- package/dist/src/images/ensure-alpha.js +0 -5
- package/dist/src/images/ensure-alpha.js.map +0 -1
- package/dist/src/images/imgly-remove-background.d.ts +0 -2
- package/dist/src/images/imgly-remove-background.js +0 -21
- package/dist/src/images/imgly-remove-background.js.map +0 -1
- package/dist/src/images/resize-image.d.ts +0 -19
- package/dist/src/images/resize-image.js +0 -22
- package/dist/src/images/resize-image.js.map +0 -1
- package/dist/src/images/split-image.d.ts +0 -18
- package/dist/src/images/split-image.js +0 -25
- package/dist/src/images/split-image.js.map +0 -1
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +0 -1
- package/dist/src/main/codegen-types.d.ts +0 -58
- package/dist/src/main/codegen-types.js +0 -2
- package/dist/src/main/codegen-types.js.map +0 -1
- package/dist/src/main/codegen-utils.d.ts +0 -3
- package/dist/src/main/codegen-utils.js +0 -18
- package/dist/src/main/codegen-utils.js.map +0 -1
- package/dist/src/main/codegen.d.ts +0 -4
- package/dist/src/main/codegen.js +0 -201
- package/dist/src/main/codegen.js.map +0 -1
- package/dist/src/main/codegen.test.d.ts +0 -3
- package/dist/src/main/codegen.test.js +0 -288
- package/dist/src/main/codegen.test.js.map +0 -1
- package/dist/src/main/common/content-bus-types.d.ts +0 -21
- package/dist/src/main/common/content-bus-types.js +0 -11
- package/dist/src/main/common/content-bus-types.js.map +0 -1
- package/dist/src/main/common/content-bus.d.ts +0 -10
- package/dist/src/main/common/content-bus.js +0 -39
- package/dist/src/main/common/content-bus.js.map +0 -1
- package/dist/src/main/common/cost-collector.d.ts +0 -11
- package/dist/src/main/common/cost-collector.js +0 -90
- package/dist/src/main/common/cost-collector.js.map +0 -1
- package/dist/src/main/common/user-actions.d.ts +0 -19
- package/dist/src/main/common/user-actions.js +0 -30
- package/dist/src/main/common/user-actions.js.map +0 -1
- package/dist/src/main/config-lib.d.ts +0 -36
- package/dist/src/main/config-lib.js +0 -51
- package/dist/src/main/config-lib.js.map +0 -1
- package/dist/src/main/config-lib.test.d.ts +0 -1
- package/dist/src/main/config-lib.test.js +0 -64
- package/dist/src/main/config-lib.test.js.map +0 -1
- package/dist/src/main/config.d.ts +0 -7
- package/dist/src/main/config.js +0 -51
- package/dist/src/main/config.js.map +0 -1
- package/dist/src/main/interactive/codegen-interactive.d.ts +0 -2
- package/dist/src/main/interactive/codegen-interactive.js +0 -61
- package/dist/src/main/interactive/codegen-interactive.js.map +0 -1
- package/dist/src/main/interactive/codegen-interactive.test.d.ts +0 -5
- package/dist/src/main/interactive/codegen-interactive.test.js +0 -79
- package/dist/src/main/interactive/codegen-interactive.test.js.map +0 -1
- package/dist/src/main/interactive/codegen-worker.d.ts +0 -3
- package/dist/src/main/interactive/codegen-worker.js +0 -54
- package/dist/src/main/interactive/codegen-worker.js.map +0 -1
- package/dist/src/main/interactive/common.d.ts +0 -5
- package/dist/src/main/interactive/common.js +0 -51
- package/dist/src/main/interactive/common.js.map +0 -1
- package/dist/src/main/interactive/configure.d.ts +0 -2
- package/dist/src/main/interactive/configure.js +0 -99
- package/dist/src/main/interactive/configure.js.map +0 -1
- package/dist/src/main/interactive/error-handling.d.ts +0 -1
- package/dist/src/main/interactive/error-handling.js +0 -43
- package/dist/src/main/interactive/error-handling.js.map +0 -1
- package/dist/src/main/interactive/help.d.ts +0 -1
- package/dist/src/main/interactive/help.js +0 -22
- package/dist/src/main/interactive/help.js.map +0 -1
- package/dist/src/main/interactive/process-comments.d.ts +0 -2
- package/dist/src/main/interactive/process-comments.js +0 -39
- package/dist/src/main/interactive/process-comments.js.map +0 -1
- package/dist/src/main/interactive/select-ai-service.d.ts +0 -2
- package/dist/src/main/interactive/select-ai-service.js +0 -27
- package/dist/src/main/interactive/select-ai-service.js.map +0 -1
- package/dist/src/main/interactive/task-file.d.ts +0 -2
- package/dist/src/main/interactive/task-file.js +0 -35
- package/dist/src/main/interactive/task-file.js.map +0 -1
- package/dist/src/main/interactive/text-prompt.d.ts +0 -2
- package/dist/src/main/interactive/text-prompt.js +0 -18
- package/dist/src/main/interactive/text-prompt.js.map +0 -1
- package/dist/src/main/interactive/user-action-handlers.d.ts +0 -1
- package/dist/src/main/interactive/user-action-handlers.js +0 -13
- package/dist/src/main/interactive/user-action-handlers.js.map +0 -1
- package/dist/src/main/interactive/user-interrupt.d.ts +0 -1
- package/dist/src/main/interactive/user-interrupt.js +0 -36
- package/dist/src/main/interactive/user-interrupt.js.map +0 -1
- package/dist/src/main/plugin-loader.d.ts +0 -6
- package/dist/src/main/plugin-loader.js +0 -40
- package/dist/src/main/plugin-loader.js.map +0 -1
- package/dist/src/main/ui/backend/api-utils.d.ts +0 -2
- package/dist/src/main/ui/backend/api-utils.js +0 -18
- package/dist/src/main/ui/backend/api-utils.js.map +0 -1
- package/dist/src/main/ui/backend/api.d.ts +0 -2
- package/dist/src/main/ui/backend/api.js +0 -210
- package/dist/src/main/ui/backend/api.js.map +0 -1
- package/dist/src/main/ui/backend/server.d.ts +0 -7
- package/dist/src/main/ui/backend/server.js +0 -83
- package/dist/src/main/ui/backend/server.js.map +0 -1
- package/dist/src/main/ui/backend/service.d.ts +0 -44
- package/dist/src/main/ui/backend/service.js +0 -171
- package/dist/src/main/ui/backend/service.js.map +0 -1
- package/dist/src/main/ui/codegen-ui.d.ts +0 -2
- package/dist/src/main/ui/codegen-ui.js +0 -13
- package/dist/src/main/ui/codegen-ui.js.map +0 -1
- package/dist/src/main/ui/common/api-types.d.ts +0 -20
- package/dist/src/main/ui/common/api-types.js +0 -2
- package/dist/src/main/ui/common/api-types.js.map +0 -1
- package/dist/src/main/ui/user-action-handlers.d.ts +0 -2
- package/dist/src/main/ui/user-action-handlers.js +0 -14
- package/dist/src/main/ui/user-action-handlers.js.map +0 -1
- package/dist/src/operations/create-directory/create-directory-def.d.ts +0 -9
- package/dist/src/operations/create-directory/create-directory-def.js +0 -22
- package/dist/src/operations/create-directory/create-directory-def.js.map +0 -1
- package/dist/src/operations/create-directory/create-directory-executor.d.ts +0 -6
- package/dist/src/operations/create-directory/create-directory-executor.js +0 -22
- package/dist/src/operations/create-directory/create-directory-executor.js.map +0 -1
- package/dist/src/operations/create-file/create-file-def.d.ts +0 -10
- package/dist/src/operations/create-file/create-file-def.js +0 -26
- package/dist/src/operations/create-file/create-file-def.js.map +0 -1
- package/dist/src/operations/create-file/create-file-executor.d.ts +0 -6
- package/dist/src/operations/create-file/create-file-executor.js +0 -27
- package/dist/src/operations/create-file/create-file-executor.js.map +0 -1
- package/dist/src/operations/delete-file/delete-file-def.d.ts +0 -9
- package/dist/src/operations/delete-file/delete-file-def.js +0 -22
- package/dist/src/operations/delete-file/delete-file-def.js.map +0 -1
- package/dist/src/operations/delete-file/delete-file-executor.d.ts +0 -6
- package/dist/src/operations/delete-file/delete-file-executor.js +0 -23
- package/dist/src/operations/delete-file/delete-file-executor.js.map +0 -1
- package/dist/src/operations/download-file/download-file-def.d.ts +0 -10
- package/dist/src/operations/download-file/download-file-def.js +0 -26
- package/dist/src/operations/download-file/download-file-def.js.map +0 -1
- package/dist/src/operations/download-file/download-file-executor.d.ts +0 -6
- package/dist/src/operations/download-file/download-file-executor.js +0 -44
- package/dist/src/operations/download-file/download-file-executor.js.map +0 -1
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-def.d.ts +0 -10
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-def.js +0 -26
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-def.js.map +0 -1
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-executor.d.ts +0 -6
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-executor.js +0 -40
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-executor.js.map +0 -1
- package/dist/src/operations/move-file/move-file-def.d.ts +0 -10
- package/dist/src/operations/move-file/move-file-def.js +0 -26
- package/dist/src/operations/move-file/move-file-def.js.map +0 -1
- package/dist/src/operations/move-file/move-file-executor.d.ts +0 -6
- package/dist/src/operations/move-file/move-file-executor.js +0 -29
- package/dist/src/operations/move-file/move-file-executor.js.map +0 -1
- package/dist/src/operations/operations-index.d.ts +0 -3
- package/dist/src/operations/operations-index.js +0 -33
- package/dist/src/operations/operations-index.js.map +0 -1
- package/dist/src/operations/patch-file/patch-file-def.d.ts +0 -10
- package/dist/src/operations/patch-file/patch-file-def.js +0 -39
- package/dist/src/operations/patch-file/patch-file-def.js.map +0 -1
- package/dist/src/operations/patch-file/patch-file-executor.d.ts +0 -5
- package/dist/src/operations/patch-file/patch-file-executor.js +0 -26
- package/dist/src/operations/patch-file/patch-file-executor.js.map +0 -1
- package/dist/src/operations/resize-image/resize-image-def.d.ts +0 -13
- package/dist/src/operations/resize-image/resize-image-def.js +0 -37
- package/dist/src/operations/resize-image/resize-image-def.js.map +0 -1
- package/dist/src/operations/resize-image/resize-image-executor.d.ts +0 -5
- package/dist/src/operations/resize-image/resize-image-executor.js +0 -30
- package/dist/src/operations/resize-image/resize-image-executor.js.map +0 -1
- package/dist/src/operations/split-image/split-image-def.d.ts +0 -18
- package/dist/src/operations/split-image/split-image-def.js +0 -46
- package/dist/src/operations/split-image/split-image-def.js.map +0 -1
- package/dist/src/operations/split-image/split-image-executor.d.ts +0 -6
- package/dist/src/operations/split-image/split-image-executor.js +0 -51
- package/dist/src/operations/split-image/split-image-executor.js.map +0 -1
- package/dist/src/operations/update-file/update-file-def.d.ts +0 -10
- package/dist/src/operations/update-file/update-file-def.js +0 -26
- package/dist/src/operations/update-file/update-file-def.js.map +0 -1
- package/dist/src/operations/update-file/update-file-executor.d.ts +0 -5
- package/dist/src/operations/update-file/update-file-executor.js +0 -22
- package/dist/src/operations/update-file/update-file-executor.js.map +0 -1
- package/dist/src/prompt/ai-service-fallback.d.ts +0 -3
- package/dist/src/prompt/ai-service-fallback.js +0 -84
- package/dist/src/prompt/ai-service-fallback.js.map +0 -1
- package/dist/src/prompt/function-calling-validate.d.ts +0 -3
- package/dist/src/prompt/function-calling-validate.js +0 -99
- package/dist/src/prompt/function-calling-validate.js.map +0 -1
- package/dist/src/prompt/function-calling.d.ts +0 -5
- package/dist/src/prompt/function-calling.js +0 -43
- package/dist/src/prompt/function-calling.js.map +0 -1
- package/dist/src/prompt/function-defs/ask-question-reflect.d.ts +0 -2
- package/dist/src/prompt/function-defs/ask-question-reflect.js +0 -21
- package/dist/src/prompt/function-defs/ask-question-reflect.js.map +0 -1
- package/dist/src/prompt/function-defs/ask-question.d.ts +0 -8
- package/dist/src/prompt/function-defs/ask-question.js +0 -100
- package/dist/src/prompt/function-defs/ask-question.js.map +0 -1
- package/dist/src/prompt/function-defs/codegen-summary.d.ts +0 -5
- package/dist/src/prompt/function-defs/codegen-summary.js +0 -82
- package/dist/src/prompt/function-defs/codegen-summary.js.map +0 -1
- package/dist/src/prompt/function-defs/explanation.d.ts +0 -5
- package/dist/src/prompt/function-defs/explanation.js +0 -18
- package/dist/src/prompt/function-defs/explanation.js.map +0 -1
- package/dist/src/prompt/function-defs/generate-image.d.ts +0 -5
- package/dist/src/prompt/function-defs/generate-image.js +0 -42
- package/dist/src/prompt/function-defs/generate-image.js.map +0 -1
- package/dist/src/prompt/function-defs/get-image-assets.d.ts +0 -5
- package/dist/src/prompt/function-defs/get-image-assets.js +0 -21
- package/dist/src/prompt/function-defs/get-image-assets.js.map +0 -1
- package/dist/src/prompt/function-defs/get-source-code.d.ts +0 -5
- package/dist/src/prompt/function-defs/get-source-code.js +0 -22
- package/dist/src/prompt/function-defs/get-source-code.js.map +0 -1
- package/dist/src/prompt/function-defs/optimize-context.d.ts +0 -5
- package/dist/src/prompt/function-defs/optimize-context.js +0 -47
- package/dist/src/prompt/function-defs/optimize-context.js.map +0 -1
- package/dist/src/prompt/function-defs/read-history.d.ts +0 -2
- package/dist/src/prompt/function-defs/read-history.js +0 -14
- package/dist/src/prompt/function-defs/read-history.js.map +0 -1
- package/dist/src/prompt/function-defs/set-summaries.d.ts +0 -5
- package/dist/src/prompt/function-defs/set-summaries.js +0 -32
- package/dist/src/prompt/function-defs/set-summaries.js.map +0 -1
- package/dist/src/prompt/function-defs/update-history.d.ts +0 -5
- package/dist/src/prompt/function-defs/update-history.js +0 -22
- package/dist/src/prompt/function-defs/update-history.js.map +0 -1
- package/dist/src/prompt/limits.d.ts +0 -3
- package/dist/src/prompt/limits.js +0 -21
- package/dist/src/prompt/limits.js.map +0 -1
- package/dist/src/prompt/limits.test.d.ts +0 -1
- package/dist/src/prompt/limits.test.js +0 -35
- package/dist/src/prompt/limits.test.js.map +0 -1
- package/dist/src/prompt/prompt-codegen.d.ts +0 -9
- package/dist/src/prompt/prompt-codegen.js +0 -117
- package/dist/src/prompt/prompt-codegen.js.map +0 -1
- package/dist/src/prompt/prompt-codegen.test.d.ts +0 -1
- package/dist/src/prompt/prompt-codegen.test.js +0 -98
- package/dist/src/prompt/prompt-codegen.test.js.map +0 -1
- package/dist/src/prompt/prompt-consts.d.ts +0 -1
- package/dist/src/prompt/prompt-consts.js +0 -2
- package/dist/src/prompt/prompt-consts.js.map +0 -1
- package/dist/src/prompt/prompt-service-ask-question.test.d.ts +0 -4
- package/dist/src/prompt/prompt-service-ask-question.test.js +0 -215
- package/dist/src/prompt/prompt-service-ask-question.test.js.map +0 -1
- package/dist/src/prompt/prompt-service.d.ts +0 -5
- package/dist/src/prompt/prompt-service.js +0 -214
- package/dist/src/prompt/prompt-service.js.map +0 -1
- package/dist/src/prompt/prompt-service.test.d.ts +0 -2
- package/dist/src/prompt/prompt-service.test.js +0 -553
- package/dist/src/prompt/prompt-service.test.js.map +0 -1
- package/dist/src/prompt/steps/step-ask-question/handlers/cancel-code-generation.d.ts +0 -2
- package/dist/src/prompt/steps/step-ask-question/handlers/cancel-code-generation.js +0 -16
- package/dist/src/prompt/steps/step-ask-question/handlers/cancel-code-generation.js.map +0 -1
- package/dist/src/prompt/steps/step-ask-question/handlers/confirm-code-generation.d.ts +0 -2
- package/dist/src/prompt/steps/step-ask-question/handlers/confirm-code-generation.js +0 -37
- package/dist/src/prompt/steps/step-ask-question/handlers/confirm-code-generation.js.map +0 -1
- package/dist/src/prompt/steps/step-ask-question/handlers/context-optimization.d.ts +0 -2
- package/dist/src/prompt/steps/step-ask-question/handlers/context-optimization.js +0 -36
- package/dist/src/prompt/steps/step-ask-question/handlers/context-optimization.js.map +0 -1
- package/dist/src/prompt/steps/step-ask-question/handlers/default-action.d.ts +0 -2
- package/dist/src/prompt/steps/step-ask-question/handlers/default-action.js +0 -18
- package/dist/src/prompt/steps/step-ask-question/handlers/default-action.js.map +0 -1
- package/dist/src/prompt/steps/step-ask-question/handlers/handle-request-answer.d.ts +0 -2
- package/dist/src/prompt/steps/step-ask-question/handlers/handle-request-answer.js +0 -20
- package/dist/src/prompt/steps/step-ask-question/handlers/handle-request-answer.js.map +0 -1
- package/dist/src/prompt/steps/step-ask-question/handlers/remove-files-from-context.d.ts +0 -2
- package/dist/src/prompt/steps/step-ask-question/handlers/remove-files-from-context.js +0 -43
- package/dist/src/prompt/steps/step-ask-question/handlers/remove-files-from-context.js.map +0 -1
- package/dist/src/prompt/steps/step-ask-question/handlers/request-files-content.d.ts +0 -2
- package/dist/src/prompt/steps/step-ask-question/handlers/request-files-content.js +0 -49
- package/dist/src/prompt/steps/step-ask-question/handlers/request-files-content.js.map +0 -1
- package/dist/src/prompt/steps/step-ask-question/handlers/request-permissions.d.ts +0 -2
- package/dist/src/prompt/steps/step-ask-question/handlers/request-permissions.js +0 -46
- package/dist/src/prompt/steps/step-ask-question/handlers/request-permissions.js.map +0 -1
- package/dist/src/prompt/steps/step-ask-question/handlers/start-code-generation.d.ts +0 -2
- package/dist/src/prompt/steps/step-ask-question/handlers/start-code-generation.js +0 -16
- package/dist/src/prompt/steps/step-ask-question/handlers/start-code-generation.js.map +0 -1
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-handlers.d.ts +0 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-handlers.js +0 -2
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-handlers.js.map +0 -1
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-reflect.d.ts +0 -4
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-reflect.js +0 -91
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-reflect.js.map +0 -1
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-types.d.ts +0 -55
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-types.js +0 -2
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-types.js.map +0 -1
- package/dist/src/prompt/steps/step-ask-question/step-ask-question.d.ts +0 -6
- package/dist/src/prompt/steps/step-ask-question/step-ask-question.js +0 -88
- package/dist/src/prompt/steps/step-ask-question/step-ask-question.js.map +0 -1
- package/dist/src/prompt/steps/step-context-optimization.d.ts +0 -4
- package/dist/src/prompt/steps/step-context-optimization.js +0 -200
- package/dist/src/prompt/steps/step-context-optimization.js.map +0 -1
- package/dist/src/prompt/steps/step-generate-image.d.ts +0 -2
- package/dist/src/prompt/steps/step-generate-image.js +0 -29
- package/dist/src/prompt/steps/step-generate-image.js.map +0 -1
- package/dist/src/prompt/steps/step-generate-summary.d.ts +0 -3
- package/dist/src/prompt/steps/step-generate-summary.js +0 -41
- package/dist/src/prompt/steps/step-generate-summary.js.map +0 -1
- package/dist/src/prompt/steps/step-history-update.d.ts +0 -5
- package/dist/src/prompt/steps/step-history-update.js +0 -54
- package/dist/src/prompt/steps/step-history-update.js.map +0 -1
- package/dist/src/prompt/steps/step-summarization.d.ts +0 -8
- package/dist/src/prompt/steps/step-summarization.js +0 -75
- package/dist/src/prompt/steps/step-summarization.js.map +0 -1
- package/dist/src/prompt/steps/step-validate-recover.d.ts +0 -2
- package/dist/src/prompt/steps/step-validate-recover.js +0 -51
- package/dist/src/prompt/steps/step-validate-recover.js.map +0 -1
- package/dist/src/prompt/steps/step-verify-patch.d.ts +0 -6
- package/dist/src/prompt/steps/step-verify-patch.js +0 -34
- package/dist/src/prompt/steps/step-verify-patch.js.map +0 -1
- package/dist/src/prompt/steps/steps-types.d.ts +0 -16
- package/dist/src/prompt/steps/steps-types.js +0 -6
- package/dist/src/prompt/steps/steps-types.js.map +0 -1
- package/dist/src/prompt/steps/steps-utils.d.ts +0 -7
- package/dist/src/prompt/steps/steps-utils.js +0 -11
- package/dist/src/prompt/steps/steps-utils.js.map +0 -1
- package/dist/src/prompt/systemprompt.d.ts +0 -3
- package/dist/src/prompt/systemprompt.js +0 -209
- package/dist/src/prompt/systemprompt.js.map +0 -1
- package/dist/src/prompt/systemprompt.test.d.ts +0 -3
- package/dist/src/prompt/systemprompt.test.js +0 -43
- package/dist/src/prompt/systemprompt.test.js.map +0 -1
- package/dist/src/prompt/token-estimator.d.ts +0 -8
- package/dist/src/prompt/token-estimator.js +0 -31
- package/dist/src/prompt/token-estimator.js.map +0 -1
- package/dist/src/vite-genaicode/vite-genaicode-frontend.d.ts +0 -1
- package/dist/src/vite-genaicode/vite-genaicode-frontend.js +0 -142
- package/dist/src/vite-genaicode/vite-genaicode-frontend.js.map +0 -1
- package/dist/src/vite-genaicode/vite-genaicode-plugin.d.ts +0 -7
- package/dist/src/vite-genaicode/vite-genaicode-plugin.js +0 -40
- package/dist/src/vite-genaicode/vite-genaicode-plugin.js.map +0 -1
- package/dist/vite-genaicode/vite-genaicode-frontend.d.ts.map +0 -1
- package/dist/vite-genaicode/vite-genaicode-plugin.d.ts.map +0 -1
- /package/dist/{ai-service/common.test.d.ts → main/ui/backend/endpoints/context-endpoint.d.ts} +0 -0
package/dist/eval/prompt2.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { getSystemPrompt } from '../prompt/systemprompt';
|
|
2
|
-
export const DEBUG_PROMPT2 = [
|
|
3
|
-
{
|
|
4
|
-
type: 'systemPrompt',
|
|
5
|
-
systemPrompt: getSystemPrompt({ verbose: false, askQuestion: true, interactive: false, ui: true }),
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
type: 'user',
|
|
9
|
-
text: 'Hello, GenAIcode!',
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
type: 'assistant',
|
|
13
|
-
text: 'Hello there! I guess you have a task for me today. Before we start, could you please provide me with the current source code of your application, and the image assets?',
|
|
14
|
-
functionCalls: [
|
|
15
|
-
{
|
|
16
|
-
name: 'getSourceCode',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: 'getImageAssets',
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
type: 'user',
|
|
25
|
-
functionResponses: [
|
|
26
|
-
{
|
|
27
|
-
name: 'getSourceCode',
|
|
28
|
-
content: JSON.stringify({
|
|
29
|
-
'/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers': {
|
|
30
|
-
'cancel-code-generation.ts': { summary: 'Handles the cancellation of code generation.' },
|
|
31
|
-
'confirm-code-generation.ts': { summary: 'Handles confirmation of code generation' },
|
|
32
|
-
'context-optimization.ts': { summary: 'Handles context optimization' },
|
|
33
|
-
'default-action.ts': { summary: 'Default action handler' },
|
|
34
|
-
'handle-request-answer-with-image.ts': {
|
|
35
|
-
summary: 'Handles request to generate image and display it to user',
|
|
36
|
-
},
|
|
37
|
-
'handle-request-answer.ts': { summary: 'Handles user answer requests' },
|
|
38
|
-
'handler-utils.ts': { summary: 'Utility functions for step-ask-question handlers' },
|
|
39
|
-
'remove-files-from-context.ts': { summary: 'Handles removing files from context' },
|
|
40
|
-
'request-files-content.ts': { summary: 'Handles requesting content of missing files' },
|
|
41
|
-
'request-permissions.ts': { summary: 'Handles requesting permissions from user' },
|
|
42
|
-
'start-code-generation.ts': { summary: 'Handles the start of code generation.' },
|
|
43
|
-
},
|
|
44
|
-
}),
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: 'getImageAssets',
|
|
48
|
-
content: '{"/Users/gtanczyk/src/codegen/media/logo-dark.png":{"mimeType":"image/png","width":1200,"height":686},"/Users/gtanczyk/src/codegen/media/logo.png":{"mimeType":"image/png","width":1200,"height":686},"/Users/gtanczyk/src/codegen/src/vite-genaicode/media/demo-for-readme.gif":{"mimeType":"image/gif","width":769,"height":465}}',
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
cache: true,
|
|
52
|
-
text: 'Sure, here is the application source code and image assets.',
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
type: 'assistant',
|
|
56
|
-
text: "Thank you, I'm ready to assist you with your request.",
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
type: 'user',
|
|
60
|
-
text: 'Hello',
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
type: 'assistant',
|
|
64
|
-
text: 'Hello, How can I assist you today?',
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
type: 'user',
|
|
68
|
-
text: 'we will be working on files from src/prompt/steps/step-ask-question/handlers, I want you to analyze them and provide me with a summary of the content of each file.',
|
|
69
|
-
},
|
|
70
|
-
// {
|
|
71
|
-
// type: 'assistant',
|
|
72
|
-
// text: 'Please provide the content of the following files from the src/prompt/steps/step-ask-question/handlers directory: \n- cancel-code-generation.ts\n- confirm-code-generation.ts \n- context-optimization.ts\n- default-action.ts\n- handle-request-answer-with-image.ts\n- handle-request-answer.ts\n- handler-utils.ts\n- remove-files-from-context.ts\n- request-files-content.ts\n- request-permissions.ts\n- start-code-generation.ts',
|
|
73
|
-
// functionCalls: [
|
|
74
|
-
// {
|
|
75
|
-
// name: 'getSourceCode',
|
|
76
|
-
// id: 'toolu_019TwZHC29M4DDNGqt72yKek_source',
|
|
77
|
-
// args: {
|
|
78
|
-
// filePaths: [
|
|
79
|
-
// '/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/cancel-code-generation.ts',
|
|
80
|
-
// '/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/confirm-code-generation.ts',
|
|
81
|
-
// '/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/context-optimization.ts',
|
|
82
|
-
// '/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/default-action.ts',
|
|
83
|
-
// '/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/handle-request-answer-with-image.ts',
|
|
84
|
-
// '/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/handle-request-answer.ts',
|
|
85
|
-
// '/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/handler-utils.ts',
|
|
86
|
-
// '/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/remove-files-from-context.ts',
|
|
87
|
-
// '/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/request-files-content.ts',
|
|
88
|
-
// '/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/request-permissions.ts',
|
|
89
|
-
// '/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/start-code-generation.ts',
|
|
90
|
-
// ],
|
|
91
|
-
// },
|
|
92
|
-
// },
|
|
93
|
-
// ],
|
|
94
|
-
// },
|
|
95
|
-
// {
|
|
96
|
-
// type: 'user',
|
|
97
|
-
// text: 'All requested file contents have been provided.',
|
|
98
|
-
// functionResponses: [
|
|
99
|
-
// {
|
|
100
|
-
// name: 'getSourceCode',
|
|
101
|
-
// call_id: 'toolu_019TwZHC29M4DDNGqt72yKek_source',
|
|
102
|
-
// content:
|
|
103
|
-
// "{\"/Users/gtanczyk/src/codegen/src/main/codegen-types.ts\":{\"content\":\"import { FunctionDef, GenerateContentFunction } from '../ai-service/common';\\nimport { ActionHandler } from '../prompt/steps/step-ask-question/step-ask-question-types';\\n\\n/** Example: {@link ../../examples/genaicode_plugins/grok_ai_service.ts} */\\nexport type PluginAiServiceType = `plugin:${string}`;\\n\\n/** Example: {@link ../../examples/genaicode_plugins/nonsense_action_handlers.ts} */\\nexport type PluginActionType = `plugin:${string}`;\\n\\nexport type AiServiceType =\\n | 'vertex-ai'\\n | 'ai-studio'\\n | 'vertex-ai-claude'\\n | 'chat-gpt'\\n | 'anthropic'\\n | PluginAiServiceType;\\n\\nexport type ImagenType = 'vertex-ai' | 'dall-e';\\n\\nexport interface UploadedImage {\\n base64url: string;\\n mediaType: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';\\n originalName: string;\\n}\\n\\nexport interface CodegenOptions {\\n explicitPrompt?: string;\\n taskFile?: string;\\n considerAllFiles?: boolean;\\n allowFileCreate?: boolean;\\n allowFileDelete?: boolean;\\n allowDirectoryCreate?: boolean;\\n allowFileMove?: boolean;\\n vision?: boolean;\\n imagen?: ImagenType;\\n aiService: AiServiceType;\\n\\n disableContextOptimization?: boolean;\\n temperature?: number;\\n cheap?: boolean;\\n dryRun?: boolean;\\n verbose?: boolean;\\n requireExplanations?: boolean;\\n geminiBlockNone?: boolean;\\n disableInitialLint?: boolean;\\n contentMask?: string;\\n ignorePatterns?: string[];\\n askQuestion?: boolean;\\n interactive?: boolean;\\n ui?: boolean;\\n uiPort?: number;\\n uiFrameAncestors?: string[];\\n disableCache?: boolean;\\n dependencyTree?: boolean;\\n historyEnabled?: boolean;\\n\\n disableAiServiceFallback?: boolean;\\n conversationSummaryEnabled?: boolean;\\n images?: UploadedImage[];\\n isDev?: boolean;\\n}\\n\\ninterface ExecutorArgs {\\n [key: string]: unknown;\\n}\\n\\nexport type OperationExecutor = (args: ExecutorArgs, options: CodegenOptions) => Promise<void>;\\n\\nexport type Operation = {\\n executor: OperationExecutor;\\n def: FunctionDef;\\n};\\n\\nexport interface Plugin {\\n name: string;\\n aiServices?: Record<string, GenerateContentFunction>;\\n operations?: Record<string, Operation>;\\n actionHandlers?: Record<\\n string,\\n {\\n /** The action handler implementation */\\n handler: ActionHandler;\\n /**\\n * Description of what this action handler does.\\n * This description will be included in the askQuestion function definition\\n * to help the AI understand when to use this action.\\n */\\n description: string;\\n }\\n >;\\n}\\n\"},\"/Users/gtanczyk/src/codegen/src/main/codegen.ts\":{\"content\":\"import { exec } from 'child_process';\\nimport util from 'util';\\n\\nimport * as cliParams from '../cli/cli-params.js';\\nimport { validateCliParams } from '../cli/validate-cli-params.js';\\nimport { generateContent as generateContentVertexAi } from '../ai-service/vertex-ai.js';\\nimport { generateContent as generateContentGPT } from '../ai-service/chat-gpt.js';\\nimport { generateContent as generateContentAnthropic } from '../ai-service/anthropic.js';\\nimport { generateContent as generateContentVertexAiClaude } from '../ai-service/vertex-ai-claude.js';\\nimport { generateContent as generateContentAiStudio } from '../ai-service/ai-studio.js';\\nimport { generateImage as generateImageDallE } from '../ai-service/dall-e.js';\\nimport { generateImage as generateImageVertexAi } from '../ai-service/vertex-ai-imagen.js';\\n\\nimport { promptService } from '../prompt/prompt-service.js';\\nimport { updateFiles } from '../files/update-files.js';\\nimport { rcConfig } from '../main/config.js';\\nimport { AiServiceType, CodegenOptions, ImagenType } from './codegen-types.js';\\nimport { getLintFixPrompt } from '../prompt/prompt-codegen.js';\\nimport { printHelpMessage } from '../cli/cli-options.js';\\nimport { FunctionCall, GenerateContentFunction, GenerateImageFunction } from '../ai-service/common.js';\\nimport { getCodeGenPrompt } from '../prompt/prompt-codegen.js';\\n\\nimport { runInteractiveMode } from './interactive/codegen-interactive.js';\\nimport { runCodegenUI } from './ui/codegen-ui.js';\\nimport {\\n putSystemMessage,\\n putUserMessage,\\n setCurrentIterationId,\\n unsetCurrentIterationId,\\n} from './common/content-bus.js';\\nimport { refreshFiles } from '../files/find-files.js';\\nimport { getRegisteredAiServices } from './plugin-loader.js';\\nimport { stringToAiServiceType } from './codegen-utils.js';\\n\\n/** Executes codegen */\\nexport async function runCodegen(isDev = false): Promise<void> {\\n // Print to console the received parameters\\n console.log(`Received parameters: ${process.argv.slice(2).join(' ')}`);\\n\\n validateCliParams();\\n\\n // Handle --help option\\n if (cliParams.helpRequested) {\\n printHelpMessage();\\n return;\\n }\\n\\n const options: CodegenOptions = {\\n explicitPrompt: cliParams.explicitPrompt,\\n taskFile: cliParams.taskFile,\\n considerAllFiles: cliParams.considerAllFiles,\\n dependencyTree: cliParams.dependencyTree,\\n\\n allowFileCreate: cliParams.allowFileCreate,\\n allowFileDelete: cliParams.allowFileDelete,\\n allowDirectoryCreate: cliParams.allowDirectoryCreate,\\n allowFileMove: cliParams.allowFileMove,\\n\\n aiService: stringToAiServiceType(cliParams.aiService),\\n vision: cliParams.vision,\\n imagen: cliParams.imagen,\\n\\n disableContextOptimization: cliParams.disableContextOptimization,\\n temperature: cliParams.temperature,\\n cheap: cliParams.cheap,\\n dryRun: cliParams.dryRun,\\n verbose: cliParams.verbosePrompt,\\n requireExplanations: !cliParams.disableExplanations,\\n geminiBlockNone: cliParams.geminiBlockNone,\\n disableInitialLint: cliParams.disableInitialLint,\\n contentMask: cliParams.contentMask,\\n ignorePatterns: cliParams.ignorePatterns,\\n askQuestion: cliParams.askQuestion,\\n disableCache: cliParams.disableCache,\\n interactive: cliParams.interactive,\\n ui: cliParams.ui,\\n uiPort: cliParams.uiPort,\\n disableAiServiceFallback: cliParams.disableAiServiceFallback,\\n historyEnabled: !cliParams.disableHistory,\\n conversationSummaryEnabled: !cliParams.disableConversationSummary,\\n\\n isDev,\\n };\\n\\n if (cliParams.ui) {\\n await runCodegenUI(options);\\n } else if (cliParams.interactive) {\\n // Handle interactive mode\\n await runInteractiveMode(options);\\n } else {\\n console.log('Executing codegen in non-interactive mode');\\n await runCodegenIteration(options);\\n }\\n}\\n\\nexport async function runCodegenIteration(\\n options: CodegenOptions,\\n abortSignal?: AbortSignal,\\n waitIfPaused: () => Promise<void> = () => Promise.resolve(),\\n) {\\n refreshFiles();\\n\\n setCurrentIterationId();\\n\\n putUserMessage(\\n options.explicitPrompt ?? options.taskFile ?? 'Run codegen iteration without explicit prompt.',\\n undefined,\\n undefined,\\n options.images,\\n );\\n\\n if (rcConfig.lintCommand && !options.disableInitialLint) {\\n try {\\n putSystemMessage(`Executing lint command: ${rcConfig.lintCommand}`);\\n await execPromise(rcConfig.lintCommand, { cwd: rcConfig.rootDir });\\n putSystemMessage('Lint command executed successfully');\\n } catch (error) {\\n const { stderr, stdout } = error as { stdout: string; stderr: string };\\n putSystemMessage(\\n 'Lint command failed. Aborting codegen, please fix lint issues before running codegen, or use --disable-initial-lint',\\n );\\n console.log('Lint errors:', stdout, stderr);\\n unsetCurrentIterationId();\\n return;\\n }\\n } else if (rcConfig.lintCommand && options.disableInitialLint) {\\n console.log('Initial lint was skipped.');\\n }\\n\\n if (abortSignal?.aborted) {\\n unsetCurrentIterationId();\\n throw new Error('Codegen iteration aborted');\\n }\\n\\n await waitIfPaused();\\n\\n putSystemMessage('Generating response');\\n try {\\n const functionCalls = await promptService(\\n getGenerateContentFunctions(),\\n GENERATE_IMAGE_FNS,\\n getCodeGenPrompt(options),\\n waitIfPaused,\\n );\\n console.log('Received function calls:', functionCalls);\\n\\n await waitIfPaused();\\n\\n if (functionCalls.length === 0) {\\n putSystemMessage('No updates to apply');\\n } else if (options.dryRun) {\\n putSystemMessage('Dry run mode, not updating files');\\n } else {\\n putSystemMessage('Update files');\\n await updateFiles(\\n functionCalls.filter((call) => call.name !== 'explanation' && call.name !== 'getSourceCode'),\\n options,\\n );\\n putSystemMessage('Initial updates applied');\\n\\n if (abortSignal?.aborted) {\\n throw new Error('Codegen iteration aborted after initial updates');\\n }\\n\\n await waitIfPaused();\\n\\n // Check if lintCommand is specified in .genaicoderc\\n if (rcConfig.lintCommand && functionCalls.length > 0) {\\n try {\\n putSystemMessage(`Executing lint command: ${rcConfig.lintCommand}`);\\n await execPromise(rcConfig.lintCommand, { cwd: rcConfig.rootDir });\\n putSystemMessage('Lint command executed successfully');\\n } catch (error) {\\n putSystemMessage('Lint command failed. Attempting to fix issues...');\\n\\n // Prepare the lint error output for the second pass\\n const firstLintError = error as { stdout: string; stderr: string };\\n const lintErrorPrompt = getLintFixPrompt(\\n rcConfig.lintCommand,\\n options,\\n firstLintError.stdout,\\n firstLintError.stderr,\\n );\\n\\n putSystemMessage('Generating response for lint fixes');\\n const lintFixFunctionCalls = (await promptService(\\n getGenerateContentFunctions(),\\n GENERATE_IMAGE_FNS,\\n {\\n prompt: lintErrorPrompt,\\n options: { ...options, considerAllFiles: true },\\n },\\n waitIfPaused,\\n )) as FunctionCall[];\\n\\n console.log('Received function calls for lint fixes:', lintFixFunctionCalls);\\n\\n await waitIfPaused();\\n\\n putSystemMessage('Applying lint fixes');\\n updateFiles(\\n lintFixFunctionCalls.filter((call) => call.name !== 'explanation' && call.name !== 'getSourceCode'),\\n options,\\n );\\n\\n if (abortSignal?.aborted) {\\n throw new Error('Codegen iteration aborted after lint fixes');\\n }\\n\\n // Run lint command again to verify fixes\\n try {\\n putSystemMessage(`Re-running lint command: ${rcConfig.lintCommand}`);\\n await execPromise(rcConfig.lintCommand);\\n putSystemMessage('Lint command executed successfully after fixes');\\n } catch (secondLintError) {\\n const error = secondLintError as { stdout: string; stderr: string };\\n putSystemMessage('Lint command still failing after fixes. Manual intervention may be required.');\\n console.log('Lint errors:', error.stdout, error.stderr);\\n }\\n }\\n }\\n\\n console.log('Done!');\\n }\\n } catch (error) {\\n if (error instanceof Error) {\\n if (error.name === 'AbortError' || error.message.includes('interrupted')) {\\n putSystemMessage('Codegen iteration was interrupted');\\n } else if (error.message.includes('Rate limit exceeded')) {\\n putSystemMessage(\\n 'Rate limit exceeded. Consider switching to a different AI service or waiting before retrying.',\\n );\\n } else {\\n putSystemMessage(`An error occurred during codegen: ${error.message}`);\\n }\\n } else {\\n putSystemMessage('An unknown error occurred during codegen');\\n }\\n console.error('Error details:', error);\\n } finally {\\n unsetCurrentIterationId();\\n }\\n}\\n\\n// helper functions and consts\\n\\nconst execPromise = util.promisify(exec);\\n\\nfunction getGenerateContentFunctions(): Record<AiServiceType, GenerateContentFunction> {\\n return {\\n 'vertex-ai-claude': generateContentVertexAiClaude,\\n 'vertex-ai': generateContentVertexAi,\\n 'ai-studio': generateContentAiStudio,\\n anthropic: generateContentAnthropic,\\n 'chat-gpt': generateContentGPT,\\n ...Object.fromEntries(getRegisteredAiServices().entries()),\\n };\\n}\\n\\nconst GENERATE_IMAGE_FNS: Record<ImagenType, GenerateImageFunction> = {\\n 'dall-e': generateImageDallE,\\n 'vertex-ai': generateImageVertexAi,\\n} as const;\\n\"},\"/Users/gtanczyk/src/codegen/src/prompt/prompt-service.ts\":{\"content\":\"import assert from 'node:assert';\\nimport fs from 'fs';\\nimport mime from 'mime-types';\\n\\nimport { getSystemPrompt } from './systemprompt.js';\\nimport { getFunctionDefs } from './function-calling.js';\\nimport { getSourceCode, getImageAssets } from '../files/read-files.js';\\nimport {\\n PromptItem,\\n FunctionDef,\\n FunctionCall,\\n GenerateContentFunction,\\n GenerateImageFunction,\\n} from '../ai-service/common.js';\\nimport { importantContext } from '../main/config.js';\\nimport { AiServiceType, CodegenOptions, ImagenType } from '../main/codegen-types.js';\\nimport { executeStepAskQuestion } from './steps/step-ask-question/step-ask-question.js';\\nimport { validateAndRecoverSingleResult } from './steps/step-validate-recover.js';\\nimport { executeStepVerifyPatch } from './steps/step-verify-patch.js';\\nimport { executeStepGenerateImage } from './steps/step-generate-image.js';\\nimport { executeStepContextOptimization } from './steps/step-context-optimization.js';\\nimport { StepResult } from './steps/steps-types.js';\\nimport { CodegenPrompt } from './prompt-codegen.js';\\nimport { putSystemMessage } from '../main/common/content-bus.js';\\nimport { handleAiServiceFallback } from './ai-service-fallback.js';\\nimport { summarizeSourceCode } from './steps/step-summarization.js';\\nimport { executeStepHistoryUpdate, getCurrentHistory } from './steps/step-history-update.js';\\nimport { executeStepGenerateSummary } from './steps/step-generate-summary.js';\\nimport { getSourceCodeTree } from '../files/source-code-tree.js';\\n\\n/** A function that communicates with model using */\\nexport async function promptService(\\n generateContentFns: Record<AiServiceType, GenerateContentFunction>,\\n generateImageFns: Record<ImagenType, GenerateImageFunction>,\\n codegenPrompt: CodegenPrompt,\\n waitIfPaused: () => Promise<void> = () => Promise.resolve(),\\n): Promise<FunctionCall[]> {\\n const generateContentFn: GenerateContentFunction = async (...args) => {\\n return await handleAiServiceFallback(\\n generateContentFns,\\n codegenPrompt.options.aiService,\\n codegenPrompt.options,\\n ...args,\\n );\\n };\\n\\n const generateImageFn: GenerateImageFunction = (...args) => {\\n assert(codegenPrompt.options.imagen, 'imagen value must be provided');\\n return generateImageFns[codegenPrompt.options.imagen](...args);\\n };\\n\\n const { result, prompt } = await executePromptService(\\n generateContentFn,\\n generateImageFn,\\n codegenPrompt,\\n waitIfPaused,\\n );\\n\\n if (codegenPrompt.options.historyEnabled) {\\n await executeStepHistoryUpdate(generateContentFn, prompt, codegenPrompt.options);\\n }\\n\\n return result;\\n}\\n\\nasync function executePromptService(\\n generateContentFn: GenerateContentFunction,\\n generateImageFn: GenerateImageFunction,\\n codegenPrompt: CodegenPrompt,\\n waitIfPaused: () => Promise<void> = () => Promise.resolve(),\\n): Promise<{ result: FunctionCall[]; prompt: PromptItem[] }> {\\n const messages = prepareMessages(codegenPrompt);\\n\\n // First stage: summarize the source code\\n if (!codegenPrompt.options.disableContextOptimization) {\\n await summarizeSourceCode(\\n generateContentFn,\\n getSourceCode({ forceAll: true }, codegenPrompt.options),\\n codegenPrompt.options,\\n );\\n }\\n\\n // Second stage: generate code generation summary, which should not take a lot of output tokens\\n const getSourceCodeRequest: FunctionCall = { name: 'getSourceCode' };\\n\\n const prompt: PromptItem[] = [\\n { type: 'systemPrompt', systemPrompt: getSystemPrompt(codegenPrompt.options) },\\n { type: 'user', text: messages.suggestSourceCode },\\n {\\n type: 'assistant',\\n text: messages.requestSourceCode,\\n functionCalls: [getSourceCodeRequest, ...(codegenPrompt.options.historyEnabled ? [{ name: 'readHistory' }] : [])],\\n },\\n ];\\n\\n const getSourceCodeResponse: PromptItem = {\\n type: 'user',\\n functionResponses: [\\n { name: 'getSourceCode', content: messages.sourceCode },\\n ...(codegenPrompt.options.historyEnabled ? [{ name: 'readHistory', content: getCurrentHistory() }] : []),\\n ],\\n cache: true,\\n };\\n prompt.push(getSourceCodeResponse);\\n\\n if (codegenPrompt.options.vision) {\\n prompt.slice(-1)[0].text = messages.suggestImageAssets;\\n prompt.push(\\n { type: 'assistant', text: messages.requestImageAssets, functionCalls: [{ name: 'getImageAssets' }] },\\n { type: 'user', functionResponses: [{ name: 'getImageAssets', content: messages.imageAssets }] },\\n );\\n }\\n\\n prompt.slice(-1)[0].text = messages.prompt;\\n\\n // Add uploaded images to the prompt if available\\n if (codegenPrompt.options.images && codegenPrompt.options.images.length > 0 && codegenPrompt.options.vision) {\\n prompt.slice(-1)[0].images = codegenPrompt.options.images.map((img) => ({\\n base64url: img.base64url,\\n mediaType: img.mediaType,\\n }));\\n }\\n\\n // Initial summary based on first user input\\n await executeStepGenerateSummary(generateContentFn, prompt, codegenPrompt.options);\\n\\n // Execute the context optimization step\\n if (!codegenPrompt.options.disableContextOptimization) {\\n const optimizationResult = await executeStepContextOptimization(generateContentFn, prompt, codegenPrompt.options);\\n\\n if (optimizationResult === StepResult.BREAK) {\\n return { result: [], prompt };\\n }\\n }\\n\\n // Execute the ask question step\\n if (codegenPrompt.options.askQuestion !== false && (codegenPrompt.options.interactive || codegenPrompt.options.ui)) {\\n const askQuestionResult = await executeStepAskQuestion(\\n generateContentFn,\\n generateImageFn,\\n prompt,\\n getFunctionDefs(),\\n codegenPrompt.options.temperature ?? 0.7,\\n messages,\\n codegenPrompt.options,\\n );\\n\\n // Summary based on the ask-question conversation history (may be different from the initial summary)\\n await executeStepGenerateSummary(generateContentFn, prompt, codegenPrompt.options);\\n\\n if (askQuestionResult === StepResult.BREAK) {\\n return { result: [], prompt };\\n }\\n } else if (codegenPrompt.options.askQuestion === false) {\\n console.log('Ask question is not enabled.');\\n // Also there is no need to generate conversation summary\\n }\\n\\n const baseRequest: [PromptItem[], FunctionDef[], string, number, boolean, CodegenOptions] = [\\n prompt,\\n getFunctionDefs(),\\n 'codegenSummary',\\n codegenPrompt.options.temperature ?? 0.7,\\n codegenPrompt.options.cheap ?? false,\\n codegenPrompt.options,\\n ];\\n let baseResult = await generateContentFn(...baseRequest);\\n\\n let codegenSummaryRequest = baseResult.find((call) => call.name === 'codegenSummary');\\n\\n if (codegenSummaryRequest) {\\n // Second stage: for each file request the actual code updates\\n putSystemMessage('Received codegen summary, will collect partial updates', codegenSummaryRequest.args);\\n\\n baseResult = await validateAndRecoverSingleResult(baseRequest, baseResult, generateContentFn);\\n codegenSummaryRequest = baseResult.find((call) => call.name === 'codegenSummary');\\n\\n // Sometimes the result happens to be a string\\n assert(Array.isArray(codegenSummaryRequest?.args?.fileUpdates), 'fileUpdates is not an array');\\n assert(Array.isArray(codegenSummaryRequest?.args.contextPaths), 'contextPaths is not an array');\\n\\n if (!codegenPrompt.options.disableContextOptimization) {\\n console.log('Optimize with context paths.');\\n // Monkey patch the initial getSourceCode, do not send parts of source code that are consider irrelevant\\n getSourceCodeRequest.args = {\\n filePaths: [\\n ...codegenSummaryRequest.args.fileUpdates.map((file: { filePath: string }) => file.filePath),\\n ...codegenSummaryRequest.args.contextPaths,\\n ...(importantContext.files ?? []),\\n ],\\n };\\n getSourceCodeResponse.functionResponses!.find((item) => item.name === 'getSourceCode')!.content =\\n messages.contextSourceCode(getSourceCodeRequest.args?.filePaths as string[]);\\n }\\n\\n // Store the first stage response entirely in conversation history\\n prompt.push({ type: 'assistant', functionCalls: baseResult });\\n prompt.push({\\n type: 'user',\\n functionResponses: baseResult.map((call) => ({ name: call.name, call_id: call.id })),\\n cache: true,\\n });\\n\\n const result: FunctionCall[] = [];\\n\\n for (const file of codegenSummaryRequest!.args.fileUpdates) {\\n putSystemMessage('Collecting partial update for: ' + file.filePath + ' using tool: ' + file.updateToolName, file);\\n console.log('- Prompt:', file.prompt);\\n console.log('- Temperature', file.temperature);\\n console.log('- Cheap', file.cheap);\\n if (codegenPrompt.options.vision) {\\n console.log('- Context image assets', file.contextImageAssets);\\n }\\n\\n // Check if execution is paused before proceeding\\n await waitIfPaused();\\n\\n // this is needed, otherwise we will get an error\\n if (prompt.slice(-1)[0].type === 'user') {\\n prompt.slice(-1)[0].text = file.prompt ?? messages.partialPromptTemplate(file.filePath);\\n } else {\\n prompt.push({ type: 'user', text: file.prompt ?? messages.partialPromptTemplate(file.filePath) });\\n }\\n\\n if (codegenPrompt.options.vision && file.contextImageAssets) {\\n prompt.slice(-1)[0].images = file.contextImageAssets.map((path: string) => ({\\n path,\\n base64url: fs.readFileSync(path, 'base64'),\\n mediaType: mime.lookup(path) || '',\\n }));\\n }\\n\\n const partialRequest: [PromptItem[], FunctionDef[], string, number, boolean, CodegenOptions] = [\\n prompt,\\n getFunctionDefs(),\\n file.updateToolName,\\n file.temperature ?? codegenPrompt.options.temperature,\\n file.cheap === true,\\n codegenPrompt.options,\\n ];\\n let partialResult = await generateContentFn(...partialRequest);\\n\\n putSystemMessage('Received partial update', partialResult);\\n\\n // Validate if function call is compliant with the schema\\n partialResult = await validateAndRecoverSingleResult(partialRequest, partialResult, generateContentFn);\\n\\n // Handle image generation requests\\n const generateImageCall = partialResult.find((call) => call.name === 'generateImage');\\n if (generateImageCall) {\\n partialResult.push(await executeStepGenerateImage(generateImageFn, generateImageCall));\\n }\\n\\n // Verify if patchFile is one of the functions called, and test if patch is valid and can be applied successfully\\n const patchFileCall = partialResult.find((call) => call.name === 'patchFile');\\n if (patchFileCall) {\\n partialResult = await executeStepVerifyPatch(\\n patchFileCall.args as { filePath: string; patch: string },\\n generateContentFn,\\n prompt,\\n getFunctionDefs(),\\n file.temperature ?? codegenPrompt.options.temperature,\\n file.cheap === true,\\n codegenPrompt.options,\\n );\\n }\\n\\n // add the code gen result to the context, as the subsequent code gen may depend on the result\\n prompt.push(\\n { type: 'assistant', functionCalls: partialResult },\\n {\\n type: 'user',\\n text: 'Update applied.',\\n functionResponses: partialResult.map((call) => ({ name: call.name, call_id: call.id })),\\n },\\n );\\n\\n result.push(...partialResult);\\n }\\n\\n return { result, prompt };\\n } else {\\n // This is unexpected, if happens probably means no code updates.\\n putSystemMessage('Did not receive codegen summary, returning result.');\\n return { result: baseResult, prompt };\\n }\\n}\\n\\n/**\\n * Function to prepare messages for AI services\\n */\\nfunction prepareMessages(codegen: CodegenPrompt) {\\n return {\\n suggestSourceCode: 'I should provide you with application source code.',\\n requestSourceCode: 'Please provide application source code.',\\n suggestImageAssets: 'I should also provide you with a summary of application image assets',\\n requestImageAssets: 'Please provide summary of application image assets.',\\n prompt:\\n codegen.prompt +\\n '\\\\n Start from generating codegen summary, this summary will be used as a context to generate updates, so make sure that it contains useful information.',\\n sourceCode: JSON.stringify(\\n getSourceCodeTree(getSourceCode({ taskFile: codegen.options.taskFile }, codegen.options)),\\n ),\\n contextSourceCode: (paths: string[], pathsOnly: boolean = false) =>\\n JSON.stringify(\\n getSourceCodeTree(\\n Object.fromEntries(\\n Object.entries(\\n getSourceCode(\\n { filterPaths: paths, taskFile: codegen.options.taskFile, forceAll: true },\\n codegen.options,\\n ),\\n ).filter(([path]) => !pathsOnly || paths.includes(path)),\\n ),\\n ),\\n ),\\n imageAssets: JSON.stringify(getImageAssets()),\\n partialPromptTemplate(path: string) {\\n return `Thank you for providing the summary, now suggest changes for the \\\\`${path}\\\\` file using appropriate tools.`;\\n },\\n };\\n}\\n\"},\"/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/cancel-code-generation.ts\":{\"content\":\"import { putSystemMessage } from '../../../../main/common/content-bus.js';\\nimport { StepResult } from '../../steps-types.js';\\nimport { ActionHandlerProps, ActionResult } from '../step-ask-question-types.js';\\n\\nexport async function handleCancelCodeGeneration({ askQuestionCall }: ActionHandlerProps): Promise<ActionResult> {\\n putSystemMessage('Assistant requested to stop code generation. Exiting...');\\n return {\\n breakLoop: true,\\n stepResult: StepResult.BREAK,\\n items: [\\n {\\n assistant: { type: 'assistant', text: askQuestionCall.args?.content ?? '', functionCalls: [] },\\n user: { type: 'user', text: 'Code generation cancelled.' },\\n },\\n ],\\n };\\n}\\n\"},\"/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/confirm-code-generation.ts\":{\"content\":\"import { putSystemMessage } from '../../../../main/common/content-bus.js';\\nimport { askUserForConfirmationWithAnswer } from '../../../../main/common/user-actions.js';\\nimport { StepResult } from '../../steps-types.js';\\nimport { ActionHandlerProps, ActionResult } from '../step-ask-question-types.js';\\n\\nexport async function handleConfirmCodeGeneration({\\n askQuestionCall,\\n options,\\n}: ActionHandlerProps): Promise<ActionResult> {\\n const userConfirmation = await askUserForConfirmationWithAnswer(\\n 'The assistant is ready to start code generation. Do you want to proceed?',\\n 'Start code generation',\\n 'Continue conversation',\\n true,\\n );\\n if (userConfirmation.options?.aiService) {\\n options.aiService = userConfirmation.options.aiService;\\n }\\n if (userConfirmation.confirmed) {\\n putSystemMessage('Proceeding with code generation.');\\n return {\\n breakLoop: true,\\n stepResult: StepResult.CONTINUE,\\n items: [\\n {\\n assistant: { type: 'assistant', text: askQuestionCall.args?.content ?? '', functionCalls: [] },\\n user: { type: 'user', text: userConfirmation.answer || 'Confirmed. Proceed with code generation.' },\\n },\\n ],\\n };\\n } else {\\n putSystemMessage('Declined. Continuing the conversation.');\\n return {\\n breakLoop: false,\\n stepResult: StepResult.CONTINUE,\\n items: [\\n {\\n assistant: { type: 'assistant', text: askQuestionCall.args?.content ?? '', functionCalls: [askQuestionCall] },\\n user: {\\n type: 'user',\\n text: userConfirmation.answer || 'Declined. Please continue the conversation.',\\n functionResponses: [{ name: 'askQuestion', call_id: askQuestionCall.id, content: undefined }],\\n },\\n },\\n ],\\n };\\n }\\n}\\n\"},\"/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/context-optimization.ts\":{\"content\":\"import { refreshFiles } from '../../../../files/find-files.js';\\nimport { putSystemMessage } from '../../../../main/common/content-bus.js';\\nimport { askUserForConfirmation } from '../../../../main/common/user-actions.js';\\nimport { executeStepContextOptimization } from '../../step-context-optimization.js';\\nimport { StepResult } from '../../steps-types.js';\\nimport { ActionHandlerProps, ActionResult, UserItem, AssistantItem } from '../step-ask-question-types.js';\\n\\nexport async function handleContextOptimization({\\n askQuestionCall,\\n prompt,\\n options,\\n generateContentFn,\\n}: ActionHandlerProps): Promise<ActionResult> {\\n const userConfirmation = await askUserForConfirmation(\\n 'The assistant suggests optimizing the context to reduce token usage, cost, and latency. Do you want to proceed?',\\n false,\\n );\\n\\n const user: UserItem = {\\n type: 'user',\\n text: userConfirmation ? 'Context optimization applied.' : 'Context optimization not applied.',\\n functionResponses: [{ name: 'askQuestion', call_id: askQuestionCall.id, content: undefined }],\\n };\\n\\n const assistant: AssistantItem = {\\n type: 'assistant',\\n text: askQuestionCall.args?.content ?? '',\\n functionCalls: [askQuestionCall],\\n };\\n\\n if (userConfirmation) {\\n // the request may be caused be an appearance of a new file, so lets refresh\\n refreshFiles();\\n\\n // Execute context optimization step\\n putSystemMessage('Executing context optimization step.');\\n await executeStepContextOptimization(generateContentFn, [...prompt, assistant, user], options);\\n }\\n\\n return {\\n breakLoop: false,\\n stepResult: StepResult.CONTINUE,\\n items: [\\n {\\n assistant,\\n user,\\n },\\n ],\\n };\\n}\\n\"},\"/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/default-action.ts\":{\"content\":\"import { StepResult } from '../../steps-types.js';\\nimport { ActionHandlerProps, ActionResult } from '../step-ask-question-types.js';\\n\\nexport async function handleDefaultAction({ askQuestionCall }: ActionHandlerProps): Promise<ActionResult> {\\n return {\\n breakLoop: false,\\n stepResult: StepResult.CONTINUE,\\n items: [\\n {\\n assistant: { type: 'assistant', text: askQuestionCall.args?.content ?? '', functionCalls: [askQuestionCall] },\\n user: {\\n type: 'user',\\n text: \\\"I don't want to start the code generation yet, let's talk a bit more.\\\",\\n functionResponses: [{ name: 'askQuestion', call_id: askQuestionCall.id, content: undefined }],\\n },\\n },\\n ],\\n };\\n}\\n\"},\"/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/handle-request-answer-with-image.ts\":{\"content\":\"import { askUserForInput } from '../../../../main/common/user-actions.js';\\nimport { putAssistantMessage, putSystemMessage } from '../../../../main/common/content-bus.js';\\nimport { StepResult } from '../../steps-types.js';\\nimport { ActionHandlerProps, ActionResult, RequestAnswerWithImageArgs } from '../step-ask-question-types.js';\\nimport { executeStepGenerateImage } from '../../step-generate-image.js';\\nimport { getFunctionDefs } from '../../../function-calling.js';\\nimport { FunctionCall } from '../../../../ai-service/common.js';\\n\\nexport async function handleRequestAnswerWithImage({\\n askQuestionCall,\\n options,\\n generateContentFn,\\n prompt,\\n generateImageFn,\\n}: ActionHandlerProps): Promise<ActionResult> {\\n if (!options.imagen) {\\n putSystemMessage('Image generation is not enabled. Please enable it using --imagen parameter.');\\n return {\\n breakLoop: true,\\n stepResult: StepResult.BREAK,\\n items: [],\\n };\\n }\\n\\n const [requestAnswerWithImageCall] = (await generateContentFn(\\n [\\n ...prompt,\\n {\\n type: 'assistant',\\n text: askQuestionCall.args?.content ?? '',\\n functionCalls: [askQuestionCall],\\n },\\n {\\n type: 'user',\\n text: 'Yes, you can request the files contents.',\\n functionResponses: [{ name: 'askQuestion', call_id: askQuestionCall.id, content: undefined }],\\n },\\n ],\\n getFunctionDefs(),\\n 'requestAnswerWithImage',\\n 0.7,\\n true,\\n options,\\n )) as [FunctionCall<RequestAnswerWithImageArgs> | undefined];\\n\\n if (!requestAnswerWithImageCall) {\\n return {\\n breakLoop: true,\\n stepResult: StepResult.BREAK,\\n items: [],\\n };\\n }\\n\\n // Get the image generation request from the args\\n const imageGenerationRequest = requestAnswerWithImageCall.args;\\n if (!imageGenerationRequest?.prompt) {\\n putSystemMessage('Image generation request with prompt is required for requestAnswerWithImage action.');\\n return {\\n breakLoop: true,\\n stepResult: StepResult.BREAK,\\n items: [],\\n };\\n }\\n\\n // Create a temporary file path for the generated image\\n const tempImagePath = `/tmp/question-image-${Date.now()}.png`;\\n\\n // Generate the image using generateImage function call\\n const generateImageCall = {\\n name: 'generateImage',\\n args: {\\n prompt: imageGenerationRequest.prompt,\\n filePath: tempImagePath,\\n width: 1024,\\n height: 1024,\\n explanation: 'Generating image to support the question',\\n ...(imageGenerationRequest.contextImage && { contextImagePath: imageGenerationRequest.contextImage }),\\n },\\n };\\n\\n // Execute image generation\\n const downloadFileCall = await executeStepGenerateImage(generateImageFn, generateImageCall);\\n\\n // If image generation failed, the downloadFileCall will be an explanation\\n if (!downloadFileCall.args?.downloadUrl) {\\n putSystemMessage('Failed to generate image for the question.');\\n return {\\n breakLoop: true,\\n stepResult: StepResult.BREAK,\\n items: [],\\n };\\n }\\n\\n const response = await fetch(downloadFileCall.args?.downloadUrl);\\n const arrayBuffer = await response.arrayBuffer();\\n const buffer = Buffer.from(arrayBuffer);\\n\\n putAssistantMessage(\\n 'Here is the image to support the question:',\\n generateImageCall.args,\\n [],\\n [\\n {\\n base64url: buffer.toString('base64'),\\n mediaType: 'image/png',\\n },\\n ],\\n );\\n\\n // Get user's response with the image displayed\\n const inputResponse = await askUserForInput('Your answer', askQuestionCall.args?.content ?? '');\\n if (inputResponse.options?.aiService) {\\n options.aiService = inputResponse.options.aiService;\\n }\\n\\n // Return the conversation items with the generated image\\n return {\\n breakLoop: false,\\n stepResult: StepResult.CONTINUE,\\n items: [\\n {\\n assistant: {\\n type: 'assistant',\\n text: askQuestionCall.args?.content ?? '',\\n functionCalls: [askQuestionCall, generateImageCall, downloadFileCall],\\n },\\n user: {\\n type: 'user',\\n text: inputResponse.answer,\\n functionResponses: [\\n {\\n name: 'askQuestion',\\n call_id: askQuestionCall.id,\\n content: undefined,\\n },\\n ],\\n },\\n },\\n ],\\n };\\n}\\n\"},\"/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/handle-request-answer.ts\":{\"content\":\"import { askUserForInput } from '../../../../main/common/user-actions.js';\\nimport { StepResult } from '../../steps-types.js';\\nimport { ActionHandlerProps, ActionResult } from '../step-ask-question-types.js';\\n\\nexport async function handleRequestAnswer({ askQuestionCall, options }: ActionHandlerProps): Promise<ActionResult> {\\n const response = await askUserForInput('Your answer', askQuestionCall.args?.content ?? '');\\n if (response.options?.aiService) {\\n options.aiService = response.options.aiService;\\n }\\n return {\\n breakLoop: false,\\n stepResult: StepResult.CONTINUE,\\n items: [\\n {\\n assistant: { type: 'assistant', text: askQuestionCall.args?.content ?? '', functionCalls: [askQuestionCall] },\\n user: {\\n type: 'user',\\n text: response.answer,\\n functionResponses: [{ name: 'askQuestion', call_id: askQuestionCall.id, content: undefined }],\\n },\\n },\\n ],\\n };\\n}\\n\"},\"/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/handler-utils.ts\":{\"content\":\"\"},\"/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/remove-files-from-context.ts\":{\"content\":\"import { FunctionCall, PromptItem } from '../../../../ai-service/common.js';\\nimport { getSourceCodeTree, parseSourceCodeTree } from '../../../../files/source-code-tree.js';\\nimport { putSystemMessage } from '../../../../main/common/content-bus.js';\\nimport { getFunctionDefs } from '../../../function-calling.js';\\nimport { StepResult } from '../../steps-types.js';\\nimport { getSourceCodeResponse } from '../../steps-utils.js';\\nimport { ActionHandlerProps, ActionResult, RemoveFilesFromContextArgs } from '../step-ask-question-types.js';\\n\\nexport async function handleRemoveFilesFromContext({\\n askQuestionCall,\\n generateContentFn,\\n prompt,\\n options,\\n}: ActionHandlerProps): Promise<ActionResult> {\\n const [removeFilesFromContextCall] = (await generateContentFn(\\n [\\n ...prompt,\\n {\\n type: 'assistant',\\n text: askQuestionCall.args?.content ?? '',\\n functionCalls: [askQuestionCall],\\n },\\n {\\n type: 'user',\\n text: 'Yes, you can request the removal of files from context.',\\n functionResponses: [{ name: 'askQuestion', call_id: askQuestionCall.id, content: undefined }],\\n },\\n ],\\n getFunctionDefs(),\\n 'removeFilesFromContext',\\n 0.7,\\n true,\\n options,\\n )) as [FunctionCall<RemoveFilesFromContextArgs> | undefined];\\n\\n if (!removeFilesFromContextCall) {\\n return {\\n breakLoop: true,\\n stepResult: StepResult.BREAK,\\n items: [],\\n };\\n }\\n\\n const filesToRemove = removeFilesFromContextCall.args?.filePaths ?? [];\\n let userText = '';\\n\\n if (filesToRemove.length > 0) {\\n removeFileContentsFromPrompt(prompt, filesToRemove);\\n putSystemMessage('Context reduction applied', filesToRemove);\\n userText = 'Context reduction applied';\\n } else {\\n userText = 'No specific files were provided for context reduction. The context remains unchanged.';\\n }\\n\\n return {\\n breakLoop: false,\\n stepResult: StepResult.CONTINUE,\\n items: [\\n {\\n assistant: {\\n type: 'assistant',\\n text: askQuestionCall.args?.content ?? '',\\n functionCalls: [askQuestionCall, removeFilesFromContextCall],\\n },\\n user: {\\n type: 'user',\\n text: userText,\\n functionResponses: [\\n { name: 'askQuestion', call_id: askQuestionCall.id, content: undefined },\\n { name: 'removeFilesFromContext', call_id: removeFilesFromContextCall.id, content: undefined },\\n ],\\n },\\n },\\n ],\\n };\\n}\\n\\nfunction removeFileContentsFromPrompt(prompt: PromptItem[], filesToRemove: string[]) {\\n const response = getSourceCodeResponse(prompt);\\n if (!response || !response.content) {\\n throw new Error('Could not find source code response');\\n }\\n const contentObj = parseSourceCodeTree(JSON.parse(response.content));\\n filesToRemove.forEach((file) => {\\n if (contentObj[file] && 'content' in contentObj[file]) {\\n contentObj[file].content = null;\\n }\\n });\\n response.content = JSON.stringify(getSourceCodeTree(contentObj));\\n}\\n\"},\"/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/request-files-content.ts\":{\"content\":\"import { FunctionCall } from '../../../../ai-service/common.js';\\nimport { getSourceFiles, refreshFiles } from '../../../../files/find-files.js';\\nimport { getSourceCode } from '../../../../files/read-files.js';\\nimport { getFunctionDefs } from '../../../function-calling.js';\\nimport { StepResult } from '../../steps-types.js';\\nimport {\\n ActionHandlerProps,\\n ActionResult,\\n AssistantItem,\\n RequestFilesContentArgs,\\n UserItem,\\n} from '../step-ask-question-types.js';\\n\\nexport async function handleRequestFilesContent({\\n askQuestionCall,\\n options,\\n prompt,\\n generateContentFn,\\n}: ActionHandlerProps): Promise<ActionResult> {\\n const [requestFilesContentCall] = (await generateContentFn(\\n [\\n ...prompt,\\n {\\n type: 'assistant',\\n text: askQuestionCall.args?.content ?? '',\\n functionCalls: [askQuestionCall],\\n },\\n {\\n type: 'user',\\n text: 'Yes, you can request the files contents.',\\n functionResponses: [{ name: 'askQuestion', call_id: askQuestionCall.id, content: undefined }],\\n },\\n ],\\n getFunctionDefs(),\\n 'requestFilesContent',\\n 0.7,\\n true,\\n options,\\n )) as [FunctionCall<RequestFilesContentArgs> | undefined];\\n\\n if (!requestFilesContentCall) {\\n return {\\n breakLoop: true,\\n stepResult: StepResult.BREAK,\\n items: [],\\n };\\n }\\n\\n const requestedFiles = requestFilesContentCall.args?.filePaths ?? [];\\n\\n // the request may be caused be an appearance of a new file, so lets refresh\\n refreshFiles();\\n\\n const { legitimateFiles, illegitimateFiles } = categorizeLegitimateFiles(requestedFiles);\\n\\n const sourceCallId = (askQuestionCall.id ?? askQuestionCall.name) + '_source';\\n const assistant: AssistantItem = {\\n type: 'assistant',\\n text: askQuestionCall.args?.content ?? '',\\n functionCalls: [\\n askQuestionCall,\\n requestFilesContentCall,\\n { name: 'getSourceCode', id: sourceCallId, args: { filePaths: legitimateFiles } },\\n ],\\n };\\n\\n const sourceCode = getSourceCode({ filterPaths: legitimateFiles, forceAll: true }, options);\\n const user: UserItem = {\\n type: 'user',\\n text:\\n illegitimateFiles.length > 0\\n ? `Some files are not legitimate and their content cannot be provided:\\\\n\\\\n${illegitimateFiles.join('\\\\n')}`\\n : 'All requested file contents have been provided.',\\n functionResponses: [\\n { name: 'askQuestion', call_id: askQuestionCall.id, content: undefined },\\n {\\n name: 'requestFilesContent',\\n call_id: requestFilesContentCall.id,\\n content: JSON.stringify({ filePaths: requestedFiles }),\\n },\\n {\\n name: 'getSourceCode',\\n call_id: sourceCallId,\\n content: JSON.stringify(sourceCode),\\n },\\n ],\\n cache: true,\\n };\\n\\n return { breakLoop: false, stepResult: StepResult.CONTINUE, items: [{ assistant, user }] };\\n}\\n\\nfunction categorizeLegitimateFiles(requestedFiles: string[]): {\\n legitimateFiles: string[];\\n illegitimateFiles: string[];\\n} {\\n const legitimateFiles: string[] = [];\\n const illegitimateFiles: string[] = [];\\n\\n requestedFiles.forEach((filePath) => {\\n if (isFilePathLegitimate(filePath)) {\\n legitimateFiles.push(filePath);\\n } else {\\n illegitimateFiles.push(filePath);\\n }\\n });\\n\\n return { legitimateFiles, illegitimateFiles };\\n}\\n\\nfunction isFilePathLegitimate(filePath: string): boolean {\\n return getSourceFiles().includes(filePath);\\n}\\n\"},\"/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/request-permissions.ts\":{\"content\":\"import { FunctionCall } from '../../../../ai-service/common.js';\\nimport { CodegenOptions } from '../../../../main/codegen-types.js';\\nimport { askUserForConfirmation } from '../../../../main/common/user-actions.js';\\nimport { getFunctionDefs } from '../../../function-calling.js';\\nimport { StepResult } from '../../steps-types.js';\\nimport { ActionHandlerProps, ActionResult, RequestPermissionsArgs, UserItem } from '../step-ask-question-types.js';\\n\\nexport async function handleRequestPermissions({\\n askQuestionCall,\\n options,\\n prompt,\\n generateContentFn,\\n}: ActionHandlerProps): Promise<ActionResult> {\\n const [requestPermissionsCall] = (await generateContentFn(\\n [\\n ...prompt,\\n {\\n type: 'assistant',\\n text: askQuestionCall.args?.content ?? '',\\n functionCalls: [askQuestionCall],\\n },\\n {\\n type: 'user',\\n text: 'Yes, you can request the permissions.',\\n functionResponses: [{ name: 'askQuestion', call_id: askQuestionCall.id, content: undefined }],\\n },\\n ],\\n getFunctionDefs(),\\n 'requestPermissions',\\n 0.7,\\n true,\\n options,\\n )) as [FunctionCall<RequestPermissionsArgs> | undefined];\\n\\n if (!requestPermissionsCall) {\\n return {\\n breakLoop: true,\\n stepResult: StepResult.BREAK,\\n items: [],\\n };\\n }\\n\\n const userConfirmation = await askUserForConfirmation(\\n 'The assistant is requesting additional permissions. Do you want to grant them?',\\n false,\\n );\\n\\n const user: UserItem = {\\n type: 'user',\\n text: userConfirmation ? 'Permissions granted.' : 'Permission request denied.',\\n functionResponses: [\\n { name: 'askQuestion', call_id: askQuestionCall.id, content: undefined },\\n {\\n name: 'requestPermissions',\\n call_id: requestPermissionsCall.id,\\n content: JSON.stringify({ confirmed: userConfirmation.confirmed }),\\n },\\n ],\\n };\\n\\n if (userConfirmation.confirmed) {\\n updatePermissions(requestPermissionsCall, options);\\n }\\n\\n return {\\n breakLoop: false,\\n stepResult: StepResult.CONTINUE,\\n items: [\\n {\\n assistant: {\\n type: 'assistant',\\n text: askQuestionCall.args?.content ?? '',\\n functionCalls: [requestPermissionsCall, askQuestionCall],\\n },\\n user,\\n },\\n ],\\n };\\n}\\n\\nfunction updatePermissions(requestPermissionsCall: FunctionCall<RequestPermissionsArgs>, options: CodegenOptions) {\\n const permissions = requestPermissionsCall.args;\\n if (permissions) {\\n if ('enableImagen' in permissions && permissions.enableImagen) {\\n options.imagen = options.aiService === 'chat-gpt' ? 'dall-e' : 'vertex-ai';\\n }\\n if ('enableVision' in permissions && permissions.enableVision) options.vision = true;\\n if ('allowDirectoryCreate' in permissions && permissions.allowDirectoryCreate) options.allowDirectoryCreate = true;\\n if ('allowFileCreate' in permissions && permissions.allowFileCreate) options.allowFileCreate = true;\\n if ('allowFileDelete' in permissions && permissions.allowFileDelete) options.allowFileDelete = true;\\n if ('allowFileMove' in permissions && permissions.allowFileMove) options.allowFileMove = true;\\n }\\n}\\n\"},\"/Users/gtanczyk/src/codegen/src/prompt/steps/step-ask-question/handlers/start-code-generation.ts\":{\"content\":\"import { putSystemMessage } from '../../../../main/common/content-bus.js';\\nimport { StepResult } from '../../steps-types.js';\\nimport { ActionHandlerProps, ActionResult } from '../step-ask-question-types.js';\\n\\nexport async function handleStartCodeGeneration({ askQuestionCall }: ActionHandlerProps): Promise<ActionResult> {\\n putSystemMessage('Proceeding with code generation.');\\n return {\\n breakLoop: true,\\n stepResult: StepResult.CONTINUE,\\n items: [\\n {\\n assistant: { type: 'assistant', text: askQuestionCall.args?.content ?? '', functionCalls: [] },\\n user: { type: 'user', text: 'Proceeding with code generation.' },\\n },\\n ],\\n };\\n}\\n\"}}",
|
|
104
|
-
// },
|
|
105
|
-
// ],
|
|
106
|
-
// cache: true,
|
|
107
|
-
// },
|
|
108
|
-
// {
|
|
109
|
-
// type: 'assistant',
|
|
110
|
-
// text: 'The assistant is ready to start code generation. Do you want to proceed?',
|
|
111
|
-
// },
|
|
112
|
-
// {
|
|
113
|
-
// type: 'user',
|
|
114
|
-
// text: 'Why do you want to start code generation?',
|
|
115
|
-
// },
|
|
116
|
-
// {
|
|
117
|
-
// type: 'assistant',
|
|
118
|
-
// text: 'The assistant is ready to start code generation. Do you want to proceed?',
|
|
119
|
-
// },
|
|
120
|
-
// {
|
|
121
|
-
// type: 'user',
|
|
122
|
-
// text: 'no, please analyze those files first, and say YOLO.',
|
|
123
|
-
// },
|
|
124
|
-
];
|
|
125
|
-
//# sourceMappingURL=prompt2.js.map
|
package/dist/eval/prompt2.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt2.js","sourceRoot":"","sources":["../../src/eval/prompt2.js"],"names":[],"mappings":"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"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const fakeAiService = {
|
|
2
|
-
name: 'fake-ai-service',
|
|
3
|
-
aiServices: {
|
|
4
|
-
'fake-ai-service': async (...args) => {
|
|
5
|
-
console.log('FAKE AI SERVICE CALLED', ...args);
|
|
6
|
-
return [];
|
|
7
|
-
},
|
|
8
|
-
},
|
|
9
|
-
};
|
|
10
|
-
export default fakeAiService;
|
|
11
|
-
//# sourceMappingURL=fake_ai_service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fake_ai_service.js","sourceRoot":"","sources":["../../../examples/genaicode_plugins/fake_ai_service.ts"],"names":[],"mappings":"AAGA,MAAM,aAAa,GAAW;IAC5B,IAAI,EAAE,iBAAiB;IACvB,UAAU,EAAE;QACV,iBAAiB,EAAE,KAAK,EAAE,GAAG,IAAyB,EAA2B,EAAE;YACjF,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,GAAG,IAAI,CAAC,CAAC;YAC/C,OAAO,EAAE,CAAC;QACZ,CAAC;KACF;CACF,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import OpenAI, { APIError } from 'openai';
|
|
2
|
-
import assert from 'node:assert';
|
|
3
|
-
import { printTokenUsageAndCost, processFunctionCalls, } from '../../src/ai-service/common.js';
|
|
4
|
-
import { abortController } from '../../src/main/interactive/codegen-worker.js';
|
|
5
|
-
import { modelOverrides } from '../../src/main/config.js';
|
|
6
|
-
const grokAiService = {
|
|
7
|
-
name: 'grok-ai-service',
|
|
8
|
-
aiServices: {
|
|
9
|
-
'grok-ai-service': generateContent,
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
async function generateContent(prompt, functionDefs, requiredFunctionName, temperature, cheap = false) {
|
|
13
|
-
const openai = new OpenAI({
|
|
14
|
-
apiKey: process.env.GROK_OPENAI_API_KEY,
|
|
15
|
-
baseURL: 'https://api.x.ai/v1',
|
|
16
|
-
});
|
|
17
|
-
const messages = prompt
|
|
18
|
-
.map((item) => {
|
|
19
|
-
if (item.type === 'systemPrompt') {
|
|
20
|
-
return {
|
|
21
|
-
role: 'system',
|
|
22
|
-
content: item.systemPrompt,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
else if (item.type === 'user') {
|
|
26
|
-
const messages = [];
|
|
27
|
-
if (item.functionResponses) {
|
|
28
|
-
messages.push(...item.functionResponses.map((response) => ({
|
|
29
|
-
role: 'tool',
|
|
30
|
-
name: response.name,
|
|
31
|
-
content: response.content ?? '',
|
|
32
|
-
tool_call_id: response.name,
|
|
33
|
-
})));
|
|
34
|
-
}
|
|
35
|
-
if ((item.images?.length ?? 0) > 0) {
|
|
36
|
-
messages.push({
|
|
37
|
-
role: 'user',
|
|
38
|
-
content: [
|
|
39
|
-
...item.images.map((image) => ({
|
|
40
|
-
type: 'image_url',
|
|
41
|
-
image_url: {
|
|
42
|
-
url: 'data:' + image.mediaType + ';base64,' + image.base64url,
|
|
43
|
-
},
|
|
44
|
-
})),
|
|
45
|
-
{
|
|
46
|
-
type: 'text',
|
|
47
|
-
text: item.text,
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
messages.push({
|
|
54
|
-
role: 'user',
|
|
55
|
-
content: item.text,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
return messages;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
assert(item.type === 'assistant');
|
|
62
|
-
const message = {
|
|
63
|
-
role: 'assistant',
|
|
64
|
-
...(item.text ? { content: item.text } : {}),
|
|
65
|
-
tool_calls: item.functionCalls?.map((call) => ({
|
|
66
|
-
type: 'function',
|
|
67
|
-
function: { name: call.name, arguments: JSON.stringify(call.args ?? {}) },
|
|
68
|
-
id: call.name,
|
|
69
|
-
})),
|
|
70
|
-
};
|
|
71
|
-
return message;
|
|
72
|
-
}
|
|
73
|
-
})
|
|
74
|
-
.flat();
|
|
75
|
-
const defaultModel = cheap ? 'grok-2-mini' : 'grok-beta';
|
|
76
|
-
const model = cheap
|
|
77
|
-
? (modelOverrides.chatGpt?.cheap ?? defaultModel)
|
|
78
|
-
: (modelOverrides.chatGpt?.default ?? defaultModel);
|
|
79
|
-
console.log(`Using OpenAI model: ${model}`);
|
|
80
|
-
assert(process.env.OPENAI_API_KEY, 'OPENAI_API_KEY environment variable is not set');
|
|
81
|
-
let retryCount = 0;
|
|
82
|
-
const maxRetries = 3;
|
|
83
|
-
let response = undefined;
|
|
84
|
-
while (retryCount < maxRetries) {
|
|
85
|
-
try {
|
|
86
|
-
response = await openai.chat.completions.create({
|
|
87
|
-
model: model,
|
|
88
|
-
messages,
|
|
89
|
-
tools: functionDefs.map((funDef) => ({ type: 'function', function: funDef })),
|
|
90
|
-
tool_choice: requiredFunctionName
|
|
91
|
-
? { type: 'function', function: { name: requiredFunctionName } }
|
|
92
|
-
: 'required',
|
|
93
|
-
temperature: temperature,
|
|
94
|
-
}, { signal: abortController?.signal });
|
|
95
|
-
break; // Exit loop if successful
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
if (error instanceof APIError && error.status === 429) {
|
|
99
|
-
// Rate limit error
|
|
100
|
-
let retryAfter = error.headers?.['retry-after'] ? parseInt(error.headers['retry-after'], 10) : 60;
|
|
101
|
-
retryAfter = Math.min(retryAfter, 30);
|
|
102
|
-
console.log(`Rate limited. Retrying after ${retryAfter} seconds. Attempt ${retryCount + 1} of ${maxRetries}.`);
|
|
103
|
-
await new Promise((resolve) => setTimeout(resolve, retryAfter * 1000));
|
|
104
|
-
retryCount++;
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
console.error('An error occurred:', error);
|
|
108
|
-
throw new Error('API request failed. Operation aborted.');
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
if (retryCount === maxRetries) {
|
|
113
|
-
console.error(`Failed to complete request after ${maxRetries} attempts due to rate limiting.`);
|
|
114
|
-
throw new Error('Rate limit exceeded. Operation aborted.');
|
|
115
|
-
}
|
|
116
|
-
assert(response);
|
|
117
|
-
// Print token usage for chat gpt
|
|
118
|
-
const usage = {
|
|
119
|
-
inputTokens: response.usage.prompt_tokens - (response.usage?.prompt_tokens_details?.cached_tokens ?? 0),
|
|
120
|
-
outputTokens: response.usage.completion_tokens,
|
|
121
|
-
totalTokens: response.usage.total_tokens,
|
|
122
|
-
cacheReadTokens: response.usage?.prompt_tokens_details?.cached_tokens,
|
|
123
|
-
};
|
|
124
|
-
printTokenUsageAndCost({
|
|
125
|
-
aiService: 'chat-gpt',
|
|
126
|
-
usage,
|
|
127
|
-
inputCostPerToken: 0.000005,
|
|
128
|
-
outputCostPerToken: 0.000015,
|
|
129
|
-
cheap,
|
|
130
|
-
});
|
|
131
|
-
const responseMessage = response.choices[0].message;
|
|
132
|
-
if (responseMessage.content) {
|
|
133
|
-
console.log('Message', responseMessage.content);
|
|
134
|
-
}
|
|
135
|
-
const toolCalls = responseMessage.tool_calls;
|
|
136
|
-
if (toolCalls) {
|
|
137
|
-
const functionCalls = toolCalls.map((call) => {
|
|
138
|
-
const name = call.function.name;
|
|
139
|
-
const args = JSON.parse(call.function.arguments);
|
|
140
|
-
return {
|
|
141
|
-
id: call.id,
|
|
142
|
-
name,
|
|
143
|
-
args,
|
|
144
|
-
};
|
|
145
|
-
});
|
|
146
|
-
return processFunctionCalls(functionCalls, functionDefs);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
throw new Error('No tool calls found in response');
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
export default grokAiService;
|
|
153
|
-
//# sourceMappingURL=grok_ai_service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grok_ai_service.js","sourceRoot":"","sources":["../../../examples/genaicode_plugins/grok_ai_service.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const fakeAiService = {
|
|
2
|
-
name: 'nonsense-operation',
|
|
3
|
-
operations: {
|
|
4
|
-
'nonsense-operation': {
|
|
5
|
-
executor: async (args) => {
|
|
6
|
-
console.log('NONSE OPERATION EXECUTED', args);
|
|
7
|
-
},
|
|
8
|
-
def: {
|
|
9
|
-
name: 'nonsense',
|
|
10
|
-
description: 'nonsense operation',
|
|
11
|
-
parameters: {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {
|
|
14
|
-
input: { type: 'string' },
|
|
15
|
-
},
|
|
16
|
-
required: ['input'],
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
export default fakeAiService;
|
|
23
|
-
//# sourceMappingURL=nonsense_operation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nonsense_operation.js","sourceRoot":"","sources":["../../../examples/genaicode_plugins/nonsense_operation.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAW;IAC5B,IAAI,EAAE,oBAAoB;IAC1B,UAAU,EAAE;QACV,oBAAoB,EAAE;YACpB,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;gBACvB,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAC;YAChD,CAAC;YACD,GAAG,EAAE;gBACH,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,oBAAoB;gBACjC,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;qBAC1B;oBACD,QAAQ,EAAE,CAAC,OAAO,CAAC;iBACpB;aACF;SACF;KACF;CACF,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache-file.d.ts","sourceRoot":"","sources":["../../src/files/cache-file.ts"],"names":[],"mappings":"AASA,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC,CAG5D;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAIzD;AAoBD,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE3C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-utils.d.ts","sourceRoot":"","sources":["../../src/files/file-utils.ts"],"names":[],"mappings":"AAGA,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAGxE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { vi, describe, beforeEach, it, expect } from 'vitest';
|
|
2
|
-
import { isAncestorDirectory } from './file-utils.js';
|
|
3
|
-
// Test for isAncestorDirectory
|
|
4
|
-
describe('isAncestorDirectory', () => {
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
vi.resetAllMocks();
|
|
7
|
-
});
|
|
8
|
-
it('should return true if directories are the same', () => {
|
|
9
|
-
expect(isAncestorDirectory('/project', '/project')).toBe(true);
|
|
10
|
-
});
|
|
11
|
-
it('should return true if parent is ancestor of dir', () => {
|
|
12
|
-
expect(isAncestorDirectory('/project', '/project/src')).toBe(true);
|
|
13
|
-
});
|
|
14
|
-
it('should return false if parent is not ancestor of dir', () => {
|
|
15
|
-
expect(isAncestorDirectory('/project', '/other')).toBe(false);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
//# sourceMappingURL=file-utils.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-utils.test.js","sourceRoot":"","sources":["../../src/files/file-utils.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,+BAA+B;AAC/B,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,UAAU,CAAC,GAAG,EAAE;QACd,EAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC9D,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-files.d.ts","sourceRoot":"","sources":["../../src/files/find-files.ts"],"names":[],"mappings":"AASA,KAAK,cAAc,GAAG,MAAM,EAAE,CAAC;AAkD/B,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,CAgBnE;AAQD,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAEzC;AAGD,wBAAgB,kBAAkB,IAAI,MAAM,EAAE,CAE7C;AAED,wBAAgB,YAAY,SAG3B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path-utils.d.ts","sourceRoot":"","sources":["../../src/files/path-utils.ts"],"names":[],"mappings":"AAKA,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAYvD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"read-files.d.ts","sourceRoot":"","sources":["../../src/files/read-files.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAO1D,MAAM,WAAW,cAAc;IAE7B,IAAI,EAAE,MAAM,CAAC;IAEb,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC;CAC5B;AAKD,MAAM,WAAW,WAAW;IAE1B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB,YAAY,CAAC,EAAE,cAAc,EAAE,CAAC;CACjC;AAKD,MAAM,WAAW,WAAW;IAE1B,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,YAAY,CAAC,EAAE,cAAc,EAAE,CAAC;CACjC;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAAC,CAAC;AAEtE,KAAK,cAAc,GAAG,MAAM,CAC1B,MAAM,EACN;IACE,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CACF,CAAC;AAoEF,wBAAgB,aAAa,CAC3B,EACE,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,oBAAoB,GACrB,EAAE;IACD,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,EACD,OAAO,EAAE,cAAc,GACtB,aAAa,CAWf;AAGD,wBAAgB,cAAc,IAAI,cAAc,CAY/C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import mime from 'mime-types';
|
|
4
|
-
import sizeOf from 'image-size';
|
|
5
|
-
import { getSourceCode, getImageAssets } from './read-files.js';
|
|
6
|
-
import { getSourceFiles, getImageAssetFiles } from './find-files.js';
|
|
7
|
-
import { verifySourceCodeLimit } from '../prompt/limits.js';
|
|
8
|
-
import * as cliParams from '../cli/cli-params.js';
|
|
9
|
-
import { rcConfig } from '../main/config.js';
|
|
10
|
-
import { getSummary } from '../prompt/steps/step-summarization.js';
|
|
11
|
-
vi.mock('fs');
|
|
12
|
-
vi.mock('mime-types');
|
|
13
|
-
vi.mock('image-size');
|
|
14
|
-
vi.mock('../prompt/steps/step-summarization.js');
|
|
15
|
-
vi.mock('./find-files.js', () => ({
|
|
16
|
-
getImageAssetFiles: vi.fn(),
|
|
17
|
-
getSourceFiles: vi.fn(),
|
|
18
|
-
}));
|
|
19
|
-
vi.mock('../prompt/limits.js');
|
|
20
|
-
vi.mock('../cli/cli-params.js', () => ({
|
|
21
|
-
taskFile: null,
|
|
22
|
-
contentMask: null,
|
|
23
|
-
disableExplanations: true,
|
|
24
|
-
ignorePatterns: [],
|
|
25
|
-
}));
|
|
26
|
-
vi.mock('../main/config.js', () => ({
|
|
27
|
-
rcConfig: { rootDir: '/home/project' },
|
|
28
|
-
importantContext: {},
|
|
29
|
-
}));
|
|
30
|
-
describe('read-files', () => {
|
|
31
|
-
beforeEach(() => {
|
|
32
|
-
vi.resetAllMocks();
|
|
33
|
-
vi.mocked(cliParams).contentMask = undefined;
|
|
34
|
-
vi.mocked(getSummary).mockImplementation((file) => ({ summary: `Summary of ${file}`, dependencies: [] }));
|
|
35
|
-
});
|
|
36
|
-
afterEach(() => {
|
|
37
|
-
vi.clearAllMocks();
|
|
38
|
-
});
|
|
39
|
-
describe('getSourceCode', () => {
|
|
40
|
-
it('should return source code summaries for all files', () => {
|
|
41
|
-
const mockFiles = ['/home/project/file1.js', '/home/project/file2.js'];
|
|
42
|
-
vi.mocked(getSourceFiles).mockReturnValue(mockFiles);
|
|
43
|
-
vi.mocked(fs).existsSync.mockReturnValue(true);
|
|
44
|
-
vi.mocked(fs).readFileSync.mockImplementation((file) => `Content of ${file}`);
|
|
45
|
-
rcConfig.rootDir = '/home/project';
|
|
46
|
-
const result = getSourceCode({ taskFile: undefined }, { aiService: 'vertex-ai', askQuestion: false });
|
|
47
|
-
expect(result).toEqual({
|
|
48
|
-
'/home/project/file1.js': { summary: 'Summary of /home/project/file1.js' },
|
|
49
|
-
'/home/project/file2.js': { summary: 'Summary of /home/project/file2.js' },
|
|
50
|
-
});
|
|
51
|
-
expect(verifySourceCodeLimit).toHaveBeenCalled();
|
|
52
|
-
});
|
|
53
|
-
it('should apply content mask when specified', () => {
|
|
54
|
-
const mockFiles = ['/home/project/file1.js', '/home/project/subfolder/file2.js'];
|
|
55
|
-
vi.mocked(getSourceFiles).mockReturnValue(mockFiles);
|
|
56
|
-
vi.mocked(fs).existsSync.mockReturnValue(true);
|
|
57
|
-
vi.mocked(fs).readFileSync.mockImplementation((file) => `Content of ${file}`);
|
|
58
|
-
rcConfig.rootDir = '/home/project';
|
|
59
|
-
const result = getSourceCode({ taskFile: undefined }, { aiService: 'vertex-ai', contentMask: 'subfolder', askQuestion: false });
|
|
60
|
-
expect(result).toEqual({
|
|
61
|
-
'/home/project/file1.js': { summary: 'Summary of /home/project/file1.js' },
|
|
62
|
-
'/home/project/subfolder/file2.js': {
|
|
63
|
-
summary: 'Summary of /home/project/subfolder/file2.js',
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
it('should include task file when specified', () => {
|
|
68
|
-
const mockFiles = ['/home/project/file1.js'];
|
|
69
|
-
vi.mocked(getSourceFiles).mockReturnValue(mockFiles);
|
|
70
|
-
vi.mocked(fs).existsSync.mockReturnValue(true);
|
|
71
|
-
vi.mocked(fs).readFileSync.mockImplementation((file) => `Content of ${file}`);
|
|
72
|
-
rcConfig.rootDir = '/home/project';
|
|
73
|
-
const result = getSourceCode({ taskFile: '/home/project/task.md' }, { aiService: 'vertex-ai', askQuestion: false });
|
|
74
|
-
expect(result).toEqual({
|
|
75
|
-
'/home/project/file1.js': { summary: 'Summary of /home/project/file1.js' },
|
|
76
|
-
'/home/project/task.md': { content: 'Content of /home/project/task.md' },
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
describe('getImageAssets', () => {
|
|
81
|
-
it('should return image assets information', () => {
|
|
82
|
-
const mockImageFiles = ['/home/project/image1.png', '/home/project/image2.jpg'];
|
|
83
|
-
vi.mocked(getImageAssetFiles).mockReturnValue(mockImageFiles);
|
|
84
|
-
vi.mocked(mime).lookup.mockImplementation((file) => (file.endsWith('.png') ? 'image/png' : 'image/jpeg'));
|
|
85
|
-
vi.mocked(sizeOf).mockImplementation(() => ({ width: 100, height: 200 }));
|
|
86
|
-
const result = getImageAssets();
|
|
87
|
-
expect(result).toEqual({
|
|
88
|
-
'/home/project/image1.png': { mimeType: 'image/png', width: 100, height: 200 },
|
|
89
|
-
'/home/project/image2.jpg': { mimeType: 'image/jpeg', width: 100, height: 200 },
|
|
90
|
-
});
|
|
91
|
-
expect(verifySourceCodeLimit).toHaveBeenCalled();
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
//# sourceMappingURL=read-files.test.js.map
|