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,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for downloadFile
|
|
3
|
+
*/
|
|
4
|
+
export const downloadFileDef = {
|
|
5
|
+
name: 'downloadFile',
|
|
6
|
+
description: 'Download file from url, and save to file',
|
|
7
|
+
parameters: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
filePath: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'The file path to save the downloaded file.',
|
|
13
|
+
},
|
|
14
|
+
downloadUrl: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'The url of the file that will be used for downloading.',
|
|
17
|
+
},
|
|
18
|
+
explanation: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'The reasoning behind downloading this image.',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
required: ['filePath', 'downloadUrl'],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=download-file-def.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-file-def.js","sourceRoot":"","sources":["../../../../src/operations/download-file/download-file-def.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAgB;IAC1C,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,0CAA0C;IACvD,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,4CAA4C;aAC1D;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,wDAAwD;aACtE;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,8CAA8C;aAC5D;SACF;QACD,QAAQ,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC;KACtC;CACF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DownloadFileArgs } from './download-file-def.js';
|
|
2
|
+
import { CodegenOptions } from '../../main/codegen-types.js';
|
|
3
|
+
declare function executeDownloadFile(args: DownloadFileArgs, options: CodegenOptions): Promise<void>;
|
|
4
|
+
export declare const executor: typeof executeDownloadFile;
|
|
5
|
+
export declare const def: import("../../ai-service/common.js").FunctionDef;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import assert from 'node:assert';
|
|
4
|
+
import { rcConfig } from '../../main/config.js';
|
|
5
|
+
import { isProjectPath } from '../../files/path-utils.js';
|
|
6
|
+
import { downloadFileDef } from './download-file-def.js';
|
|
7
|
+
import { getTempBuffer } from '../../files/temp-buffer.js';
|
|
8
|
+
async function executeDownloadFile(args, options) {
|
|
9
|
+
const { filePath, downloadUrl } = args;
|
|
10
|
+
const { allowFileCreate, allowDirectoryCreate } = options;
|
|
11
|
+
assert(filePath, 'filePath must not be empty');
|
|
12
|
+
assert(downloadUrl, 'downloadUrl must not be empty');
|
|
13
|
+
const absoluteFilePath = path.isAbsolute(filePath) ? filePath : path.join(rcConfig.rootDir, filePath);
|
|
14
|
+
if (!isProjectPath(absoluteFilePath)) {
|
|
15
|
+
console.log(`Skipping file download: ${absoluteFilePath}`);
|
|
16
|
+
throw new Error(`File ${absoluteFilePath} is not located inside project directory, something is wrong?`);
|
|
17
|
+
}
|
|
18
|
+
assert(fs.existsSync(absoluteFilePath) || allowFileCreate, 'File create option was not enabled and file does not exist');
|
|
19
|
+
if (allowDirectoryCreate) {
|
|
20
|
+
fs.mkdirSync(path.dirname(absoluteFilePath), { recursive: true });
|
|
21
|
+
}
|
|
22
|
+
console.log(`Downloading file: ${absoluteFilePath}`);
|
|
23
|
+
try {
|
|
24
|
+
if (downloadUrl.startsWith('temp://')) {
|
|
25
|
+
const tempBuffer = getTempBuffer(downloadUrl);
|
|
26
|
+
assert(tempBuffer, 'Temp buffer not present but expected');
|
|
27
|
+
fs.writeFileSync(absoluteFilePath, tempBuffer);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const response = await fetch(downloadUrl);
|
|
31
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
32
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
33
|
+
fs.writeFileSync(absoluteFilePath, buffer);
|
|
34
|
+
}
|
|
35
|
+
console.log(`File downloaded and saved to: ${absoluteFilePath}`);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error('Failed to download file:', error);
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export const executor = executeDownloadFile;
|
|
43
|
+
export const def = downloadFileDef;
|
|
44
|
+
//# sourceMappingURL=download-file-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-file-executor.js","sourceRoot":"","sources":["../../../../src/operations/download-file/download-file-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAoB,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,KAAK,UAAU,mBAAmB,CAAC,IAAsB,EAAE,OAAuB;IAChF,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IACvC,MAAM,EAAE,eAAe,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;IAE1D,MAAM,CAAC,QAAQ,EAAE,4BAA4B,CAAC,CAAC;IAC/C,MAAM,CAAC,WAAW,EAAE,+BAA+B,CAAC,CAAC;IAErD,MAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAEtG,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACrC,OAAO,CAAC,GAAG,CAAC,2BAA2B,gBAAgB,EAAE,CAAC,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,QAAQ,gBAAgB,+DAA+D,CAAC,CAAC;IAC3G,CAAC;IAED,MAAM,CACJ,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,eAAe,EAClD,4DAA4D,CAC7D,CAAC;IAEF,IAAI,oBAAoB,EAAE,CAAC;QACzB,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,qBAAqB,gBAAgB,EAAE,CAAC,CAAC;IAErD,IAAI,CAAC;QACH,IAAI,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACtC,MAAM,UAAU,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;YAC9C,MAAM,CAAC,UAAU,EAAE,sCAAsC,CAAC,CAAC;YAC3D,EAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;QACjD,CAAC;aAAM,CAAC;YACN,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,CAAC;YAC1C,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;YACjD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACxC,EAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,iCAAiC,gBAAgB,EAAE,CAAC,CAAC;IACnE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;QACjD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,mBAAmB,CAAC;AAC5C,MAAM,CAAC,MAAM,GAAG,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FunctionDef } from '../../ai-service/common';
|
|
2
|
+
/**
|
|
3
|
+
* Function definition for imglyRemoveBackground
|
|
4
|
+
*/
|
|
5
|
+
export declare const imglyRemoveBackgroundDef: FunctionDef;
|
|
6
|
+
export type ImglyRemoveBackgroundArgs = {
|
|
7
|
+
inputFilePath: string;
|
|
8
|
+
outputFilePath: string;
|
|
9
|
+
explanation?: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for imglyRemoveBackground
|
|
3
|
+
*/
|
|
4
|
+
export const imglyRemoveBackgroundDef = {
|
|
5
|
+
name: 'imglyRemoveBackground',
|
|
6
|
+
description: 'Removes background from an image using @imgly/background-removal-node',
|
|
7
|
+
parameters: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
inputFilePath: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'The file path of the input image.',
|
|
13
|
+
},
|
|
14
|
+
outputFilePath: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'The file path to save the output image with removed background.',
|
|
17
|
+
},
|
|
18
|
+
explanation: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'The explanation of the reasoning behind removing the background from this image',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
required: ['inputFilePath', 'outputFilePath'],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=imgly-remove-background-def.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imgly-remove-background-def.js","sourceRoot":"","sources":["../../../../src/operations/imgly-remove-background/imgly-remove-background-def.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAgB;IACnD,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,uEAAuE;IACpF,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,aAAa,EAAE;gBACb,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mCAAmC;aACjD;YACD,cAAc,EAAE;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iEAAiE;aAC/E;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iFAAiF;aAC/F;SACF;QACD,QAAQ,EAAE,CAAC,eAAe,EAAE,gBAAgB,CAAC;KAC9C;CACF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ImglyRemoveBackgroundArgs } from './imgly-remove-background-def.js';
|
|
2
|
+
import { CodegenOptions } from '../../main/codegen-types.js';
|
|
3
|
+
declare function executeImglyRemoveBackground(args: ImglyRemoveBackgroundArgs, options: CodegenOptions): Promise<void>;
|
|
4
|
+
export declare const executor: typeof executeImglyRemoveBackground;
|
|
5
|
+
export declare const def: import("../../ai-service/common.js").FunctionDef;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import assert from 'node:assert';
|
|
4
|
+
import { rcConfig } from '../../main/config.js';
|
|
5
|
+
import { isProjectPath } from '../../files/path-utils.js';
|
|
6
|
+
import { imglyRemoveBackgroundDef } from './imgly-remove-background-def.js';
|
|
7
|
+
import { imglyRemoveBackground } from '../../images/imgly-remove-background.js';
|
|
8
|
+
async function executeImglyRemoveBackground(args, options) {
|
|
9
|
+
const { inputFilePath, outputFilePath } = args;
|
|
10
|
+
const { allowFileCreate, allowDirectoryCreate } = options;
|
|
11
|
+
assert(inputFilePath, 'inputFilePath must not be empty');
|
|
12
|
+
assert(outputFilePath, 'outputFilePath must not be empty');
|
|
13
|
+
const absoluteInputFilePath = path.isAbsolute(inputFilePath)
|
|
14
|
+
? inputFilePath
|
|
15
|
+
: path.join(rcConfig.rootDir, inputFilePath);
|
|
16
|
+
const absoluteOutputFilePath = path.isAbsolute(outputFilePath)
|
|
17
|
+
? outputFilePath
|
|
18
|
+
: path.join(rcConfig.rootDir, outputFilePath);
|
|
19
|
+
if (!isProjectPath(absoluteInputFilePath) || !isProjectPath(absoluteOutputFilePath)) {
|
|
20
|
+
console.log(`Skipping background removal: ${absoluteInputFilePath} to ${absoluteOutputFilePath}`);
|
|
21
|
+
throw new Error(`File paths are not located inside project directory, something is wrong?`);
|
|
22
|
+
}
|
|
23
|
+
assert(fs.existsSync(absoluteInputFilePath), 'Input file does not exist');
|
|
24
|
+
assert(allowFileCreate || fs.existsSync(absoluteOutputFilePath), 'File create option was not enabled and output file does not exist');
|
|
25
|
+
if (allowDirectoryCreate) {
|
|
26
|
+
fs.mkdirSync(path.dirname(absoluteOutputFilePath), { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
console.log(`Removing background from image: ${absoluteInputFilePath}`);
|
|
29
|
+
try {
|
|
30
|
+
await imglyRemoveBackground(absoluteInputFilePath, absoluteOutputFilePath);
|
|
31
|
+
console.log(`Background removed and image saved to: ${absoluteOutputFilePath}`);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.error('Failed to remove background', error);
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export const executor = executeImglyRemoveBackground;
|
|
39
|
+
export const def = imglyRemoveBackgroundDef;
|
|
40
|
+
//# sourceMappingURL=imgly-remove-background-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imgly-remove-background-executor.js","sourceRoot":"","sources":["../../../../src/operations/imgly-remove-background/imgly-remove-background-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAA6B,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAEvG,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAEhF,KAAK,UAAU,4BAA4B,CAAC,IAA+B,EAAE,OAAuB;IAClG,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;IAC/C,MAAM,EAAE,eAAe,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;IAE1D,MAAM,CAAC,aAAa,EAAE,iCAAiC,CAAC,CAAC;IACzD,MAAM,CAAC,cAAc,EAAE,kCAAkC,CAAC,CAAC;IAE3D,MAAM,qBAAqB,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;QAC1D,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC/C,MAAM,sBAAsB,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC;QAC5D,CAAC,CAAC,cAAc;QAChB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAEhD,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,IAAI,CAAC,aAAa,CAAC,sBAAsB,CAAC,EAAE,CAAC;QACpF,OAAO,CAAC,GAAG,CAAC,gCAAgC,qBAAqB,OAAO,sBAAsB,EAAE,CAAC,CAAC;QAClG,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;IAC9F,CAAC;IAED,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,qBAAqB,CAAC,EAAE,2BAA2B,CAAC,CAAC;IAC1E,MAAM,CACJ,eAAe,IAAI,EAAE,CAAC,UAAU,CAAC,sBAAsB,CAAC,EACxD,mEAAmE,CACpE,CAAC;IAEF,IAAI,oBAAoB,EAAE,CAAC;QACzB,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,mCAAmC,qBAAqB,EAAE,CAAC,CAAC;IAExE,IAAI,CAAC;QACH,MAAM,qBAAqB,CAAC,qBAAqB,EAAE,sBAAsB,CAAC,CAAC;QAC3E,OAAO,CAAC,GAAG,CAAC,0CAA0C,sBAAsB,EAAE,CAAC,CAAC;IAClF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;QACpD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AACrD,MAAM,CAAC,MAAM,GAAG,GAAG,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for moveFile
|
|
3
|
+
*/
|
|
4
|
+
export const moveFileDef = {
|
|
5
|
+
name: 'moveFile',
|
|
6
|
+
description: 'Move a file from one location to another',
|
|
7
|
+
parameters: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
explanation: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'The explanation of the reasoning behind moving this file',
|
|
13
|
+
},
|
|
14
|
+
source: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'The current file path.',
|
|
17
|
+
},
|
|
18
|
+
destination: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'The new file path.',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
required: ['source', 'destination'],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=move-file-def.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"move-file-def.js","sourceRoot":"","sources":["../../../../src/operations/move-file/move-file-def.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAgB;IACtC,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,0CAA0C;IACvD,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0DAA0D;aACxE;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,wBAAwB;aACtC;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,oBAAoB;aAClC;SACF;QACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC;KACpC;CACF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MoveFileArgs } from './move-file-def.js';
|
|
2
|
+
import { CodegenOptions } from '../../main/codegen-types.js';
|
|
3
|
+
declare function executeMoveFile(args: MoveFileArgs, options: CodegenOptions): Promise<void>;
|
|
4
|
+
export declare const executor: typeof executeMoveFile;
|
|
5
|
+
export declare const def: import("../../ai-service/common.js").FunctionDef;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import assert from 'node:assert';
|
|
4
|
+
import { rcConfig } from '../../main/config.js';
|
|
5
|
+
import { isProjectPath } from '../../files/path-utils.js';
|
|
6
|
+
import { moveFileDef } from './move-file-def.js';
|
|
7
|
+
async function executeMoveFile(args, options) {
|
|
8
|
+
const { source, destination } = args;
|
|
9
|
+
const { allowFileMove, allowDirectoryCreate } = options;
|
|
10
|
+
assert(source, 'source must not be empty');
|
|
11
|
+
assert(destination, 'destination must not be empty');
|
|
12
|
+
const absoluteSource = path.isAbsolute(source) ? source : path.join(rcConfig.rootDir, source);
|
|
13
|
+
const absoluteDestination = path.isAbsolute(destination) ? destination : path.join(rcConfig.rootDir, destination);
|
|
14
|
+
if (!isProjectPath(absoluteSource) || !isProjectPath(absoluteDestination)) {
|
|
15
|
+
console.log(`Skipping file move: ${absoluteSource} to ${absoluteDestination}`);
|
|
16
|
+
throw new Error(`File move operation is not within the project directory, something is wrong?`);
|
|
17
|
+
}
|
|
18
|
+
assert(allowFileMove, 'File move option was not enabled');
|
|
19
|
+
assert(fs.existsSync(absoluteSource), 'Source file does not exist');
|
|
20
|
+
assert(!fs.existsSync(absoluteDestination), 'Destination file already exists');
|
|
21
|
+
console.log(`Moving file from ${absoluteSource} to ${absoluteDestination}`);
|
|
22
|
+
if (allowDirectoryCreate) {
|
|
23
|
+
fs.mkdirSync(path.dirname(absoluteDestination), { recursive: true });
|
|
24
|
+
}
|
|
25
|
+
fs.renameSync(absoluteSource, absoluteDestination);
|
|
26
|
+
}
|
|
27
|
+
export const executor = executeMoveFile;
|
|
28
|
+
export const def = moveFileDef;
|
|
29
|
+
//# sourceMappingURL=move-file-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"move-file-executor.js","sourceRoot":"","sources":["../../../../src/operations/move-file/move-file-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAgB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAG/D,KAAK,UAAU,eAAe,CAAC,IAAkB,EAAE,OAAuB;IACxE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IACrC,MAAM,EAAE,aAAa,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;IAExD,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;IAC3C,MAAM,CAAC,WAAW,EAAE,+BAA+B,CAAC,CAAC;IAErD,MAAM,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9F,MAAM,mBAAmB,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAElH,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,EAAE,CAAC;QAC1E,OAAO,CAAC,GAAG,CAAC,uBAAuB,cAAc,OAAO,mBAAmB,EAAE,CAAC,CAAC;QAC/E,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;IAClG,CAAC;IAED,MAAM,CAAC,aAAa,EAAE,kCAAkC,CAAC,CAAC;IAC1D,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,4BAA4B,CAAC,CAAC;IACpE,MAAM,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,iCAAiC,CAAC,CAAC;IAE/E,OAAO,CAAC,GAAG,CAAC,oBAAoB,cAAc,OAAO,mBAAmB,EAAE,CAAC,CAAC;IAE5E,IAAI,oBAAoB,EAAE,CAAC;QACzB,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvE,CAAC;IAED,EAAE,CAAC,UAAU,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC;AACxC,MAAM,CAAC,MAAM,GAAG,GAAG,WAAW,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getRegisteredOperations } from '../main/plugin-loader.js';
|
|
2
|
+
import * as createDirectory from './create-directory/create-directory-executor.js';
|
|
3
|
+
import * as createFile from './create-file/create-file-executor.js';
|
|
4
|
+
import * as updateFile from './update-file/update-file-executor.js';
|
|
5
|
+
import * as patchFile from './patch-file/patch-file-executor.js';
|
|
6
|
+
import * as deleteFile from './delete-file/delete-file-executor.js';
|
|
7
|
+
import * as moveFile from './move-file/move-file-executor.js';
|
|
8
|
+
import * as downloadFile from './download-file/download-file-executor.js';
|
|
9
|
+
import * as splitImage from './split-image/split-image-executor.js';
|
|
10
|
+
import * as resizeImage from './resize-image/resize-image-executor.js';
|
|
11
|
+
import * as imglyRemoveBackground from './imgly-remove-background/imgly-remove-background-executor.js';
|
|
12
|
+
const INDEX = [
|
|
13
|
+
createDirectory,
|
|
14
|
+
createFile,
|
|
15
|
+
updateFile,
|
|
16
|
+
patchFile,
|
|
17
|
+
deleteFile,
|
|
18
|
+
moveFile,
|
|
19
|
+
downloadFile,
|
|
20
|
+
splitImage,
|
|
21
|
+
resizeImage,
|
|
22
|
+
imglyRemoveBackground,
|
|
23
|
+
];
|
|
24
|
+
function getOperations() {
|
|
25
|
+
return [...getRegisteredOperations(), ...INDEX];
|
|
26
|
+
}
|
|
27
|
+
export function getOperationExecutor(name) {
|
|
28
|
+
return getOperations().find((operation) => operation.def.name === name)?.executor;
|
|
29
|
+
}
|
|
30
|
+
export function getOperationDefs() {
|
|
31
|
+
return getOperations().map((operation) => operation.def);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=operations-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations-index.js","sourceRoot":"","sources":["../../../src/operations/operations-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAGnE,OAAO,KAAK,eAAe,MAAM,iDAAiD,CAAC;AACnF,OAAO,KAAK,UAAU,MAAM,uCAAuC,CAAC;AACpE,OAAO,KAAK,UAAU,MAAM,uCAAuC,CAAC;AACpE,OAAO,KAAK,SAAS,MAAM,qCAAqC,CAAC;AACjE,OAAO,KAAK,UAAU,MAAM,uCAAuC,CAAC;AACpE,OAAO,KAAK,QAAQ,MAAM,mCAAmC,CAAC;AAC9D,OAAO,KAAK,YAAY,MAAM,2CAA2C,CAAC;AAC1E,OAAO,KAAK,UAAU,MAAM,uCAAuC,CAAC;AACpE,OAAO,KAAK,WAAW,MAAM,yCAAyC,CAAC;AACvE,OAAO,KAAK,qBAAqB,MAAM,+DAA+D,CAAC;AAEvG,MAAM,KAAK,GAAG;IACZ,eAAe;IACf,UAAU;IACV,UAAU;IACV,SAAS;IACT,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,WAAW;IACX,qBAAqB;CACb,CAAC;AAEX,SAAS,aAAa;IACpB,OAAO,CAAC,GAAG,uBAAuB,EAAE,EAAE,GAAG,KAAK,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,OAAO,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,QAAyC,CAAC;AACrH,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,aAAa,EAAE,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for patchFile
|
|
3
|
+
*/
|
|
4
|
+
export const patchFileDef = {
|
|
5
|
+
name: 'patchFile',
|
|
6
|
+
description: 'Partially update a file content. The file must already exists in the application source code. The function should be called only if there is a need to actually change something.',
|
|
7
|
+
parameters: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
filePath: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'The file path to patch.',
|
|
13
|
+
},
|
|
14
|
+
explanation: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'The explanation of the reasoning behind the suggested code changes for this file',
|
|
17
|
+
},
|
|
18
|
+
patch: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: `Modification to the file expressed in patch format. Example patch:
|
|
21
|
+
|
|
22
|
+
\`\`\`
|
|
23
|
+
Index: filename.js
|
|
24
|
+
===================================================================
|
|
25
|
+
--- filename.js
|
|
26
|
+
+++ filename.js
|
|
27
|
+
@@ -1,2 +1,3 @@
|
|
28
|
+
line1
|
|
29
|
+
+line3
|
|
30
|
+
line2
|
|
31
|
+
\
|
|
32
|
+
\`\`\`
|
|
33
|
+
`,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
required: ['filePath', 'patch'],
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=patch-file-def.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch-file-def.js","sourceRoot":"","sources":["../../../../src/operations/patch-file/patch-file-def.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAgB;IACvC,IAAI,EAAE,WAAW;IACjB,WAAW,EACT,mLAAmL;IACrL,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yBAAyB;aACvC;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,kFAAkF;aAChG;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;;;;;;;;;;;;;WAaV;aACJ;SACF;QACD,QAAQ,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC;KAChC;CACF,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PatchFileArgs } from './patch-file-def.js';
|
|
2
|
+
declare function executePatchFile(args: PatchFileArgs): Promise<void>;
|
|
3
|
+
export declare const executor: typeof executePatchFile;
|
|
4
|
+
export declare const def: import("../../ai-service/common.js").FunctionDef;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import assert from 'node:assert';
|
|
4
|
+
import * as diff from 'diff';
|
|
5
|
+
import { rcConfig } from '../../main/config.js';
|
|
6
|
+
import { isProjectPath } from '../../files/path-utils.js';
|
|
7
|
+
import { patchFileDef } from './patch-file-def.js';
|
|
8
|
+
async function executePatchFile(args) {
|
|
9
|
+
const { filePath, patch } = args;
|
|
10
|
+
assert(filePath, 'filePath must not be empty');
|
|
11
|
+
assert(patch, 'patch must not be empty');
|
|
12
|
+
const absoluteFilePath = path.isAbsolute(filePath) ? filePath : path.join(rcConfig.rootDir, filePath);
|
|
13
|
+
if (!isProjectPath(absoluteFilePath)) {
|
|
14
|
+
console.log(`Skipping file: ${absoluteFilePath}`);
|
|
15
|
+
throw new Error(`File ${absoluteFilePath} is not located inside project directory, something is wrong?`);
|
|
16
|
+
}
|
|
17
|
+
console.log(`Applying a patch: ${absoluteFilePath} content`);
|
|
18
|
+
assert(fs.existsSync(absoluteFilePath), 'File does not exist');
|
|
19
|
+
const originalContent = fs.readFileSync(absoluteFilePath, 'utf-8');
|
|
20
|
+
const newContent = diff.applyPatch(originalContent, patch);
|
|
21
|
+
assert(newContent !== false, 'Patch was not successful');
|
|
22
|
+
fs.writeFileSync(absoluteFilePath, newContent, 'utf-8');
|
|
23
|
+
}
|
|
24
|
+
export const executor = executePatchFile;
|
|
25
|
+
export const def = patchFileDef;
|
|
26
|
+
//# sourceMappingURL=patch-file-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch-file-executor.js","sourceRoot":"","sources":["../../../../src/operations/patch-file/patch-file-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAiB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAElE,KAAK,UAAU,gBAAgB,CAAC,IAAmB;IACjD,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAEjC,MAAM,CAAC,QAAQ,EAAE,4BAA4B,CAAC,CAAC;IAC/C,MAAM,CAAC,KAAK,EAAE,yBAAyB,CAAC,CAAC;IAEzC,MAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAEtG,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACrC,OAAO,CAAC,GAAG,CAAC,kBAAkB,gBAAgB,EAAE,CAAC,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,QAAQ,gBAAgB,+DAA+D,CAAC,CAAC;IAC3G,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,qBAAqB,gBAAgB,UAAU,CAAC,CAAC;IAC7D,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,qBAAqB,CAAC,CAAC;IAE/D,MAAM,eAAe,GAAG,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACnE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IAE3D,MAAM,CAAC,UAAU,KAAK,KAAK,EAAE,0BAA0B,CAAC,CAAC;IAEzD,EAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,gBAAgB,CAAC;AACzC,MAAM,CAAC,MAAM,GAAG,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FunctionDef } from '../../ai-service/common';
|
|
2
|
+
/**
|
|
3
|
+
* Function definition for resizeImage
|
|
4
|
+
*/
|
|
5
|
+
export declare const resizeImageDef: FunctionDef;
|
|
6
|
+
export type ResizeImageArgs = {
|
|
7
|
+
filePath: string;
|
|
8
|
+
size: {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
};
|
|
12
|
+
explanation?: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for resizeImage
|
|
3
|
+
*/
|
|
4
|
+
export const resizeImageDef = {
|
|
5
|
+
name: 'resizeImage',
|
|
6
|
+
description: 'Resize image to the desired size',
|
|
7
|
+
parameters: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
filePath: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'The file path of the image.',
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
width: {
|
|
18
|
+
type: 'number',
|
|
19
|
+
description: 'width of the image',
|
|
20
|
+
},
|
|
21
|
+
height: {
|
|
22
|
+
type: 'number',
|
|
23
|
+
description: 'height of the image',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
required: ['width', 'height'],
|
|
27
|
+
description: 'The size of the image to generate.',
|
|
28
|
+
},
|
|
29
|
+
explanation: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'The explanation of the reasoning behind resizing this image',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
required: ['filePath', 'size'],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=resize-image-def.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resize-image-def.js","sourceRoot":"","sources":["../../../../src/operations/resize-image/resize-image-def.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAgB;IACzC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,kCAAkC;IAC/C,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,6BAA6B;aAC3C;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,oBAAoB;qBAClC;oBACD,MAAM,EAAE;wBACN,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,qBAAqB;qBACnC;iBACF;gBACD,QAAQ,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;gBAC7B,WAAW,EAAE,oCAAoC;aAClD;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,6DAA6D;aAC3E;SACF;QACD,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC;KAC/B;CACF,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ResizeImageArgs } from './resize-image-def.js';
|
|
2
|
+
declare function executeResizeImage(args: ResizeImageArgs): Promise<void>;
|
|
3
|
+
export declare const executor: typeof executeResizeImage;
|
|
4
|
+
export declare const def: import("../../ai-service/common.js").FunctionDef;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import assert from 'node:assert';
|
|
4
|
+
import { rcConfig } from '../../main/config.js';
|
|
5
|
+
import { isProjectPath } from '../../files/path-utils.js';
|
|
6
|
+
import { resizeImageDef } from './resize-image-def.js';
|
|
7
|
+
import { resizeImageFile } from '../../images/resize-image.js';
|
|
8
|
+
async function executeResizeImage(args) {
|
|
9
|
+
const { filePath, size } = args;
|
|
10
|
+
assert(filePath, 'filePath must not be empty');
|
|
11
|
+
assert(size && size.width && size.height, 'size with width and height must be provided');
|
|
12
|
+
const absoluteFilePath = path.isAbsolute(filePath) ? filePath : path.join(rcConfig.rootDir, filePath);
|
|
13
|
+
if (!isProjectPath(absoluteFilePath)) {
|
|
14
|
+
console.log(`Skipping image resize: ${absoluteFilePath}`);
|
|
15
|
+
throw new Error(`File ${absoluteFilePath} is not located inside project directory, something is wrong?`);
|
|
16
|
+
}
|
|
17
|
+
assert(fs.existsSync(absoluteFilePath), 'Input file does not exist');
|
|
18
|
+
console.log(`Resizing image: ${absoluteFilePath}`, size);
|
|
19
|
+
try {
|
|
20
|
+
await resizeImageFile(absoluteFilePath, { width: size.width, height: size.height });
|
|
21
|
+
console.log(`Image resized successfully`);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
console.error('Failed to resize image', error);
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export const executor = executeResizeImage;
|
|
29
|
+
export const def = resizeImageDef;
|
|
30
|
+
//# sourceMappingURL=resize-image-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resize-image-executor.js","sourceRoot":"","sources":["../../../../src/operations/resize-image/resize-image-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAmB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,KAAK,UAAU,kBAAkB,CAAC,IAAqB;IACrD,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEhC,MAAM,CAAC,QAAQ,EAAE,4BAA4B,CAAC,CAAC;IAC/C,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,6CAA6C,CAAC,CAAC;IAEzF,MAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAEtG,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACrC,OAAO,CAAC,GAAG,CAAC,0BAA0B,gBAAgB,EAAE,CAAC,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,QAAQ,gBAAgB,+DAA+D,CAAC,CAAC;IAC3G,CAAC;IAED,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,2BAA2B,CAAC,CAAC;IAErE,OAAO,CAAC,GAAG,CAAC,mBAAmB,gBAAgB,EAAE,EAAE,IAAI,CAAC,CAAC;IAEzD,IAAI,CAAC;QACH,MAAM,eAAe,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACpF,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QAC/C,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AAC3C,MAAM,CAAC,MAAM,GAAG,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FunctionDef } from '../../ai-service/common';
|
|
2
|
+
/**
|
|
3
|
+
* Function definition for splitImage
|
|
4
|
+
*/
|
|
5
|
+
export declare const splitImageDef: FunctionDef;
|
|
6
|
+
export type SplitImageArgs = {
|
|
7
|
+
inputFilePath: string;
|
|
8
|
+
parts: Array<{
|
|
9
|
+
rect: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
outputFilePath: string;
|
|
16
|
+
}>;
|
|
17
|
+
explanation?: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for splitImage
|
|
3
|
+
*/
|
|
4
|
+
export const splitImageDef = {
|
|
5
|
+
name: 'splitImage',
|
|
6
|
+
description: 'Split an image into multiple parts and save them as separate files.',
|
|
7
|
+
parameters: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
inputFilePath: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'The file path of the input image to be split.',
|
|
13
|
+
},
|
|
14
|
+
parts: {
|
|
15
|
+
type: 'array',
|
|
16
|
+
items: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
rect: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
x: { type: 'number', description: 'The x-coordinate of the top-left corner of the rectangle.' },
|
|
23
|
+
y: { type: 'number', description: 'The y-coordinate of the top-left corner of the rectangle.' },
|
|
24
|
+
width: { type: 'number', description: 'The width of the rectangle.' },
|
|
25
|
+
height: { type: 'number', description: 'The height of the rectangle.' },
|
|
26
|
+
},
|
|
27
|
+
required: ['x', 'y', 'width', 'height'],
|
|
28
|
+
},
|
|
29
|
+
outputFilePath: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'The file path to save the extracted part of the image.',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
required: ['rect', 'outputFilePath'],
|
|
35
|
+
},
|
|
36
|
+
description: 'An array of parts to extract from the image, each with a rectangle and output file path.',
|
|
37
|
+
},
|
|
38
|
+
explanation: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
description: 'The explanation of the reasoning behind splitting this image',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
required: ['inputFilePath', 'parts'],
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=split-image-def.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-image-def.js","sourceRoot":"","sources":["../../../../src/operations/split-image/split-image-def.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAgB;IACxC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,qEAAqE;IAClF,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,aAAa,EAAE;gBACb,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+CAA+C;aAC7D;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,IAAI,EAAE;4BACJ,IAAI,EAAE,QAAQ;4BACd,UAAU,EAAE;gCACV,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2DAA2D,EAAE;gCAC/F,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2DAA2D,EAAE;gCAC/F,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;gCACrE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8BAA8B,EAAE;6BACxE;4BACD,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC;yBACxC;wBACD,cAAc,EAAE;4BACd,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,wDAAwD;yBACtE;qBACF;oBACD,QAAQ,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC;iBACrC;gBACD,WAAW,EAAE,0FAA0F;aACxG;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,8DAA8D;aAC5E;SACF;QACD,QAAQ,EAAE,CAAC,eAAe,EAAE,OAAO,CAAC;KACrC;CACF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SplitImageArgs } from './split-image-def.js';
|
|
2
|
+
import { CodegenOptions } from '../../main/codegen-types.js';
|
|
3
|
+
declare function executeSplitImage(args: SplitImageArgs, options: CodegenOptions): Promise<void>;
|
|
4
|
+
export declare const executor: typeof executeSplitImage;
|
|
5
|
+
export declare const def: import("../../ai-service/common.js").FunctionDef;
|
|
6
|
+
export {};
|