genaicode 0.5.1 → 0.6.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/README.md +7 -11
- package/dist/ai-service/anthropic.js +7 -2
- package/dist/ai-service/anthropic.js.map +1 -1
- package/dist/ai-service/chat-gpt.d.ts +2 -0
- package/dist/ai-service/chat-gpt.js +7 -4
- package/dist/ai-service/chat-gpt.js.map +1 -1
- package/dist/ai-service/common.test.js +2 -1
- package/dist/ai-service/common.test.js.map +1 -1
- package/dist/ai-service/dall-e.js +1 -0
- package/dist/ai-service/dall-e.js.map +1 -1
- package/dist/ai-service/vertex-ai-claude.js +1 -0
- package/dist/ai-service/vertex-ai-claude.js.map +1 -1
- package/dist/cli/cli-options.js +10 -22
- package/dist/cli/cli-options.js.map +1 -1
- package/dist/cli/cli-params.d.ts +1 -5
- package/dist/cli/cli-params.js +10 -29
- package/dist/cli/cli-params.js.map +1 -1
- package/dist/cli/validate-cli-params.js +16 -11
- package/dist/cli/validate-cli-params.js.map +1 -1
- package/dist/cli/validate-cli-params.test.js +2 -2
- package/dist/cli/validate-cli-params.test.js.map +1 -1
- package/dist/examples/genaicode_plugins/fake_ai_service.d.ts +3 -0
- package/dist/examples/genaicode_plugins/fake_ai_service.js +11 -0
- package/dist/examples/genaicode_plugins/fake_ai_service.js.map +1 -0
- package/dist/examples/genaicode_plugins/grok_ai_service.d.ts +3 -0
- package/dist/examples/genaicode_plugins/grok_ai_service.js +153 -0
- package/dist/examples/genaicode_plugins/grok_ai_service.js.map +1 -0
- package/dist/examples/genaicode_plugins/nonsense_operation.d.ts +3 -0
- package/dist/examples/genaicode_plugins/nonsense_operation.js +23 -0
- package/dist/examples/genaicode_plugins/nonsense_operation.js.map +1 -0
- package/dist/files/path-utils.d.ts +1 -0
- package/dist/files/path-utils.js +12 -0
- package/dist/files/path-utils.js.map +1 -0
- package/dist/files/update-files.d.ts +1 -1
- package/dist/files/update-files.js +8 -183
- package/dist/files/update-files.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/main/codegen-types.d.ts +31 -1
- package/dist/main/codegen-utils.d.ts +3 -0
- package/dist/main/codegen-utils.js +16 -0
- package/dist/main/codegen-utils.js.map +1 -0
- package/dist/main/codegen.js +15 -26
- package/dist/main/codegen.js.map +1 -1
- package/dist/main/codegen.test.js +12 -15
- package/dist/main/codegen.test.js.map +1 -1
- package/dist/main/common/user-actions.d.ts +14 -2
- package/dist/main/common/user-actions.js +16 -1
- package/dist/main/common/user-actions.js.map +1 -1
- package/dist/main/config-lib.d.ts +1 -0
- package/dist/main/config-lib.js +7 -0
- package/dist/main/config-lib.js.map +1 -1
- package/dist/main/config.js +3 -0
- package/dist/main/config.js.map +1 -1
- package/dist/main/interactive/user-action-handlers.js +2 -2
- package/dist/main/interactive/user-action-handlers.js.map +1 -1
- package/dist/main/plugin-loader.d.ts +9 -0
- package/dist/main/plugin-loader.js +55 -0
- package/dist/main/plugin-loader.js.map +1 -0
- package/dist/main/ui/backend/api-utils.js +2 -2
- package/dist/main/ui/backend/api-utils.js.map +1 -1
- package/dist/main/ui/backend/api.js +15 -3
- package/dist/main/ui/backend/api.js.map +1 -1
- package/dist/main/ui/backend/service.d.ts +6 -11
- package/dist/main/ui/backend/service.js +11 -7
- package/dist/main/ui/backend/service.js.map +1 -1
- package/dist/main/ui/common/api-types.d.ts +20 -0
- package/dist/main/ui/common/api-types.js +2 -0
- package/dist/main/ui/common/api-types.js.map +1 -0
- package/dist/main/ui/frontend/assets/{index-Dicb_1yw.js → index-Dk_qaEQg.js} +75 -72
- package/dist/main/ui/frontend/index.html +1 -1
- package/dist/main/ui/user-action-handlers.js +9 -4
- package/dist/main/ui/user-action-handlers.js.map +1 -1
- package/dist/operations/create-directory/create-directory-def.d.ts +9 -0
- package/dist/operations/create-directory/create-directory-def.js +22 -0
- package/dist/operations/create-directory/create-directory-def.js.map +1 -0
- package/dist/operations/create-directory/create-directory-executor.d.ts +6 -0
- package/dist/operations/create-directory/create-directory-executor.js +22 -0
- package/dist/operations/create-directory/create-directory-executor.js.map +1 -0
- package/dist/operations/create-file/create-file-def.d.ts +10 -0
- package/dist/operations/create-file/create-file-def.js +26 -0
- package/dist/operations/create-file/create-file-def.js.map +1 -0
- package/dist/operations/create-file/create-file-executor.d.ts +6 -0
- package/dist/operations/create-file/create-file-executor.js +27 -0
- package/dist/operations/create-file/create-file-executor.js.map +1 -0
- package/dist/operations/delete-file/delete-file-def.d.ts +9 -0
- package/dist/operations/delete-file/delete-file-def.js +22 -0
- package/dist/operations/delete-file/delete-file-def.js.map +1 -0
- package/dist/operations/delete-file/delete-file-executor.d.ts +6 -0
- package/dist/operations/delete-file/delete-file-executor.js +23 -0
- package/dist/operations/delete-file/delete-file-executor.js.map +1 -0
- package/dist/operations/download-file/download-file-def.d.ts +10 -0
- package/dist/operations/download-file/download-file-def.js +26 -0
- package/dist/operations/download-file/download-file-def.js.map +1 -0
- package/dist/operations/download-file/download-file-executor.d.ts +6 -0
- package/dist/operations/download-file/download-file-executor.js +44 -0
- package/dist/operations/download-file/download-file-executor.js.map +1 -0
- package/dist/operations/imgly-remove-background/imgly-remove-background-def.d.ts +10 -0
- package/dist/operations/imgly-remove-background/imgly-remove-background-def.js +26 -0
- package/dist/operations/imgly-remove-background/imgly-remove-background-def.js.map +1 -0
- package/dist/operations/imgly-remove-background/imgly-remove-background-executor.d.ts +6 -0
- package/dist/operations/imgly-remove-background/imgly-remove-background-executor.js +40 -0
- package/dist/operations/imgly-remove-background/imgly-remove-background-executor.js.map +1 -0
- package/dist/operations/move-file/move-file-def.d.ts +10 -0
- package/dist/operations/move-file/move-file-def.js +26 -0
- package/dist/operations/move-file/move-file-def.js.map +1 -0
- package/dist/operations/move-file/move-file-executor.d.ts +6 -0
- package/dist/operations/move-file/move-file-executor.js +29 -0
- package/dist/operations/move-file/move-file-executor.js.map +1 -0
- package/dist/operations/operations-index.d.ts +3 -0
- package/dist/operations/operations-index.js +33 -0
- package/dist/operations/operations-index.js.map +1 -0
- package/dist/operations/patch-file/patch-file-def.d.ts +10 -0
- package/dist/operations/patch-file/patch-file-def.js +39 -0
- package/dist/operations/patch-file/patch-file-def.js.map +1 -0
- package/dist/operations/patch-file/patch-file-executor.d.ts +5 -0
- package/dist/operations/patch-file/patch-file-executor.js +26 -0
- package/dist/operations/patch-file/patch-file-executor.js.map +1 -0
- package/dist/operations/resize-image/resize-image-def.d.ts +13 -0
- package/dist/operations/resize-image/resize-image-def.js +37 -0
- package/dist/operations/resize-image/resize-image-def.js.map +1 -0
- package/dist/operations/resize-image/resize-image-executor.d.ts +5 -0
- package/dist/operations/resize-image/resize-image-executor.js +30 -0
- package/dist/operations/resize-image/resize-image-executor.js.map +1 -0
- package/dist/operations/split-image/split-image-def.d.ts +18 -0
- package/dist/operations/split-image/split-image-def.js +46 -0
- package/dist/operations/split-image/split-image-def.js.map +1 -0
- package/dist/operations/split-image/split-image-executor.d.ts +6 -0
- package/dist/operations/split-image/split-image-executor.js +51 -0
- package/dist/operations/split-image/split-image-executor.js.map +1 -0
- package/dist/operations/update-file/update-file-def.d.ts +10 -0
- package/dist/operations/update-file/update-file-def.js +26 -0
- package/dist/operations/update-file/update-file-def.js.map +1 -0
- package/dist/operations/update-file/update-file-executor.d.ts +5 -0
- package/dist/operations/update-file/update-file-executor.js +22 -0
- package/dist/operations/update-file/update-file-executor.js.map +1 -0
- package/dist/prompt/ai-service-fallback.js.map +1 -1
- package/dist/prompt/function-calling-validate.js +2 -2
- 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 +29 -44
- package/dist/prompt/function-calling.js.map +1 -1
- package/dist/prompt/function-defs/ask-question-reflect.d.ts +2 -20
- package/dist/prompt/function-defs/ask-question-reflect.js.map +1 -1
- package/dist/prompt/function-defs/ask-question.d.ts +2 -73
- package/dist/prompt/function-defs/ask-question.js +28 -14
- package/dist/prompt/function-defs/ask-question.js.map +1 -1
- package/dist/prompt/function-defs/codegen-summary.d.ts +2 -62
- package/dist/prompt/function-defs/codegen-summary.js +4 -2
- package/dist/prompt/function-defs/codegen-summary.js.map +1 -1
- package/dist/prompt/function-defs/explanation.d.ts +2 -14
- package/dist/prompt/function-defs/explanation.js.map +1 -1
- package/dist/prompt/function-defs/generate-image.d.ts +2 -38
- package/dist/prompt/function-defs/generate-image.js.map +1 -1
- package/dist/prompt/function-defs/get-image-assets.d.ts +2 -17
- package/dist/prompt/function-defs/get-image-assets.js.map +1 -1
- package/dist/prompt/function-defs/get-source-code.d.ts +2 -17
- package/dist/prompt/function-defs/get-source-code.js.map +1 -1
- package/dist/prompt/function-defs/optimize-context.d.ts +2 -43
- package/dist/prompt/function-defs/optimize-context.js.map +1 -1
- package/dist/prompt/function-defs/read-history.d.ts +2 -13
- package/dist/prompt/function-defs/read-history.js.map +1 -1
- package/dist/prompt/function-defs/set-summaries.d.ts +2 -28
- package/dist/prompt/function-defs/set-summaries.js.map +1 -1
- package/dist/prompt/function-defs/update-history.d.ts +2 -18
- package/dist/prompt/function-defs/update-history.js.map +1 -1
- package/dist/prompt/prompt-service.js +6 -6
- package/dist/prompt/prompt-service.js.map +1 -1
- package/dist/prompt/prompt-service.test.js +16 -19
- package/dist/prompt/prompt-service.test.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.js +16 -0
- package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js +37 -0
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js +36 -0
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/default-action.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/default-action.js +18 -0
- package/dist/prompt/steps/step-ask-question/handlers/default-action.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer.js +20 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js +43 -0
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js +49 -0
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js +46 -0
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.js +16 -0
- package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.js.map +1 -0
- 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 +2 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-handlers.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.d.ts +4 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.js +91 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts +56 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-types.js +2 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-types.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question.d.ts +6 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question.js +95 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -0
- package/dist/prompt/steps/step-context-optimization.js +9 -2
- package/dist/prompt/steps/step-context-optimization.js.map +1 -1
- package/dist/prompt/steps/step-generate-summary.js +2 -2
- package/dist/prompt/steps/step-generate-summary.js.map +1 -1
- package/dist/prompt/steps/step-history-update.js +2 -2
- package/dist/prompt/steps/step-history-update.js.map +1 -1
- package/dist/prompt/steps/step-summarization.js +2 -2
- package/dist/prompt/steps/step-summarization.js.map +1 -1
- package/dist/src/ai-service/ai-studio.d.ts +6 -0
- package/dist/src/ai-service/ai-studio.js +190 -0
- package/dist/src/ai-service/ai-studio.js.map +1 -0
- package/dist/src/ai-service/anthropic.d.ts +6 -0
- package/dist/src/ai-service/anthropic.js +150 -0
- package/dist/src/ai-service/anthropic.js.map +1 -0
- package/dist/src/ai-service/chat-gpt.d.ts +5 -0
- package/dist/src/ai-service/chat-gpt.js +146 -0
- package/dist/src/ai-service/chat-gpt.js.map +1 -0
- package/dist/src/ai-service/common.d.ts +69 -0
- package/dist/src/ai-service/common.js +38 -0
- package/dist/src/ai-service/common.js.map +1 -0
- package/dist/src/ai-service/common.test.d.ts +1 -0
- package/dist/src/ai-service/common.test.js +86 -0
- package/dist/src/ai-service/common.test.js.map +1 -0
- package/dist/src/ai-service/dall-e.d.ts +14 -0
- package/dist/src/ai-service/dall-e.js +50 -0
- package/dist/src/ai-service/dall-e.js.map +1 -0
- package/dist/src/ai-service/unescape-function-call.d.ts +7 -0
- package/dist/src/ai-service/unescape-function-call.js +59 -0
- package/dist/src/ai-service/unescape-function-call.js.map +1 -0
- package/dist/src/ai-service/unescape-function-call.test.d.ts +1 -0
- package/dist/src/ai-service/unescape-function-call.test.js +18 -0
- package/dist/src/ai-service/unescape-function-call.test.js.map +1 -0
- package/dist/src/ai-service/vertex-ai-claude.d.ts +5 -0
- package/dist/src/ai-service/vertex-ai-claude.js +104 -0
- package/dist/src/ai-service/vertex-ai-claude.js.map +1 -0
- package/dist/src/ai-service/vertex-ai-imagen.d.ts +14 -0
- package/dist/src/ai-service/vertex-ai-imagen.js +77 -0
- package/dist/src/ai-service/vertex-ai-imagen.js.map +1 -0
- package/dist/src/ai-service/vertex-ai.d.ts +6 -0
- package/dist/src/ai-service/vertex-ai.js +202 -0
- package/dist/src/ai-service/vertex-ai.js.map +1 -0
- package/dist/src/cli/cli-options.d.ts +10 -0
- package/dist/src/cli/cli-options.js +132 -0
- package/dist/src/cli/cli-options.js.map +1 -0
- package/dist/src/cli/cli-options.test.d.ts +1 -0
- package/dist/src/cli/cli-options.test.js +34 -0
- package/dist/src/cli/cli-options.test.js.map +1 -0
- package/dist/src/cli/cli-params.d.ts +32 -0
- package/dist/src/cli/cli-params.js +106 -0
- package/dist/src/cli/cli-params.js.map +1 -0
- package/dist/src/cli/cli-params.test.d.ts +1 -0
- package/dist/src/cli/cli-params.test.js +38 -0
- package/dist/src/cli/cli-params.test.js.map +1 -0
- package/dist/src/cli/service-autodetect.d.ts +2 -0
- package/dist/src/cli/service-autodetect.js +17 -0
- package/dist/src/cli/service-autodetect.js.map +1 -0
- package/dist/src/cli/service-autodetect.test.d.ts +1 -0
- package/dist/src/cli/service-autodetect.test.js +38 -0
- package/dist/src/cli/service-autodetect.test.js.map +1 -0
- package/dist/src/cli/validate-cli-params.d.ts +18 -0
- package/dist/src/cli/validate-cli-params.js +145 -0
- package/dist/src/cli/validate-cli-params.js.map +1 -0
- package/dist/src/cli/validate-cli-params.test.d.ts +1 -0
- package/dist/src/cli/validate-cli-params.test.js +106 -0
- package/dist/src/cli/validate-cli-params.test.js.map +1 -0
- package/dist/src/files/cache-file.d.ts +3 -0
- package/dist/src/files/cache-file.js +36 -0
- package/dist/src/files/cache-file.js.map +1 -0
- package/dist/src/files/file-utils.d.ts +2 -0
- package/dist/src/files/file-utils.js +7 -0
- package/dist/src/files/file-utils.js.map +1 -0
- package/dist/src/files/file-utils.test.d.ts +1 -0
- package/dist/src/files/file-utils.test.js +18 -0
- package/dist/src/files/file-utils.test.js.map +1 -0
- package/dist/src/files/find-files.d.ts +9 -0
- package/dist/src/files/find-files.js +81 -0
- package/dist/src/files/find-files.js.map +1 -0
- package/dist/src/files/path-utils.d.ts +1 -0
- package/dist/src/files/path-utils.js +12 -0
- package/dist/src/files/path-utils.js.map +1 -0
- package/dist/src/files/read-files.d.ts +21 -0
- package/dist/src/files/read-files.js +68 -0
- package/dist/src/files/read-files.js.map +1 -0
- package/dist/src/files/read-files.test.d.ts +1 -0
- package/dist/src/files/read-files.test.js +89 -0
- package/dist/src/files/read-files.test.js.map +1 -0
- package/dist/src/files/temp-buffer.d.ts +2 -0
- package/dist/src/files/temp-buffer.js +12 -0
- package/dist/src/files/temp-buffer.js.map +1 -0
- package/dist/src/files/update-files.d.ts +6 -0
- package/dist/src/files/update-files.js +19 -0
- package/dist/src/files/update-files.js.map +1 -0
- package/dist/src/images/ensure-alpha.d.ts +1 -0
- package/dist/src/images/ensure-alpha.js +5 -0
- package/dist/src/images/ensure-alpha.js.map +1 -0
- package/dist/src/images/imgly-remove-background.d.ts +2 -0
- package/dist/src/images/imgly-remove-background.js +21 -0
- package/dist/src/images/imgly-remove-background.js.map +1 -0
- package/dist/src/images/resize-image.d.ts +19 -0
- package/dist/src/images/resize-image.js +22 -0
- package/dist/src/images/resize-image.js.map +1 -0
- package/dist/src/images/split-image.d.ts +18 -0
- package/dist/src/images/split-image.js +25 -0
- package/dist/src/images/split-image.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/main/codegen-types.d.ts +58 -0
- package/dist/src/main/codegen-types.js +2 -0
- package/dist/src/main/codegen-types.js.map +1 -0
- package/dist/src/main/codegen-utils.d.ts +3 -0
- package/dist/src/main/codegen-utils.js +18 -0
- package/dist/src/main/codegen-utils.js.map +1 -0
- package/dist/src/main/codegen.d.ts +4 -0
- package/dist/src/main/codegen.js +201 -0
- package/dist/src/main/codegen.js.map +1 -0
- package/dist/src/main/codegen.test.d.ts +3 -0
- package/dist/src/main/codegen.test.js +288 -0
- package/dist/src/main/codegen.test.js.map +1 -0
- package/dist/src/main/common/content-bus-types.d.ts +21 -0
- package/dist/src/main/common/content-bus-types.js +11 -0
- package/dist/src/main/common/content-bus-types.js.map +1 -0
- package/dist/src/main/common/content-bus.d.ts +10 -0
- package/dist/src/main/common/content-bus.js +39 -0
- package/dist/src/main/common/content-bus.js.map +1 -0
- package/dist/src/main/common/cost-collector.d.ts +11 -0
- package/dist/src/main/common/cost-collector.js +90 -0
- package/dist/src/main/common/cost-collector.js.map +1 -0
- package/dist/src/main/common/user-actions.d.ts +19 -0
- package/dist/src/main/common/user-actions.js +30 -0
- package/dist/src/main/common/user-actions.js.map +1 -0
- package/dist/src/main/config-lib.d.ts +36 -0
- package/dist/src/main/config-lib.js +51 -0
- package/dist/src/main/config-lib.js.map +1 -0
- package/dist/src/main/config-lib.test.d.ts +1 -0
- package/dist/src/main/config-lib.test.js +64 -0
- package/dist/src/main/config-lib.test.js.map +1 -0
- package/dist/src/main/config.d.ts +7 -0
- package/dist/src/main/config.js +51 -0
- package/dist/src/main/config.js.map +1 -0
- package/dist/src/main/interactive/codegen-interactive.d.ts +2 -0
- package/dist/src/main/interactive/codegen-interactive.js +61 -0
- package/dist/src/main/interactive/codegen-interactive.js.map +1 -0
- package/dist/src/main/interactive/codegen-interactive.test.d.ts +5 -0
- package/dist/src/main/interactive/codegen-interactive.test.js +79 -0
- package/dist/src/main/interactive/codegen-interactive.test.js.map +1 -0
- package/dist/src/main/interactive/codegen-worker.d.ts +3 -0
- package/dist/src/main/interactive/codegen-worker.js +54 -0
- package/dist/src/main/interactive/codegen-worker.js.map +1 -0
- package/dist/src/main/interactive/common.d.ts +5 -0
- package/dist/src/main/interactive/common.js +51 -0
- package/dist/src/main/interactive/common.js.map +1 -0
- package/dist/src/main/interactive/configure.d.ts +2 -0
- package/dist/src/main/interactive/configure.js +99 -0
- package/dist/src/main/interactive/configure.js.map +1 -0
- package/dist/src/main/interactive/error-handling.d.ts +1 -0
- package/dist/src/main/interactive/error-handling.js +43 -0
- package/dist/src/main/interactive/error-handling.js.map +1 -0
- package/dist/src/main/interactive/help.d.ts +1 -0
- package/dist/src/main/interactive/help.js +22 -0
- package/dist/src/main/interactive/help.js.map +1 -0
- package/dist/src/main/interactive/process-comments.d.ts +2 -0
- package/dist/src/main/interactive/process-comments.js +39 -0
- package/dist/src/main/interactive/process-comments.js.map +1 -0
- package/dist/src/main/interactive/select-ai-service.d.ts +2 -0
- package/dist/src/main/interactive/select-ai-service.js +27 -0
- package/dist/src/main/interactive/select-ai-service.js.map +1 -0
- package/dist/src/main/interactive/task-file.d.ts +2 -0
- package/dist/src/main/interactive/task-file.js +35 -0
- package/dist/src/main/interactive/task-file.js.map +1 -0
- package/dist/src/main/interactive/text-prompt.d.ts +2 -0
- package/dist/src/main/interactive/text-prompt.js +18 -0
- package/dist/src/main/interactive/text-prompt.js.map +1 -0
- package/dist/src/main/interactive/user-action-handlers.d.ts +1 -0
- package/dist/src/main/interactive/user-action-handlers.js +13 -0
- package/dist/src/main/interactive/user-action-handlers.js.map +1 -0
- package/dist/src/main/interactive/user-interrupt.d.ts +1 -0
- package/dist/src/main/interactive/user-interrupt.js +36 -0
- package/dist/src/main/interactive/user-interrupt.js.map +1 -0
- package/dist/src/main/plugin-loader.d.ts +6 -0
- package/dist/src/main/plugin-loader.js +40 -0
- package/dist/src/main/plugin-loader.js.map +1 -0
- package/dist/src/main/ui/backend/api-utils.d.ts +2 -0
- package/dist/src/main/ui/backend/api-utils.js +18 -0
- package/dist/src/main/ui/backend/api-utils.js.map +1 -0
- package/dist/src/main/ui/backend/api.d.ts +2 -0
- package/dist/src/main/ui/backend/api.js +210 -0
- package/dist/src/main/ui/backend/api.js.map +1 -0
- package/dist/src/main/ui/backend/server.d.ts +7 -0
- package/dist/src/main/ui/backend/server.js +83 -0
- package/dist/src/main/ui/backend/server.js.map +1 -0
- package/dist/src/main/ui/backend/service.d.ts +44 -0
- package/dist/src/main/ui/backend/service.js +171 -0
- package/dist/src/main/ui/backend/service.js.map +1 -0
- package/dist/src/main/ui/codegen-ui.d.ts +2 -0
- package/dist/src/main/ui/codegen-ui.js +13 -0
- package/dist/src/main/ui/codegen-ui.js.map +1 -0
- package/dist/src/main/ui/common/api-types.d.ts +20 -0
- package/dist/src/main/ui/common/api-types.js +2 -0
- package/dist/src/main/ui/common/api-types.js.map +1 -0
- package/dist/src/main/ui/user-action-handlers.d.ts +2 -0
- package/dist/src/main/ui/user-action-handlers.js +14 -0
- package/dist/src/main/ui/user-action-handlers.js.map +1 -0
- package/dist/src/operations/create-directory/create-directory-def.d.ts +9 -0
- package/dist/src/operations/create-directory/create-directory-def.js +22 -0
- package/dist/src/operations/create-directory/create-directory-def.js.map +1 -0
- package/dist/src/operations/create-directory/create-directory-executor.d.ts +6 -0
- package/dist/src/operations/create-directory/create-directory-executor.js +22 -0
- package/dist/src/operations/create-directory/create-directory-executor.js.map +1 -0
- package/dist/src/operations/create-file/create-file-def.d.ts +10 -0
- package/dist/src/operations/create-file/create-file-def.js +26 -0
- package/dist/src/operations/create-file/create-file-def.js.map +1 -0
- package/dist/src/operations/create-file/create-file-executor.d.ts +6 -0
- package/dist/src/operations/create-file/create-file-executor.js +27 -0
- package/dist/src/operations/create-file/create-file-executor.js.map +1 -0
- package/dist/src/operations/delete-file/delete-file-def.d.ts +9 -0
- package/dist/src/operations/delete-file/delete-file-def.js +22 -0
- package/dist/src/operations/delete-file/delete-file-def.js.map +1 -0
- package/dist/src/operations/delete-file/delete-file-executor.d.ts +6 -0
- package/dist/src/operations/delete-file/delete-file-executor.js +23 -0
- package/dist/src/operations/delete-file/delete-file-executor.js.map +1 -0
- package/dist/src/operations/download-file/download-file-def.d.ts +10 -0
- package/dist/src/operations/download-file/download-file-def.js +26 -0
- package/dist/src/operations/download-file/download-file-def.js.map +1 -0
- package/dist/src/operations/download-file/download-file-executor.d.ts +6 -0
- package/dist/src/operations/download-file/download-file-executor.js +44 -0
- package/dist/src/operations/download-file/download-file-executor.js.map +1 -0
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-def.d.ts +10 -0
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-def.js +26 -0
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-def.js.map +1 -0
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-executor.d.ts +6 -0
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-executor.js +40 -0
- package/dist/src/operations/imgly-remove-background/imgly-remove-background-executor.js.map +1 -0
- package/dist/src/operations/move-file/move-file-def.d.ts +10 -0
- package/dist/src/operations/move-file/move-file-def.js +26 -0
- package/dist/src/operations/move-file/move-file-def.js.map +1 -0
- package/dist/src/operations/move-file/move-file-executor.d.ts +6 -0
- package/dist/src/operations/move-file/move-file-executor.js +29 -0
- package/dist/src/operations/move-file/move-file-executor.js.map +1 -0
- package/dist/src/operations/operations-index.d.ts +3 -0
- package/dist/src/operations/operations-index.js +33 -0
- package/dist/src/operations/operations-index.js.map +1 -0
- package/dist/src/operations/patch-file/patch-file-def.d.ts +10 -0
- package/dist/src/operations/patch-file/patch-file-def.js +39 -0
- package/dist/src/operations/patch-file/patch-file-def.js.map +1 -0
- package/dist/src/operations/patch-file/patch-file-executor.d.ts +5 -0
- package/dist/src/operations/patch-file/patch-file-executor.js +26 -0
- package/dist/src/operations/patch-file/patch-file-executor.js.map +1 -0
- package/dist/src/operations/resize-image/resize-image-def.d.ts +13 -0
- package/dist/src/operations/resize-image/resize-image-def.js +37 -0
- package/dist/src/operations/resize-image/resize-image-def.js.map +1 -0
- package/dist/src/operations/resize-image/resize-image-executor.d.ts +5 -0
- package/dist/src/operations/resize-image/resize-image-executor.js +30 -0
- package/dist/src/operations/resize-image/resize-image-executor.js.map +1 -0
- package/dist/src/operations/split-image/split-image-def.d.ts +18 -0
- package/dist/src/operations/split-image/split-image-def.js +46 -0
- package/dist/src/operations/split-image/split-image-def.js.map +1 -0
- package/dist/src/operations/split-image/split-image-executor.d.ts +6 -0
- package/dist/src/operations/split-image/split-image-executor.js +51 -0
- package/dist/src/operations/split-image/split-image-executor.js.map +1 -0
- package/dist/src/operations/update-file/update-file-def.d.ts +10 -0
- package/dist/src/operations/update-file/update-file-def.js +26 -0
- package/dist/src/operations/update-file/update-file-def.js.map +1 -0
- package/dist/src/operations/update-file/update-file-executor.d.ts +5 -0
- package/dist/src/operations/update-file/update-file-executor.js +22 -0
- package/dist/src/operations/update-file/update-file-executor.js.map +1 -0
- package/dist/src/prompt/ai-service-fallback.d.ts +3 -0
- package/dist/src/prompt/ai-service-fallback.js +84 -0
- package/dist/src/prompt/ai-service-fallback.js.map +1 -0
- package/dist/src/prompt/function-calling-validate.d.ts +3 -0
- package/dist/src/prompt/function-calling-validate.js +99 -0
- package/dist/src/prompt/function-calling-validate.js.map +1 -0
- package/dist/src/prompt/function-calling.d.ts +5 -0
- package/dist/src/prompt/function-calling.js +43 -0
- package/dist/src/prompt/function-calling.js.map +1 -0
- package/dist/src/prompt/function-defs/ask-question-reflect.d.ts +2 -0
- package/dist/src/prompt/function-defs/ask-question-reflect.js +21 -0
- package/dist/src/prompt/function-defs/ask-question-reflect.js.map +1 -0
- package/dist/src/prompt/function-defs/ask-question.d.ts +8 -0
- package/dist/src/prompt/function-defs/ask-question.js +100 -0
- package/dist/src/prompt/function-defs/ask-question.js.map +1 -0
- package/dist/src/prompt/function-defs/codegen-summary.d.ts +5 -0
- package/dist/src/prompt/function-defs/codegen-summary.js +82 -0
- package/dist/src/prompt/function-defs/codegen-summary.js.map +1 -0
- package/dist/src/prompt/function-defs/explanation.d.ts +5 -0
- package/dist/src/prompt/function-defs/explanation.js +18 -0
- package/dist/src/prompt/function-defs/explanation.js.map +1 -0
- package/dist/src/prompt/function-defs/generate-image.d.ts +5 -0
- package/dist/src/prompt/function-defs/generate-image.js +42 -0
- package/dist/src/prompt/function-defs/generate-image.js.map +1 -0
- package/dist/src/prompt/function-defs/get-image-assets.d.ts +5 -0
- package/dist/src/prompt/function-defs/get-image-assets.js +21 -0
- package/dist/src/prompt/function-defs/get-image-assets.js.map +1 -0
- package/dist/src/prompt/function-defs/get-source-code.d.ts +5 -0
- package/dist/src/prompt/function-defs/get-source-code.js +22 -0
- package/dist/src/prompt/function-defs/get-source-code.js.map +1 -0
- package/dist/src/prompt/function-defs/optimize-context.d.ts +5 -0
- package/dist/src/prompt/function-defs/optimize-context.js +47 -0
- package/dist/src/prompt/function-defs/optimize-context.js.map +1 -0
- package/dist/src/prompt/function-defs/read-history.d.ts +2 -0
- package/dist/src/prompt/function-defs/read-history.js +14 -0
- package/dist/src/prompt/function-defs/read-history.js.map +1 -0
- package/dist/src/prompt/function-defs/set-summaries.d.ts +5 -0
- package/dist/src/prompt/function-defs/set-summaries.js +32 -0
- package/dist/src/prompt/function-defs/set-summaries.js.map +1 -0
- package/dist/src/prompt/function-defs/update-history.d.ts +5 -0
- package/dist/src/prompt/function-defs/update-history.js +22 -0
- package/dist/src/prompt/function-defs/update-history.js.map +1 -0
- package/dist/src/prompt/limits.d.ts +3 -0
- package/dist/src/prompt/limits.js +21 -0
- package/dist/src/prompt/limits.js.map +1 -0
- package/dist/src/prompt/limits.test.d.ts +1 -0
- package/dist/src/prompt/limits.test.js +35 -0
- package/dist/src/prompt/limits.test.js.map +1 -0
- package/dist/src/prompt/prompt-codegen.d.ts +9 -0
- package/dist/src/prompt/prompt-codegen.js +117 -0
- package/dist/src/prompt/prompt-codegen.js.map +1 -0
- package/dist/src/prompt/prompt-codegen.test.d.ts +1 -0
- package/dist/src/prompt/prompt-codegen.test.js +98 -0
- package/dist/src/prompt/prompt-codegen.test.js.map +1 -0
- package/dist/src/prompt/prompt-consts.d.ts +1 -0
- package/dist/src/prompt/prompt-consts.js +2 -0
- package/dist/src/prompt/prompt-consts.js.map +1 -0
- package/dist/src/prompt/prompt-service-ask-question.test.d.ts +4 -0
- package/dist/src/prompt/prompt-service-ask-question.test.js +215 -0
- package/dist/src/prompt/prompt-service-ask-question.test.js.map +1 -0
- package/dist/src/prompt/prompt-service.d.ts +5 -0
- package/dist/src/prompt/prompt-service.js +214 -0
- package/dist/src/prompt/prompt-service.js.map +1 -0
- package/dist/src/prompt/prompt-service.test.d.ts +2 -0
- package/dist/src/prompt/prompt-service.test.js +553 -0
- package/dist/src/prompt/prompt-service.test.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/cancel-code-generation.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/cancel-code-generation.js +16 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/cancel-code-generation.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/confirm-code-generation.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/confirm-code-generation.js +37 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/confirm-code-generation.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/context-optimization.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/context-optimization.js +36 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/context-optimization.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/default-action.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/default-action.js +18 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/default-action.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/handle-request-answer.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/handle-request-answer.js +20 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/handle-request-answer.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/remove-files-from-context.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/remove-files-from-context.js +43 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/remove-files-from-context.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/request-files-content.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/request-files-content.js +49 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/request-files-content.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/request-permissions.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/request-permissions.js +46 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/request-permissions.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/start-code-generation.d.ts +2 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/start-code-generation.js +16 -0
- package/dist/src/prompt/steps/step-ask-question/handlers/start-code-generation.js.map +1 -0
- 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 +2 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-handlers.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-reflect.d.ts +4 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-reflect.js +91 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-reflect.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-types.d.ts +55 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-types.js +2 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question-types.js.map +1 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question.d.ts +6 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question.js +88 -0
- package/dist/src/prompt/steps/step-ask-question/step-ask-question.js.map +1 -0
- package/dist/src/prompt/steps/step-context-optimization.d.ts +4 -0
- package/dist/src/prompt/steps/step-context-optimization.js +200 -0
- package/dist/src/prompt/steps/step-context-optimization.js.map +1 -0
- package/dist/src/prompt/steps/step-generate-image.d.ts +2 -0
- package/dist/src/prompt/steps/step-generate-image.js +29 -0
- package/dist/src/prompt/steps/step-generate-image.js.map +1 -0
- package/dist/src/prompt/steps/step-generate-summary.d.ts +3 -0
- package/dist/src/prompt/steps/step-generate-summary.js +41 -0
- package/dist/src/prompt/steps/step-generate-summary.js.map +1 -0
- package/dist/src/prompt/steps/step-history-update.d.ts +5 -0
- package/dist/src/prompt/steps/step-history-update.js +54 -0
- package/dist/src/prompt/steps/step-history-update.js.map +1 -0
- package/dist/src/prompt/steps/step-summarization.d.ts +8 -0
- package/dist/src/prompt/steps/step-summarization.js +75 -0
- package/dist/src/prompt/steps/step-summarization.js.map +1 -0
- package/dist/src/prompt/steps/step-validate-recover.d.ts +2 -0
- package/dist/src/prompt/steps/step-validate-recover.js +51 -0
- package/dist/src/prompt/steps/step-validate-recover.js.map +1 -0
- package/dist/src/prompt/steps/step-verify-patch.d.ts +6 -0
- package/dist/src/prompt/steps/step-verify-patch.js +34 -0
- package/dist/src/prompt/steps/step-verify-patch.js.map +1 -0
- package/dist/src/prompt/steps/steps-types.d.ts +16 -0
- package/dist/src/prompt/steps/steps-types.js +6 -0
- package/dist/src/prompt/steps/steps-types.js.map +1 -0
- package/dist/src/prompt/steps/steps-utils.d.ts +7 -0
- package/dist/src/prompt/steps/steps-utils.js +11 -0
- package/dist/src/prompt/steps/steps-utils.js.map +1 -0
- package/dist/src/prompt/systemprompt.d.ts +3 -0
- package/dist/src/prompt/systemprompt.js +209 -0
- package/dist/src/prompt/systemprompt.js.map +1 -0
- package/dist/src/prompt/systemprompt.test.d.ts +3 -0
- package/dist/src/prompt/systemprompt.test.js +43 -0
- package/dist/src/prompt/systemprompt.test.js.map +1 -0
- package/dist/src/prompt/token-estimator.d.ts +8 -0
- package/dist/src/prompt/token-estimator.js +31 -0
- package/dist/src/prompt/token-estimator.js.map +1 -0
- package/dist/src/vite-genaicode/vite-genaicode-frontend.d.ts +1 -0
- package/dist/src/vite-genaicode/vite-genaicode-frontend.js +142 -0
- package/dist/src/vite-genaicode/vite-genaicode-frontend.js.map +1 -0
- package/dist/src/vite-genaicode/vite-genaicode-plugin.d.ts +7 -0
- package/dist/src/vite-genaicode/vite-genaicode-plugin.js +40 -0
- package/dist/src/vite-genaicode/vite-genaicode-plugin.js.map +1 -0
- package/dist/vite-genaicode/vite-genaicode-plugin.d.ts +2 -1
- package/dist/vite-genaicode/vite-genaicode-plugin.js +20 -5
- package/dist/vite-genaicode/vite-genaicode-plugin.js.map +1 -1
- package/package.json +6 -3
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { askUserForConfirmation } from '../../../../main/common/user-actions.js';
|
|
2
|
+
import { StepResult } from '../../steps-types.js';
|
|
3
|
+
export async function handleRequestPermissions({ askQuestionCall, options, }) {
|
|
4
|
+
const userConfirmation = await askUserForConfirmation('The assistant is requesting additional permissions. Do you want to grant them?', false);
|
|
5
|
+
const user = {
|
|
6
|
+
type: 'user',
|
|
7
|
+
text: userConfirmation ? 'Permissions granted.' : 'Permission request denied.',
|
|
8
|
+
functionResponses: [{ name: 'askQuestion', call_id: askQuestionCall.id ?? '', content: undefined }],
|
|
9
|
+
};
|
|
10
|
+
if (userConfirmation) {
|
|
11
|
+
updatePermissions(askQuestionCall, options);
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
breakLoop: false,
|
|
15
|
+
stepResult: StepResult.CONTINUE,
|
|
16
|
+
items: [
|
|
17
|
+
{
|
|
18
|
+
assistant: { type: 'assistant', text: askQuestionCall.args?.content ?? '', functionCalls: [askQuestionCall] },
|
|
19
|
+
user,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function updatePermissions(askQuestionCall, options) {
|
|
25
|
+
if (askQuestionCall.args &&
|
|
26
|
+
typeof askQuestionCall.args === 'object' &&
|
|
27
|
+
'requestPermissions' in askQuestionCall.args) {
|
|
28
|
+
const permissions = askQuestionCall.args.requestPermissions;
|
|
29
|
+
if (permissions && typeof permissions === 'object') {
|
|
30
|
+
if ('enableImagen' in permissions && permissions.enableImagen) {
|
|
31
|
+
options.imagen = options.aiService === 'chat-gpt' ? 'dall-e' : 'vertex-ai';
|
|
32
|
+
}
|
|
33
|
+
if ('enableVision' in permissions && permissions.enableVision)
|
|
34
|
+
options.vision = true;
|
|
35
|
+
if ('allowDirectoryCreate' in permissions && permissions.allowDirectoryCreate)
|
|
36
|
+
options.allowDirectoryCreate = true;
|
|
37
|
+
if ('allowFileCreate' in permissions && permissions.allowFileCreate)
|
|
38
|
+
options.allowFileCreate = true;
|
|
39
|
+
if ('allowFileDelete' in permissions && permissions.allowFileDelete)
|
|
40
|
+
options.allowFileDelete = true;
|
|
41
|
+
if ('allowFileMove' in permissions && permissions.allowFileMove)
|
|
42
|
+
options.allowFileMove = true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=request-permissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-permissions.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/request-permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,EAC7C,eAAe,EACf,OAAO,GACY;IACnB,MAAM,gBAAgB,GAAG,MAAM,sBAAsB,CACnD,gFAAgF,EAChF,KAAK,CACN,CAAC;IAEF,MAAM,IAAI,GAAa;QACrB,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,4BAA4B;QAC9E,iBAAiB,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;KACpG,CAAC;I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BAAE,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;YACpG,IAAI,eAAe,IAAI,WAAW,IAAI,WAAW,CAAC,aAAa;gBAAE,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;QAChG,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { putSystemMessage } from '../../../../main/common/content-bus.js';
|
|
2
|
+
import { StepResult } from '../../steps-types.js';
|
|
3
|
+
export async function handleStartCodeGeneration({ askQuestionCall }) {
|
|
4
|
+
putSystemMessage('Proceeding with code generation.');
|
|
5
|
+
return {
|
|
6
|
+
breakLoop: true,
|
|
7
|
+
stepResult: StepResult.CONTINUE,
|
|
8
|
+
items: [
|
|
9
|
+
{
|
|
10
|
+
assistant: { type: 'assistant', text: askQuestionCall.args?.content ?? '', functionCalls: [] },
|
|
11
|
+
user: { type: 'user', text: 'Proceeding with code generation.' },
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=start-code-generation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-code-generation.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/start-code-generation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,EAAE,eAAe,EAAsB;IACrF,gBAAgB,CAAC,kCAAkC,CAAC,CAAC;IACrD,OAAO;QACL,SAAS,EAAE,IAAI;QACf,UAAU,EAAE,UAAU,CAAC,QAAQ;QAC/B,KAAK,EAAE;YACL;gBACE,SAAS,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE;gBAC9F,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kCAAkC,EAAE;aACjE;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-ask-question-handlers.js","sourceRoot":"","sources":["../../../../src/prompt/steps/step-ask-question/step-ask-question-handlers.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FunctionDef, GenerateContentFunction, PromptItem } from '../../../ai-service/common.js';
|
|
2
|
+
import { CodegenOptions } from '../../../main/codegen-types.js';
|
|
3
|
+
import { AskQuestionCall, EscalationDecision, SelfReflectionContext } from './step-ask-question-types.js';
|
|
4
|
+
export declare function performSelfReflection(askQuestionCall: AskQuestionCall, context: SelfReflectionContext, prompt: PromptItem[], functionDefs: FunctionDef[], options: CodegenOptions, generateContentFn: GenerateContentFunction): Promise<EscalationDecision>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { validateAndRecoverSingleResult } from '../step-validate-recover.js';
|
|
2
|
+
const SELF_REFLECT_PROMPT = `Please reflect on your last response provided in \`askQuestion\` function call in the context of our conversation by considering these questions:
|
|
3
|
+
|
|
4
|
+
- Did you fully understand and address the user's request?
|
|
5
|
+
- Was your response clear, accurate, and helpful?
|
|
6
|
+
- Are you confident that no further clarification or escalation is needed?
|
|
7
|
+
- Is your response too similar to previous questions or responses in the conversation?
|
|
8
|
+
- Is your response adding value to the conversation or moving it forward?
|
|
9
|
+
- Are you maintaining your own identity and perspective as an AI assistant?
|
|
10
|
+
- Are you directly addressing the user's points without deflecting or prolonging the conversation?
|
|
11
|
+
- Are you providing clear, concise, and helpful responses without being overly cautious or evasive?
|
|
12
|
+
- Are you demonstrating confidence and competence in your abilities without expressing unnecessary uncertainty?
|
|
13
|
+
|
|
14
|
+
Common problems/pitfalls:
|
|
15
|
+
|
|
16
|
+
- There is an in-depth question to the user, but actionType is set to confirmCodeGeneration, while it should be requestAnswer
|
|
17
|
+
- Question was already answered before, but the assistant is asking the same question again
|
|
18
|
+
- The question content is incomplete, for example the question content ends with a colon
|
|
19
|
+
- Saying that an analysis will be done, instead of actually doing the analysis
|
|
20
|
+
- The response is too similar to a previous question or response
|
|
21
|
+
- The assistant takes on the user's voice or persona instead of maintaining its own identity
|
|
22
|
+
|
|
23
|
+
Specific examples of problematic responses:
|
|
24
|
+
|
|
25
|
+
1. User: "What's the weather like today?"
|
|
26
|
+
Assistant: "To provide information about today's weather, I'll need to know your location. What city are you in?"
|
|
27
|
+
User: "New York"
|
|
28
|
+
Assistant: "To give you accurate weather information for New York, I'll need to know which specific area of New York you're interested in. Could you please provide more details about your location?"
|
|
29
|
+
Problem: The assistant is being overly cautious and asking for unnecessary details, prolonging the conversation instead of providing a helpful response based on the information already given.
|
|
30
|
+
|
|
31
|
+
2. User: "Can you explain how to implement a binary search algorithm?"
|
|
32
|
+
Assistant: "Certainly! I'd be happy to explain how to implement a binary search algorithm. Before we begin, could you tell me what programming language you'd like the explanation in?"
|
|
33
|
+
User: "Python"
|
|
34
|
+
Assistant: "Great choice! Python is an excellent language for implementing a binary search algorithm. Before we dive into the Python implementation, could you let me know your level of experience with Python programming?"
|
|
35
|
+
Problem: The assistant is asking for excessive context before providing the requested explanation, which may frustrate the user who was expecting a more direct response.
|
|
36
|
+
|
|
37
|
+
3. User: "I'm not convinced if those responses are really problematic"
|
|
38
|
+
Assistant: "I'm not convinced if those responses in the "Specific examples of problematic responses" section are really problematic. Could you provide more context or clarification on why you consider them to be problematic examples?"
|
|
39
|
+
Problem: The assistant is repeating the user's statement and asking for clarification instead of engaging with the user's perspective. This response fails to maintain the assistant's identity and doesn't add value to the conversation.
|
|
40
|
+
|
|
41
|
+
If your response meets the criteria for a clear, helpful, and non-repetitive answer, continue the conversation as usual. If you believe that escalating to a more advanced model would significantly improve assistance or if the response is too similar to previous interactions, please indicate that using the \`shouldEscalate\` parameter and provide a \`reason\`.`;
|
|
42
|
+
export async function performSelfReflection(askQuestionCall, context, prompt, functionDefs, options, generateContentFn) {
|
|
43
|
+
if (!options.selfReflectionEnabled) {
|
|
44
|
+
return {
|
|
45
|
+
shouldEscalate: false,
|
|
46
|
+
reason: 'Self-reflection is disabled by user configuration.',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const currentTime = Date.now();
|
|
50
|
+
const { shouldEscalate, reason } = await runSelfReflect(askQuestionCall, prompt, functionDefs, options, generateContentFn);
|
|
51
|
+
if (shouldEscalate) {
|
|
52
|
+
context.escalationCount++;
|
|
53
|
+
context.lastEscalationTime = currentTime;
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
shouldEscalate,
|
|
57
|
+
reason,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
async function runSelfReflect(askQuestionCall, prompt, functionDefs, options, generateContentFn) {
|
|
61
|
+
const currentResponse = askQuestionCall.args?.content ?? '';
|
|
62
|
+
const reflectRequest = [
|
|
63
|
+
[
|
|
64
|
+
...prompt,
|
|
65
|
+
{ type: 'assistant', text: currentResponse, functionCalls: [askQuestionCall] },
|
|
66
|
+
{
|
|
67
|
+
type: 'user',
|
|
68
|
+
text: SELF_REFLECT_PROMPT,
|
|
69
|
+
functionResponses: [{ name: 'askQuestion', call_id: askQuestionCall.id ?? '', content: undefined }],
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
functionDefs,
|
|
73
|
+
'askQuestionReflect',
|
|
74
|
+
0.2,
|
|
75
|
+
true,
|
|
76
|
+
options,
|
|
77
|
+
];
|
|
78
|
+
let result = await generateContentFn(...reflectRequest);
|
|
79
|
+
result = await validateAndRecoverSingleResult(reflectRequest, result, generateContentFn);
|
|
80
|
+
const reflectionResult = result.find((call) => call.name === 'askQuestionReflect')?.args;
|
|
81
|
+
const shouldEscalate = (reflectionResult?.shouldEscalate ?? 0) > 50;
|
|
82
|
+
const reason = reflectionResult?.reason || '';
|
|
83
|
+
return {
|
|
84
|
+
shouldEscalate,
|
|
85
|
+
reason: reason ||
|
|
86
|
+
(shouldEscalate
|
|
87
|
+
? 'Response requires escalation to a more advanced model'
|
|
88
|
+
: 'Response does not require escalation'),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=step-ask-question-reflect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-ask-question-reflect.js","sourceRoot":"","sources":["../../../../src/prompt/steps/step-ask-question/step-ask-question-reflect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAG7E,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0WAuC8U,CAAC;AAE3W,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,eAAgC,EAChC,OAA8B,EAC9B,MAAoB,EACpB,YAA2B,EAC3B,OAAuB,EACvB,iBAA0C;IAE1C,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;QACnC,OAAO;YACL,cAAc,EAAE,KAAK;YACrB,MAAM,EAAE,oDAAoD;SAC7D,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE/B,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,MAAM,cAAc,CACrD,eAAe,EACf,MAAM,EACN,YAAY,EACZ,OAAO,EACP,iBAAiB,CAClB,CAAC;IAEF,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,CAAC,eAAe,EAAE,CAAC;QAC1B,OAAO,CAAC,kBAAkB,GAAG,WAAW,CAAC;IAC3C,CAAC;IAED,OAAO;QACL,cAAc;QACd,MAAM;KACP,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,cAAc,CAC3B,eAAgC,EAChC,MAAoB,EACpB,YAA2B,EAC3B,OAAuB,EACvB,iBAA0C;IAE1C,MAAM,eAAe,GAAG,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,CAAC;IAE5D,MAAM,cAAc,GAAwB;QAC1C;YACE,GAAG,MAAM;YACT,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,eAAe,CAAC,EAAE;YAC9E;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,mBAAmB;gBACzB,iBAAiB,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;aACpG;SACF;QACD,YAAY;QACZ,oBAAoB;QACpB,GAAG;QACH,IAAI;QACJ,OAAO;KACR,CAAC;IAEF,IAAI,MAAM,GAAG,MAAM,iBAAiB,CAAC,GAAG,cAAc,CAAC,CAAC;IACxD,MAAM,GAAG,MAAM,8BAA8B,CAAC,cAAc,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAEzF,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,oBAAoB,CAAC,EAAE,IAAI,CAAC;IACzF,MAAM,cAAc,GAAG,CAAE,gBAAgB,EAAE,cAAqC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;IAC5F,MAAM,MAAM,GAAI,gBAAgB,EAAE,MAAiB,IAAI,EAAE,CAAC;IAE1D,OAAO;QACL,cAAc;QACd,MAAM,EACJ,MAAM;YACN,CAAC,cAAc;gBACb,CAAC,CAAC,uDAAuD;gBACzD,CAAC,CAAC,sCAAsC,CAAC;KAC9C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { FunctionCall, GenerateContentFunction, PromptItem } from '../../../ai-service/common.js';
|
|
2
|
+
import { CodegenOptions } from '../../../main/codegen-types.js';
|
|
3
|
+
import { StepResult } from '../steps-types.js';
|
|
4
|
+
import { PluginActionType } from '../../../main/codegen-types.js';
|
|
5
|
+
export type ActionType = 'requestAnswer' | 'requestPermissions' | 'requestFilesContent' | 'removeFilesFromContext' | 'confirmCodeGeneration' | 'startCodeGeneration' | 'cancelCodeGeneration' | 'contextOptimization' | PluginActionType;
|
|
6
|
+
type AskQuestionArgs = {
|
|
7
|
+
actionType: ActionType;
|
|
8
|
+
content: string;
|
|
9
|
+
requestFilesContent?: string[];
|
|
10
|
+
requestPermissions?: Record<'allowDirectoryCreate' | 'allowFileCreate' | 'allowFileDelete' | 'allowFileMove' | 'enableVision' | 'enableImagen', boolean>;
|
|
11
|
+
removeFilesFromContext?: string[];
|
|
12
|
+
};
|
|
13
|
+
export type AskQuestionCall = FunctionCall<AskQuestionArgs>;
|
|
14
|
+
export interface AssistantItem {
|
|
15
|
+
type: 'assistant';
|
|
16
|
+
text: string;
|
|
17
|
+
functionCalls: FunctionCall[];
|
|
18
|
+
cache?: true;
|
|
19
|
+
}
|
|
20
|
+
export interface UserItem {
|
|
21
|
+
type: 'user';
|
|
22
|
+
text: string;
|
|
23
|
+
functionResponses?: Array<{
|
|
24
|
+
name: string;
|
|
25
|
+
call_id: string;
|
|
26
|
+
content: string | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
cache?: true;
|
|
29
|
+
}
|
|
30
|
+
export interface ActionResult {
|
|
31
|
+
breakLoop: boolean;
|
|
32
|
+
stepResult: StepResult;
|
|
33
|
+
items: Array<{
|
|
34
|
+
assistant: AssistantItem;
|
|
35
|
+
user: UserItem;
|
|
36
|
+
}>;
|
|
37
|
+
}
|
|
38
|
+
export type ActionHandlerProps = {
|
|
39
|
+
askQuestionCall: AskQuestionCall;
|
|
40
|
+
prompt: PromptItem[];
|
|
41
|
+
options: CodegenOptions;
|
|
42
|
+
generateContentFn: GenerateContentFunction;
|
|
43
|
+
messages: {
|
|
44
|
+
contextSourceCode: (paths: string[], pathsOnly: boolean) => string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export type ActionHandler = (props: ActionHandlerProps) => Promise<ActionResult>;
|
|
48
|
+
export interface EscalationDecision {
|
|
49
|
+
shouldEscalate: boolean;
|
|
50
|
+
reason: string;
|
|
51
|
+
}
|
|
52
|
+
export interface SelfReflectionContext {
|
|
53
|
+
escalationCount: number;
|
|
54
|
+
lastEscalationTime: number;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-ask-question-types.js","sourceRoot":"","sources":["../../../../src/prompt/steps/step-ask-question/step-ask-question-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FunctionDef, GenerateContentFunction, PromptItem } from '../../../ai-service/common.js';
|
|
2
|
+
import { StepResult } from '../steps-types.js';
|
|
3
|
+
import { CodegenOptions } from '../../../main/codegen-types.js';
|
|
4
|
+
export declare function executeStepAskQuestion(generateContentFn: GenerateContentFunction, prompt: PromptItem[], functionDefs: FunctionDef[], temperature: number, messages: {
|
|
5
|
+
contextSourceCode: (paths: string[], pathsOnly: boolean) => string;
|
|
6
|
+
}, options: CodegenOptions): Promise<StepResult>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { StepResult } from '../steps-types.js';
|
|
2
|
+
import { putAssistantMessage, putSystemMessage, putUserMessage } from '../../../main/common/content-bus.js';
|
|
3
|
+
import { abortController } from '../../../main/interactive/codegen-worker.js';
|
|
4
|
+
import { validateAndRecoverSingleResult } from '../step-validate-recover.js';
|
|
5
|
+
import { handleRequestFilesContent } from './handlers/request-files-content.js';
|
|
6
|
+
import { handleContextOptimization } from './handlers/context-optimization.js';
|
|
7
|
+
import { handleRemoveFilesFromContext } from './handlers/remove-files-from-context.js';
|
|
8
|
+
import { handleRequestPermissions } from './handlers/request-permissions.js';
|
|
9
|
+
import { handleDefaultAction } from './handlers/default-action.js';
|
|
10
|
+
import { handleRequestAnswer } from './handlers/handle-request-answer.js';
|
|
11
|
+
import { handleStartCodeGeneration } from './handlers/start-code-generation.js';
|
|
12
|
+
import { handleConfirmCodeGeneration } from './handlers/confirm-code-generation.js';
|
|
13
|
+
import { handleCancelCodeGeneration } from './handlers/cancel-code-generation.js';
|
|
14
|
+
import { getRegisteredActionHandlers } from '../../../main/plugin-loader.js';
|
|
15
|
+
import { performSelfReflection } from './step-ask-question-reflect.js';
|
|
16
|
+
export async function executeStepAskQuestion(generateContentFn, prompt, functionDefs, temperature, messages, options) {
|
|
17
|
+
console.log('Allowing the assistant to ask a question...');
|
|
18
|
+
const selfReflectionContext = {
|
|
19
|
+
escalationCount: 0,
|
|
20
|
+
lastEscalationTime: 0,
|
|
21
|
+
};
|
|
22
|
+
while (!abortController?.signal.aborted) {
|
|
23
|
+
try {
|
|
24
|
+
const askQuestionCall = await getAskQuestionCall(generateContentFn, prompt, functionDefs, temperature, options, selfReflectionContext);
|
|
25
|
+
if (!askQuestionCall) {
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
console.log('Assistant asks:', askQuestionCall.args);
|
|
29
|
+
if (askQuestionCall.args?.content) {
|
|
30
|
+
putAssistantMessage(askQuestionCall.args.content, askQuestionCall.args);
|
|
31
|
+
}
|
|
32
|
+
const actionType = askQuestionCall.args?.actionType;
|
|
33
|
+
if (actionType) {
|
|
34
|
+
const actionHandler = getActionHandler(actionType);
|
|
35
|
+
const result = await actionHandler({ askQuestionCall, prompt, options, messages, generateContentFn });
|
|
36
|
+
// This is important to display the content to the user interface (ui or interactive cli)
|
|
37
|
+
putUserMessage(result.items.slice(-1)[0].user.text);
|
|
38
|
+
if (result.breakLoop) {
|
|
39
|
+
return result.stepResult;
|
|
40
|
+
}
|
|
41
|
+
prompt.push(...result.items.map(({ assistant, user }) => [assistant, user]).flat());
|
|
42
|
+
console.log('The question was answered');
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
console.error('Invalid action type received');
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
console.error('Error in executeStepAskQuestion:', error);
|
|
51
|
+
putSystemMessage(`An error occurred: ${error instanceof Error ? error.message : String(error)}`);
|
|
52
|
+
return StepResult.BREAK;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
putSystemMessage('Assistant did not ask a question. This unexpected, we need to abort.');
|
|
56
|
+
return StepResult.BREAK;
|
|
57
|
+
}
|
|
58
|
+
async function getAskQuestionCall(generateContentFn, prompt, functionDefs, temperature, options, selfReflectionContext) {
|
|
59
|
+
const askQuestionRequest = [prompt, functionDefs, 'askQuestion', temperature, true, options];
|
|
60
|
+
let askQuestionResult = await generateContentFn(...askQuestionRequest);
|
|
61
|
+
askQuestionResult = await validateAndRecoverSingleResult(askQuestionRequest, askQuestionResult, generateContentFn);
|
|
62
|
+
const cheapModelResponse = askQuestionResult.find((call) => call.name === 'askQuestion');
|
|
63
|
+
if (cheapModelResponse) {
|
|
64
|
+
const escalationDecision = await performSelfReflection(cheapModelResponse, selfReflectionContext, prompt, functionDefs, options, generateContentFn);
|
|
65
|
+
if (escalationDecision.shouldEscalate) {
|
|
66
|
+
console.log('Self-reflection suggests escalating to non-cheap model.');
|
|
67
|
+
// Re-run with non-cheap model
|
|
68
|
+
const nonCheapRequest = [prompt, functionDefs, 'askQuestion', temperature, false, options];
|
|
69
|
+
let nonCheapResult = await generateContentFn(...nonCheapRequest);
|
|
70
|
+
nonCheapResult = await validateAndRecoverSingleResult(nonCheapRequest, nonCheapResult, generateContentFn);
|
|
71
|
+
return nonCheapResult.find((call) => call.name === 'askQuestion');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return cheapModelResponse;
|
|
75
|
+
}
|
|
76
|
+
function getActionHandler(actionType) {
|
|
77
|
+
// First, check if there's a plugin-provided handler for this action type
|
|
78
|
+
const pluginHandler = getRegisteredActionHandlers().get(actionType);
|
|
79
|
+
if (pluginHandler) {
|
|
80
|
+
return pluginHandler;
|
|
81
|
+
}
|
|
82
|
+
// If no plugin handler is found, use the built-in handlers
|
|
83
|
+
const handlers = {
|
|
84
|
+
cancelCodeGeneration: handleCancelCodeGeneration,
|
|
85
|
+
confirmCodeGeneration: handleConfirmCodeGeneration,
|
|
86
|
+
startCodeGeneration: handleStartCodeGeneration,
|
|
87
|
+
requestFilesContent: handleRequestFilesContent,
|
|
88
|
+
requestPermissions: handleRequestPermissions,
|
|
89
|
+
removeFilesFromContext: handleRemoveFilesFromContext,
|
|
90
|
+
requestAnswer: handleRequestAnswer,
|
|
91
|
+
contextOptimization: handleContextOptimization,
|
|
92
|
+
};
|
|
93
|
+
return handlers[actionType] || handleDefaultAction;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=step-ask-question.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-ask-question.js","sourceRoot":"","sources":["../../../../src/prompt/steps/step-ask-question/step-ask-question.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAC5G,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAE7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,E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AC9C,mBAAmB,EAAE,yBAAyB;QAC9C,kBAAkB,EAAE,wBAAwB;QAC5C,sBAAsB,EAAE,4BAA4B;QACpD,aAAa,EAAE,mBAAmB;QAClC,mBAAmB,EAAE,yBAAyB;KAC/C,CAAC;IAEF,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,mBAAmB,CAAC;AACrD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { putSystemMessage } from '../../main/common/content-bus.js';
|
|
2
2
|
import { getSourceCode } from '../../files/read-files.js';
|
|
3
|
-
import {
|
|
3
|
+
import { getFunctionDefs } from '../function-calling.js';
|
|
4
4
|
import { StepResult } from './steps-types.js';
|
|
5
5
|
import { estimateTokenCount } from '../token-estimator.js';
|
|
6
6
|
import { getSummary } from './step-summarization.js';
|
|
@@ -113,7 +113,14 @@ export async function executeStepContextOptimization(generateContentFn, prompt,
|
|
|
113
113
|
],
|
|
114
114
|
},
|
|
115
115
|
];
|
|
116
|
-
const request = [
|
|
116
|
+
const request = [
|
|
117
|
+
optimizationPrompt,
|
|
118
|
+
getFunctionDefs(),
|
|
119
|
+
'optimizeContext',
|
|
120
|
+
0.2,
|
|
121
|
+
true,
|
|
122
|
+
options,
|
|
123
|
+
];
|
|
117
124
|
let result = await generateContentFn(...request);
|
|
118
125
|
result = await validateAndRecoverSingleResult(request, result, generateContentFn);
|
|
119
126
|
const batchOptimized = parseOptimizationResult(result);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-context-optimization.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-context-optimization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAiB,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"step-context-optimization.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-context-optimization.ts"],"names":[],"mappings":"AAEA,OAAO,E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|
-
import {
|
|
2
|
+
import { getFunctionDefs } from '../function-calling.js';
|
|
3
3
|
import { ChatMessageFlags } from '../../main/common/content-bus-types.js';
|
|
4
4
|
export async function executeStepGenerateSummary(generateContentFn, prompt, options) {
|
|
5
5
|
if (!options.conversationSummaryEnabled) {
|
|
@@ -15,7 +15,7 @@ export async function executeStepGenerateSummary(generateContentFn, prompt, opti
|
|
|
15
15
|
text: `Now please summarize our conversation, I want maximum 1 sentence of maximum 10 words explaning the conversation.`,
|
|
16
16
|
},
|
|
17
17
|
],
|
|
18
|
-
|
|
18
|
+
getFunctionDefs(),
|
|
19
19
|
'explanation',
|
|
20
20
|
0.3, // Use a lower temperature for more focused summaries
|
|
21
21
|
true, // Use cheap model by default for summaries
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-generate-summary.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-generate-summary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"step-generate-summary.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-generate-summary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,iBAA0C,EAC1C,MAAoB,EACpB,OAAuB;IAEvB,IAAI,CAAC,OAAO,CAAC,0BAA0B,EAAE,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,uEAAuE,CAAC,CAAC;QACrF,OAAO;IACT,CAAC;IAED,MAAM,cAAc,GAAwB;QAC1C;YACE,GAAG,MAAM;YACT,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,oCAAoC,EAAE;YACjE;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,kHAAkH;aACzH;SACF;QACD,eAAe,EAAE;QACjB,aAAa;QACb,GAAG,EAAE,qDAAqD;QAC1D,IAAI,EAAE,2CAA2C;QACjD,OAAO;KACR,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,MAAM,iBAAiB,CAAC,GAAG,cAAc,CAAC,CAAC;QACjE,MAAM,kBAAkB,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC;QAErF,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,IAAI,IAAI,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtG,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC;YACzD,gBAAgB,CAAC,gCAAgC,EAAE,mBAAmB,EAAE,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,CAAC;QACnH,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;QAC/D,gBAAgB,CAAC,0CAA0C,CAAC,CAAC;QAC7D,OAAO;IACT,CAAC;AACH,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readCache, writeCache } from '../../files/cache-file.js';
|
|
2
2
|
import { putSystemMessage } from '../../main/common/content-bus.js';
|
|
3
|
-
import {
|
|
3
|
+
import { getFunctionDefs } from '../function-calling.js';
|
|
4
4
|
import { StepResult } from './steps-types.js';
|
|
5
5
|
import { validateAndRecoverSingleResult } from './step-validate-recover.js';
|
|
6
6
|
export async function executeStepHistoryUpdate(generateContentFn, prompt, options) {
|
|
@@ -38,7 +38,7 @@ ${currentHistory}
|
|
|
38
38
|
`,
|
|
39
39
|
},
|
|
40
40
|
];
|
|
41
|
-
const request = [optimizationPrompt,
|
|
41
|
+
const request = [optimizationPrompt, getFunctionDefs(), 'updateHistory', 1, true, options];
|
|
42
42
|
let result = await generateContentFn(...request);
|
|
43
43
|
result = await validateAndRecoverSingleResult(request, result, generateContentFn);
|
|
44
44
|
const { newHistoryContent, recentConversationSummary } = result.find((call) => call.name === 'updateHistory')?.args ?? {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-history-update.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-history-update.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"step-history-update.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-history-update.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAE5E,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,iBAA0C,EAC1C,MAAoB,EACpB,OAAuB;IAEvB,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAE3C,MAAM,kBAAkB,GAAiB;QACvC,GAAG,MAAM;QACT;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,qEAAqE;SAC5E;QACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE;;wBAEY,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;;;;;;;;;;;;;;;;;;EAkB9C,cAAc;;CAEf;SACI;KACF,CAAC;IAEF,MAAM,OAAO,GAAwB,CAAC,kBAAkB,EAAE,eAAe,EAAE,EAAE,eAAe,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAChH,IAAI,MAAM,GAAG,MAAM,iBAAiB,CAAC,GAAG,OAAO,CAAC,CAAC;IACjD,MAAM,GAAG,MAAM,8BAA8B,CAAC,OAAO,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAClF,MAAM,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,GACpD,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC;IACnE,IAAI,iBAAiB,EAAE,CAAC;QACtB,gBAAgB,CAAC,iBAAiB,EAAE,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,CAAC,CAAC;QACtF,UAAU,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,UAAU,CAAC,QAAQ,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,SAAS,CAAC,SAAS,EAAE,0DAA0D,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getFunctionDefs } from '../function-calling.js';
|
|
2
2
|
import { md5, readCache, writeCache } from '../../files/cache-file.js';
|
|
3
3
|
import { putSystemMessage } from '../../main/common/content-bus.js';
|
|
4
4
|
import { estimateTokenCount } from '../token-estimator.js';
|
|
@@ -45,7 +45,7 @@ async function summarizeBatch(generateContentFn, items, options) {
|
|
|
45
45
|
functionResponses: [{ name: 'getSourceCode', call_id: 'get_source_code', content: JSON.stringify(batch) }],
|
|
46
46
|
},
|
|
47
47
|
];
|
|
48
|
-
const request = [summarizationPrompt,
|
|
48
|
+
const request = [summarizationPrompt, getFunctionDefs(), 'setSummaries', 0.2, true, options];
|
|
49
49
|
let result = await generateContentFn(...request);
|
|
50
50
|
result = await validateAndRecoverSingleResult(request, result, generateContentFn);
|
|
51
51
|
const batchSummaries = parseSummarizationResult(result);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-summarization.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-summarization.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"step-summarization.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-summarization.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAE5E,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B,MAAM,oBAAoB,GAAG,iDAAiD,kBAAkB;;;sCAG1D,kBAAkB;;CAEvD,CAAC;AAEF,MAAM,YAAY,GAAiB,SAAS,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAkB,CAAC,CAAC;AAEvG,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,iBAA0C,EAC1C,UAAyB,EACzB,OAAuB;IAEvB,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9D,IAAI;QACJ,OAAO,EAAE,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI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AAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACjH,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACvC,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5F,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FunctionCall, FunctionDef, PromptItem } from './common.js';
|
|
2
|
+
import { CodegenOptions } from '../main/codegen-types.js';
|
|
3
|
+
/**
|
|
4
|
+
* This function generates content using the Anthropic Claude model via Vertex AI.
|
|
5
|
+
*/
|
|
6
|
+
export declare function generateContent(prompt: PromptItem[], functionDefs: FunctionDef[], requiredFunctionName: string | null, temperature: number, cheap: boolean | undefined, options: CodegenOptions): Promise<FunctionCall[]>;
|