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 @@
|
|
|
1
|
+
{"version":3,"file":"codegen-summary.js","sourceRoot":"","sources":["../../../../src/prompt/function-defs/codegen-summary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAgB,EAAE,CAAC,CAAC;IACtD,IAAI,EAAE,gBAAgB;IACtB,WAAW,EACT,+DAA+D;QAC/D,mHAAmH;QACnH,iHAAiH;QACjH,0GAA0G;QAC1G,mEAAmE;IACrE,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0FAA0F;aACxG;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,sFAAsF;gBACnG,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,8JAA8J;oBAChK,UAAU,EAAE;wBACV,QAAQ,EAAE;4BACR,IAAI,EAAE,QAAQ;4BACd,WAAW,EACT,gGAAgG;yBACnG;wBACD,MAAM,EAAE;4BACN,IAAI,EAAE,QAAQ;4BACd,WAAW,EACT,wJAAwJ;yBAC3J;wBACD,cAAc,EAAE;4BACd,IAAI,EAAE,QAAQ;4BACd,IAAI,EAAE;gCACJ,YAAY;gCACZ,YAAY;gCACZ,WAAW;gCACX,YAAY;gCACZ,iBAAiB;gCACjB,UAAU;gCACV,eAAe;gCACf,cAAc;gCACd,YAAY;gCACZ,aAAa;gCACb,uBAAuB;gCACvB,GAAG,uBAAuB,EAAE,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC;6BACpE;4BACD,WAAW,EAAE,+DAA+D;yBAC7E;wBACD,WAAW,EAAE;4BACX,IAAI,EAAE,QAAQ;4BACd,WAAW,EACT,oIAAoI;4BACtI,OAAO,EAAE,GAAG;4BACZ,OAAO,EAAE,GAAG;yBACb;wBACD,KAAK,EAAE;4BACL,IAAI,EAAE,SAAS;4BACf,WAAW,EACT,4JAA4J;yBAC/J;wBACD,kBAAkB,EAAE;4BAClB,IAAI,EAAE,OAAO;4BACb,WAAW,EACT,8JAA8J;4BAChK,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;yBAC1B;qBACF;oBACD,QAAQ,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,gBAAgB,CAAC;iBACnD;aACF;YACD,YAAY,EAAE;gBACZ,IAAI,EAAE,OAAO;gBACb,WAAW,EACT,gLAAgL;gBAClL,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;QACD,QAAQ,EAAE,CAAC,aAAa,EAAE,aAAa,EAAE,cAAc,CAAC;KACzD;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for explanation
|
|
3
|
+
*/
|
|
4
|
+
export const explanation = {
|
|
5
|
+
name: 'explanation',
|
|
6
|
+
description: 'Explain the reasoning behind the suggested code changes or reasoning for lack of code changes',
|
|
7
|
+
parameters: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
text: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'The explanation text',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
required: ['text'],
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=explanation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explanation.js","sourceRoot":"","sources":["../../../../src/prompt/function-defs/explanation.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAgB;IACtC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,+FAA+F;IAC5G,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sBAAsB;aACpC;SACF;QACD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACnB;CACF,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for generateImage
|
|
3
|
+
*/
|
|
4
|
+
export const generateImage = {
|
|
5
|
+
name: 'generateImage',
|
|
6
|
+
description: 'Generate an image using AI service and save it as a file.',
|
|
7
|
+
parameters: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
explanation: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'The explanation of the reasoning behind generating this image',
|
|
13
|
+
},
|
|
14
|
+
prompt: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'The prompt that will be used to generate the image. This prompt must be detailed, it will be used by image generation model.',
|
|
17
|
+
},
|
|
18
|
+
filePath: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'The file path to save the generated image.',
|
|
21
|
+
},
|
|
22
|
+
contextImagePath: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description: 'Path to a image file that will be used as a context for image generation. It is useful if there is a need to edit an image with genAI.',
|
|
25
|
+
},
|
|
26
|
+
width: {
|
|
27
|
+
type: 'number',
|
|
28
|
+
description: 'width of the image',
|
|
29
|
+
},
|
|
30
|
+
height: {
|
|
31
|
+
type: 'number',
|
|
32
|
+
description: 'height of the image',
|
|
33
|
+
},
|
|
34
|
+
cheap: {
|
|
35
|
+
type: 'boolean',
|
|
36
|
+
description: 'true value means that the prompt will be executed with cheaper model, which work faster, but provides lower quality results, so please use it only in situation when lower quality results are acceptable for the prompt.',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
required: ['prompt', 'filePath', 'width', 'height'],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=generate-image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-image.js","sourceRoot":"","sources":["../../../../src/prompt/function-defs/generate-image.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAgB;IACxC,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,2DAA2D;IACxE,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+DAA+D;aAC7E;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,8HAA8H;aACjI;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,4CAA4C;aAC1D;YACD,gBAAgB,EAAE;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,wIAAwI;aAC3I;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,oBAAoB;aAClC;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,qBAAqB;aACnC;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,SAAS;gBACf,WAAW,EACT,2NAA2N;aAC9N;SACF;QACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC;KACpD;CACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for getImageAssets
|
|
3
|
+
*/
|
|
4
|
+
export const getImageAssets = {
|
|
5
|
+
name: 'getImageAssets',
|
|
6
|
+
description: 'This function returns a map of application image assets. This map contains absolute file path, and basic metadata information. It does not contain contents. Contents must be requested using dedicated tool.',
|
|
7
|
+
parameters: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
filePaths: {
|
|
11
|
+
type: 'array',
|
|
12
|
+
description: 'An array of absolute paths of files that should be used to provided context.',
|
|
13
|
+
items: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
required: [],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=get-image-assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-image-assets.js","sourceRoot":"","sources":["../../../../src/prompt/function-defs/get-image-assets.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAgB;IACzC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EACT,+MAA+M;IACjN,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,8EAA8E;gBAC3F,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;QACD,QAAQ,EAAE,EAAE;KACb;CACF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for getSourceCode
|
|
3
|
+
*/
|
|
4
|
+
export const getSourceCode = {
|
|
5
|
+
name: 'getSourceCode',
|
|
6
|
+
description: 'This function returns source code of the application in Map format, where absolute file path is the key, and the value is an object, where one of the properties may be the content of the file.' +
|
|
7
|
+
'Some keys may not provide content. Some keys may provide a short summary of content. This function can be called only once during the conversation, and only if suggested by the user.',
|
|
8
|
+
parameters: {
|
|
9
|
+
type: 'object',
|
|
10
|
+
properties: {
|
|
11
|
+
filePaths: {
|
|
12
|
+
type: 'array',
|
|
13
|
+
description: 'An array of absolute paths of files that should be used to provided context.',
|
|
14
|
+
items: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
required: [],
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=get-source-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-source-code.js","sourceRoot":"","sources":["../../../../src/prompt/function-defs/get-source-code.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAgB;IACxC,IAAI,EAAE,eAAe;IACrB,WAAW,EACT,kMAAkM;QAClM,wLAAwL;IAC1L,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,8EAA8E;gBAC3F,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;QACD,QAAQ,EAAE,EAAE;KACb;CACF,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for optimizeContext
|
|
3
|
+
*/
|
|
4
|
+
export const optimizeContext = {
|
|
5
|
+
name: 'optimizeContext',
|
|
6
|
+
description: 'This function narrows the context of code generation to a list of relevant files, including their estimated token counts and relevance scores. It helps prioritize files based on their importance to the user prompt and manages token usage.',
|
|
7
|
+
parameters: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
userPrompt: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: "The user's original prompt.",
|
|
13
|
+
},
|
|
14
|
+
optimizedContext: {
|
|
15
|
+
type: 'array',
|
|
16
|
+
description: 'An array of objects representing relevant files, their relevance scores, and token counts.',
|
|
17
|
+
items: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
filePath: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'The absolute file path of a relevant file.',
|
|
23
|
+
},
|
|
24
|
+
relevance: {
|
|
25
|
+
type: 'number',
|
|
26
|
+
description: 'A score from 0 to 1 indicating the relevance of the file to the user prompt.',
|
|
27
|
+
minimum: 0,
|
|
28
|
+
maximum: 1,
|
|
29
|
+
},
|
|
30
|
+
tokenCount: {
|
|
31
|
+
type: 'integer',
|
|
32
|
+
description: 'The estimated token count for the file content.',
|
|
33
|
+
minimum: 0,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
required: ['filePath', 'relevance', 'tokenCount'],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
totalTokenCount: {
|
|
40
|
+
type: 'number',
|
|
41
|
+
description: 'The estimated token count for the entire context.',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
required: ['userPrompt', 'optimizedContext', 'totalTokenCount'],
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=optimize-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimize-context.js","sourceRoot":"","sources":["../../../../src/prompt/function-defs/optimize-context.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAgB;IAC1C,IAAI,EAAE,iBAAiB;IACvB,WAAW,EACT,gPAAgP;IAClP,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,6BAA6B;aAC3C;YACD,gBAAgB,EAAE;gBAChB,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,4FAA4F;gBACzG,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,QAAQ,EAAE;4BACR,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,4CAA4C;yBAC1D;wBACD,SAAS,EAAE;4BACT,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,8EAA8E;4BAC3F,OAAO,EAAE,CAAC;4BACV,OAAO,EAAE,CAAC;yBACX;wBACD,UAAU,EAAE;4BACV,IAAI,EAAE,SAAS;4BACf,WAAW,EAAE,iDAAiD;4BAC9D,OAAO,EAAE,CAAC;yBACX;qBACF;oBACD,QAAQ,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,YAAY,CAAC;iBAClD;aACF;YACD,eAAe,EAAE;gBACf,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mDAAmD;aACjE;SACF;QACD,QAAQ,EAAE,CAAC,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,CAAC;KAChE;CACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const readHistory = {
|
|
2
|
+
name: 'readHistory',
|
|
3
|
+
description: 'This function reads the history from the cache and returns it as a string.',
|
|
4
|
+
parameters: {
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {
|
|
7
|
+
dateTime: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
required: [],
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=read-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-history.js","sourceRoot":"","sources":["../../../../src/prompt/function-defs/read-history.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAgB;IACtC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,4EAA4E;IACzF,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;aACf;SACF;QACD,QAAQ,EAAE,EAAE;KACb;CACF,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for setSummaries
|
|
3
|
+
*/
|
|
4
|
+
export const setSummaries = {
|
|
5
|
+
name: 'setSummaries',
|
|
6
|
+
description: 'Use this function to save summaries of files',
|
|
7
|
+
parameters: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
summaries: {
|
|
11
|
+
type: 'array',
|
|
12
|
+
description: 'An array of results, each corresponding to an analyzed file, containing the absolute file path, and a brief summary.',
|
|
13
|
+
items: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
filePath: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'The absolute file path of the analyzed file.',
|
|
19
|
+
},
|
|
20
|
+
summary: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: "A summary of the file's content, highlighting its main purpose, functionality, or details which may be useful for context optimization.",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
required: ['filePath', 'summary'],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
required: ['summaries'],
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=set-summaries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-summaries.js","sourceRoot":"","sources":["../../../../src/prompt/function-defs/set-summaries.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAgB;IACvC,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,8CAA8C;IAC3D,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;gBACb,WAAW,EACT,sHAAsH;gBACxH,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,QAAQ,EAAE;4BACR,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,8CAA8C;yBAC5D;wBACD,OAAO,EAAE;4BACP,IAAI,EAAE,QAAQ;4BACd,WAAW,EACT,yIAAyI;yBAC5I;qBACF;oBACD,QAAQ,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC;iBAClC;aACF;SACF;QACD,QAAQ,EAAE,CAAC,WAAW,CAAC;KACxB;CACF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for updateHistory
|
|
3
|
+
*/
|
|
4
|
+
export const updateHistory = {
|
|
5
|
+
name: 'updateHistory',
|
|
6
|
+
description: 'Update the history.',
|
|
7
|
+
parameters: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
recentConversationSummary: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'Summary of recent conversation',
|
|
13
|
+
},
|
|
14
|
+
newHistoryContent: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'The new history content, combination of recent conversation summary, and current history',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
required: ['recentConversationSummary', 'newHistoryContent'],
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=update-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-history.js","sourceRoot":"","sources":["../../../../src/prompt/function-defs/update-history.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAgB;IACxC,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,qBAAqB;IAClC,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,yBAAyB,EAAE;gBACzB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,gCAAgC;aAC9C;YACD,iBAAiB,EAAE;gBACjB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0FAA0F;aACxG;SACF;QACD,QAAQ,EAAE,CAAC,2BAA2B,EAAE,mBAAmB,CAAC;KAC7D;CACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { estimateTokenCount } from './token-estimator.js';
|
|
3
|
+
const SYSTEM_PROMPT_LIMIT = 2800;
|
|
4
|
+
const CODEGEN_PROMPT_LIMIT = 850;
|
|
5
|
+
const SOURCE_CODE_LIMIT = 100000;
|
|
6
|
+
function verifyPromptLimit(promptType, prompt, limit) {
|
|
7
|
+
const tokenCount = estimateTokenCount(prompt);
|
|
8
|
+
console.log(`${promptType} prompt estimated token count: ${tokenCount}`);
|
|
9
|
+
assert(tokenCount <= limit, `Token limit exceeded: ${tokenCount} > ${limit}`);
|
|
10
|
+
return tokenCount;
|
|
11
|
+
}
|
|
12
|
+
export function verifySystemPromptLimit(systemPrompt) {
|
|
13
|
+
return verifyPromptLimit('system', systemPrompt, SYSTEM_PROMPT_LIMIT);
|
|
14
|
+
}
|
|
15
|
+
export function verifyCodegenPromptLimit(codeGenPrompt) {
|
|
16
|
+
return verifyPromptLimit('codegen', codeGenPrompt, CODEGEN_PROMPT_LIMIT);
|
|
17
|
+
}
|
|
18
|
+
export function verifySourceCodeLimit(sourceCode) {
|
|
19
|
+
return verifyPromptLimit('sourceCode', sourceCode, SOURCE_CODE_LIMIT);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.js","sourceRoot":"","sources":["../../../src/prompt/limits.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEjC,SAAS,iBAAiB,CAAC,UAAkB,EAAE,MAAc,EAAE,KAAa;IAC1E,MAAM,UAAU,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,GAAG,UAAU,kCAAkC,UAAU,EAAE,CAAC,CAAC;IACzE,MAAM,CAAC,UAAU,IAAI,KAAK,EAAE,yBAAyB,UAAU,MAAM,KAAK,EAAE,CAAC,CAAC;IAC9E,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,YAAoB;IAC1D,OAAO,iBAAiB,CAAC,QAAQ,EAAE,YAAY,EAAE,mBAAmB,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,aAAqB;IAC5D,OAAO,iBAAiB,CAAC,SAAS,EAAE,aAAa,EAAE,oBAAoB,CAAC,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,UAAkB;IACtD,OAAO,iBAAiB,CAAC,YAAY,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { verifySystemPromptLimit, verifyCodegenPromptLimit, verifySourceCodeLimit } from './limits.js';
|
|
3
|
+
describe('Prompt Limits', () => {
|
|
4
|
+
describe('verifySystemPromptLimit', () => {
|
|
5
|
+
it('should not throw for a prompt within the limit', () => {
|
|
6
|
+
const validPrompt = 'A '.repeat(200 - 1);
|
|
7
|
+
expect(() => verifySystemPromptLimit(validPrompt)).not.toThrow();
|
|
8
|
+
});
|
|
9
|
+
it('should throw for a prompt exceeding the limit', () => {
|
|
10
|
+
const invalidPrompt = 'A '.repeat(5000);
|
|
11
|
+
expect(() => verifySystemPromptLimit(invalidPrompt)).toThrow('Token limit exceeded: 3250 > 2800');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
describe('verifyCodegenPromptLimit', () => {
|
|
15
|
+
it('should not throw for a prompt within the limit', () => {
|
|
16
|
+
const validPrompt = 'B '.repeat(200 - 1);
|
|
17
|
+
expect(() => verifyCodegenPromptLimit(validPrompt)).not.toThrow();
|
|
18
|
+
});
|
|
19
|
+
it('should throw for a prompt exceeding the limit', () => {
|
|
20
|
+
const invalidPrompt = 'B '.repeat(10000);
|
|
21
|
+
expect(() => verifyCodegenPromptLimit(invalidPrompt)).toThrow('Token limit exceeded: 6500 > 850');
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
describe('verifySourceCodeLimit', () => {
|
|
25
|
+
it('should not throw for source code within the limit', () => {
|
|
26
|
+
const validSourceCode = 'C '.repeat(40000 - 1);
|
|
27
|
+
expect(() => verifySourceCodeLimit(validSourceCode)).not.toThrow();
|
|
28
|
+
});
|
|
29
|
+
it('should throw for source code exceeding the limit', () => {
|
|
30
|
+
const invalidSourceCode = 'C '.repeat(400001);
|
|
31
|
+
expect(() => verifySourceCodeLimit(invalidSourceCode)).toThrow('Token limit exceeded: 260001 > 100000');
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=limits.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.test.js","sourceRoot":"","sources":["../../../src/prompt/limits.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEvG,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACvC,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;YACxD,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;YACzC,MAAM,CAAC,GAAG,EAAE,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACnE,CAAC,CA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MAAM,CAAC,CAAC;YAC9C,MAAM,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC,uCAAuC,CAAC,CAAC;QAC1G,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CodegenOptions } from '../main/codegen-types.js';
|
|
2
|
+
export interface CodegenPrompt {
|
|
3
|
+
prompt: string;
|
|
4
|
+
options: CodegenOptions;
|
|
5
|
+
}
|
|
6
|
+
/** Get codegen prompt */
|
|
7
|
+
export declare function getCodeGenPrompt(options: CodegenOptions): CodegenPrompt;
|
|
8
|
+
/** Get lint fix prompt */
|
|
9
|
+
export declare function getLintFixPrompt(command: string, { verbose }: CodegenOptions, stdout: string, stderr: string): string;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { getSourceCode } from '../files/read-files.js';
|
|
3
|
+
import { CODEGEN_TRIGGER } from './prompt-consts.js';
|
|
4
|
+
import { getDependencyList } from '../files/find-files.js';
|
|
5
|
+
import { verifyCodegenPromptLimit } from './limits.js';
|
|
6
|
+
import { importantContext } from '../main/config.js';
|
|
7
|
+
/** Get codegen prompt */
|
|
8
|
+
export function getCodeGenPrompt(options) {
|
|
9
|
+
let { explicitPrompt } = options;
|
|
10
|
+
const { taskFile, considerAllFiles, allowFileCreate, allowFileDelete, allowDirectoryCreate, allowFileMove, vision, imagen, dependencyTree, verbose, askQuestion, interactive, ui, } = options;
|
|
11
|
+
assert(!explicitPrompt || !taskFile, 'Both taskFile and explicitPrompt are not allowed');
|
|
12
|
+
if (taskFile) {
|
|
13
|
+
explicitPrompt = `I want you to perform a coding task. The task is described in the ${taskFile} file. Use those instructions.`;
|
|
14
|
+
}
|
|
15
|
+
let codeGenFiles = [];
|
|
16
|
+
if (!considerAllFiles) {
|
|
17
|
+
codeGenFiles = Object.entries(getSourceCode({ taskFile, forceAll: true }, options))
|
|
18
|
+
.filter(([, { content }]) => content?.match(new RegExp(`([^'^\`]+)${CODEGEN_TRIGGER}`)))
|
|
19
|
+
.map(([path]) => path);
|
|
20
|
+
}
|
|
21
|
+
// Add logic to consider dependency tree
|
|
22
|
+
if (dependencyTree) {
|
|
23
|
+
assert(codeGenFiles.length > 0, `You must use ${CODEGEN_TRIGGER} together with --dependency-tree`);
|
|
24
|
+
const dependencyTreeFiles = new Set();
|
|
25
|
+
codeGenFiles
|
|
26
|
+
.map(getDependencyList)
|
|
27
|
+
.flat()
|
|
28
|
+
.forEach((key) => dependencyTreeFiles.add(key));
|
|
29
|
+
codeGenFiles = Array.from(dependencyTreeFiles);
|
|
30
|
+
}
|
|
31
|
+
const importantTextPrompts = importantContext.textPrompts?.map((prompt) => prompt.content).join('\n\n') || '';
|
|
32
|
+
const requestPermissionText = askQuestion && (interactive || ui) ? ' (request permission via `askQuestion`)' : '';
|
|
33
|
+
const taskPrompt = explicitPrompt
|
|
34
|
+
? 'This is your task: ' + explicitPrompt + '\n\n'
|
|
35
|
+
: codeGenFiles.length > 0
|
|
36
|
+
? `I have marked some files with the ${CODEGEN_TRIGGER} fragments:\n${codeGenFiles.join('\n')}\nYour task is to generate updates for those files according to the ${CODEGEN_TRIGGER} comments/context.`
|
|
37
|
+
: `No files are marked with the ${CODEGEN_TRIGGER} fragment, so you can consider making changes in any file${askQuestion ? ', but you should consult me by asking a question first.' : ''}.`;
|
|
38
|
+
const codeGenPrompt = `${taskPrompt}
|
|
39
|
+
|
|
40
|
+
Before proceeding with code generation, please:
|
|
41
|
+
|
|
42
|
+
1. **Analyze the task and requirements**.
|
|
43
|
+
|
|
44
|
+
2. **Use the \`askQuestion\` function** to seek clarification if needed. For analysis requests, use the 'requestAnswer' actionType.
|
|
45
|
+
|
|
46
|
+
3. **When you believe code changes are necessary**, use the 'confirmCodeGeneration' actionType to confirm with the user before proceeding.
|
|
47
|
+
|
|
48
|
+
4. **Only after confirmation**, summarize the plan of updates by calling the \`codegenSummary\` function with the appropriate arguments.
|
|
49
|
+
|
|
50
|
+
- Ensure that you include:
|
|
51
|
+
- **\`explanation\`**: A brief description of the planned changes or reasoning for no changes.
|
|
52
|
+
- **\`fileUpdates\`**: A list of proposed file updates, each with required properties:
|
|
53
|
+
- **\`path\`**: Absolute file path to be updated.
|
|
54
|
+
- **\`updateToolName\`**: The tool to be used for the update (e.g., \`createFile\`, \`updateFile\`).
|
|
55
|
+
- **\`prompt\`**: A detailed prompt summarizing the planned changes for this file.
|
|
56
|
+
- **Other Properties**: Include any other necessary properties as per the \`codegenSummary\` function definition.
|
|
57
|
+
- **\`contextPaths\`**: A list of file paths that should be used as context for the code generation requests.
|
|
58
|
+
|
|
59
|
+
5. **Context Optimization**: Utilize the \`contextOptimization\` actionType to manage and optimize the context during code generation tasks. Generate a prompt using the \`contextOptimization\` property to guide the LLM in determining which parts of the context are most relevant to keep, enhancing efficiency and focus.
|
|
60
|
+
|
|
61
|
+
6. **Check ActionType Selection**: Always verify that the correct \`actionType\` is being used, especially before requesting file content, to ensure the 'requestFilesContent' actionType is applied. This helps maintain vigilance and accuracy in task execution.
|
|
62
|
+
|
|
63
|
+
## My Requirements for Task Execution:
|
|
64
|
+
|
|
65
|
+
${importantTextPrompts ? `${importantTextPrompts}\n` : ''}
|
|
66
|
+
${considerAllFiles
|
|
67
|
+
? 'You are allowed to modify all files in the application regardless of whether they contain codegen fragments.'
|
|
68
|
+
: 'Do not modify files which do not contain the fragments.'}
|
|
69
|
+
${allowFileCreate ? 'You are allowed to create new files.' : 'Do not create new files. (request permission via `askQuestion`)'}
|
|
70
|
+
${allowFileDelete
|
|
71
|
+
? 'You are allowed to delete files; in such cases, add an empty string as content.'
|
|
72
|
+
: 'Do not delete files. (request permission via `askQuestion`)'}
|
|
73
|
+
${allowDirectoryCreate
|
|
74
|
+
? 'You are allowed to create new directories.'
|
|
75
|
+
: `Do not create new directories.${requestPermissionText}`}
|
|
76
|
+
${allowFileMove ? 'You are allowed to move files.' : 'Do not move files. (request permission via `askQuestion`)'}
|
|
77
|
+
${vision ? 'You are allowed to analyze image assets.' : 'Do not analyze image assets. (request permission via `askQuestion`)'}
|
|
78
|
+
${imagen
|
|
79
|
+
? 'You are allowed to generate images.'
|
|
80
|
+
: 'You are not allowed to generate images. (request permission via `askQuestion`)'}
|
|
81
|
+
|
|
82
|
+
Remember to optimize token usage by reducing context when appropriate during askQuestion conversations. This will help avoid hitting rate limits and improve overall efficiency.
|
|
83
|
+
|
|
84
|
+
Start from generating codegen summary, this summary will be used as a context to generate updates, so make sure that it contains useful information.`;
|
|
85
|
+
if (verbose) {
|
|
86
|
+
console.log('Code gen prompt:');
|
|
87
|
+
console.log(codeGenPrompt);
|
|
88
|
+
}
|
|
89
|
+
verifyCodegenPromptLimit(codeGenPrompt);
|
|
90
|
+
return { prompt: codeGenPrompt, options };
|
|
91
|
+
}
|
|
92
|
+
/** Get lint fix prompt */
|
|
93
|
+
export function getLintFixPrompt(command, { verbose }, stdout, stderr) {
|
|
94
|
+
const lintFixPrompt = `The following lint errors were encountered after the initial code generation:
|
|
95
|
+
|
|
96
|
+
Lint command: ${command}
|
|
97
|
+
Lint command stdout:
|
|
98
|
+
|
|
99
|
+
\`\`\`
|
|
100
|
+
${stdout}
|
|
101
|
+
\`\`\`
|
|
102
|
+
|
|
103
|
+
Lint command stderr:
|
|
104
|
+
|
|
105
|
+
\`\`\`
|
|
106
|
+
${stderr}
|
|
107
|
+
\`\`\`
|
|
108
|
+
|
|
109
|
+
Please suggest changes to fix these lint errors. Use the 'requestAnswer' actionType if you need any clarifications before proposing fixes.`;
|
|
110
|
+
if (verbose) {
|
|
111
|
+
console.log('Lint fix prompt:');
|
|
112
|
+
console.log(lintFixPrompt);
|
|
113
|
+
}
|
|
114
|
+
verifyCodegenPromptLimit(lintFixPrompt);
|
|
115
|
+
return lintFixPrompt;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=prompt-codegen.js.map
|
|
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