genaicode 0.14.1 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-service/ai-studio.d.ts +2 -18
- package/dist/ai-service/ai-studio.js +88 -32
- package/dist/ai-service/ai-studio.js.map +1 -1
- package/dist/ai-service/anthropic.js +87 -45
- package/dist/ai-service/anthropic.js.map +1 -1
- package/dist/ai-service/common-types.d.ts +36 -3
- package/dist/ai-service/common-types.js +0 -2
- package/dist/ai-service/common-types.js.map +1 -1
- package/dist/ai-service/common.js +0 -2
- package/dist/ai-service/common.js.map +1 -1
- package/dist/ai-service/files-api.d.ts +33 -0
- package/dist/ai-service/files-api.js +239 -0
- package/dist/ai-service/files-api.js.map +1 -0
- package/dist/ai-service/github-models.js +0 -2
- package/dist/ai-service/github-models.js.map +1 -1
- package/dist/ai-service/local-llm.js +0 -4
- package/dist/ai-service/local-llm.js.map +1 -1
- package/dist/ai-service/openai-responses.js +62 -16
- package/dist/ai-service/openai-responses.js.map +1 -1
- package/dist/ai-service/openai.js +157 -54
- package/dist/ai-service/openai.js.map +1 -1
- package/dist/ai-service/service-configurations-types.d.ts +0 -1
- package/dist/ai-service/service-configurations.js +19 -20
- package/dist/ai-service/service-configurations.js.map +1 -1
- package/dist/ai-service/vertex-ai.js +2 -1
- package/dist/ai-service/vertex-ai.js.map +1 -1
- package/dist/cli/cli-params.js +2 -2
- package/dist/cli/cli-params.js.map +1 -1
- package/dist/files/file-id-utils.js +1 -1
- package/dist/files/file-id-utils.js.map +1 -1
- package/dist/files/read-files.js +10 -6
- package/dist/files/read-files.js.map +1 -1
- package/dist/files/source-code-types.d.ts +9 -5
- package/dist/files/source-code-utils.d.ts +2 -1
- package/dist/files/source-code-utils.js +30 -12
- package/dist/files/source-code-utils.js.map +1 -1
- package/dist/files/summary-cache.d.ts +6 -4
- package/dist/files/summary-cache.js +3 -2
- package/dist/files/summary-cache.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main/codegen-types.d.ts +2 -2
- package/dist/main/common/content-bus-types.d.ts +14 -0
- package/dist/main/common/content-bus.d.ts +3 -1
- package/dist/main/common/content-bus.js +28 -3
- package/dist/main/common/content-bus.js.map +1 -1
- package/dist/main/common/user-actions.d.ts +1 -1
- package/dist/main/config-types.d.ts +0 -3
- package/dist/main/config-types.js.map +1 -1
- package/dist/main/config.js +1 -1
- package/dist/main/config.js.map +1 -1
- package/dist/main/plugin-loader.d.ts +1 -1
- package/dist/main/ui/backend/endpoints/compress-context-endpoint.d.ts +1 -0
- package/dist/main/ui/backend/endpoints/compress-context-endpoint.js +18 -0
- package/dist/main/ui/backend/endpoints/compress-context-endpoint.js.map +1 -0
- package/dist/main/ui/backend/endpoints/config-endpoint.js +1 -1
- package/dist/main/ui/backend/endpoints/config-endpoint.js.map +1 -1
- package/dist/main/ui/backend/endpoints/context-endpoint.js +102 -0
- package/dist/main/ui/backend/endpoints/context-endpoint.js.map +1 -1
- package/dist/main/ui/backend/endpoints/edit-message-endpoint.js +9 -6
- package/dist/main/ui/backend/endpoints/edit-message-endpoint.js.map +1 -1
- package/dist/main/ui/backend/endpoints/index.d.ts +1 -0
- package/dist/main/ui/backend/endpoints/index.js +1 -0
- package/dist/main/ui/backend/endpoints/index.js.map +1 -1
- package/dist/main/ui/backend/endpoints/interrupt-execution-endpoint.js +1 -1
- package/dist/main/ui/backend/endpoints/interrupt-execution-endpoint.js.map +1 -1
- package/dist/main/ui/backend/service.d.ts +68 -7
- package/dist/main/ui/backend/service.js +301 -28
- package/dist/main/ui/backend/service.js.map +1 -1
- package/dist/main/ui/codegen-ui.js +2 -2
- package/dist/main/ui/codegen-ui.js.map +1 -1
- package/dist/main/ui/common/api-types.d.ts +6 -2
- package/dist/main/ui/common/api-types.js.map +1 -1
- package/dist/main/ui/frontend/assets/index-DAM_kJhM.js +3445 -0
- package/dist/main/ui/frontend/index.html +1 -1
- package/dist/prompt/context-utils.d.ts +7 -0
- package/dist/prompt/context-utils.js +33 -0
- package/dist/prompt/context-utils.js.map +1 -0
- package/dist/prompt/function-calling.js +4 -5
- package/dist/prompt/function-calling.js.map +1 -1
- package/dist/prompt/function-defs/code-execution.d.ts +7 -0
- package/dist/prompt/function-defs/code-execution.js +27 -0
- package/dist/prompt/function-defs/code-execution.js.map +1 -0
- package/dist/prompt/function-defs/conversation-graph.d.ts +1 -1
- package/dist/prompt/function-defs/conversation-graph.js +1 -1
- package/dist/prompt/function-defs/conversation-graph.js.map +1 -1
- package/dist/prompt/function-defs/get-source-code.js +3 -3
- package/dist/prompt/function-defs/iterate.d.ts +20 -0
- package/dist/prompt/function-defs/iterate.js +373 -0
- package/dist/prompt/function-defs/iterate.js.map +1 -0
- package/dist/prompt/function-defs/set-summaries.js +6 -2
- package/dist/prompt/function-defs/set-summaries.js.map +1 -1
- package/dist/prompt/limits.js +1 -1
- package/dist/prompt/prompt-service.js +13 -10
- package/dist/prompt/prompt-service.js.map +1 -1
- package/dist/prompt/source-code-optimize.d.ts +2 -0
- package/dist/prompt/source-code-optimize.js +27 -0
- package/dist/prompt/source-code-optimize.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question.js +7 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -1
- package/dist/prompt/steps/step-codegen-planning.js +6 -2
- package/dist/prompt/steps/step-codegen-planning.js.map +1 -1
- package/dist/prompt/steps/step-context-compression.js +5 -0
- package/dist/prompt/steps/step-context-compression.js.map +1 -1
- package/dist/prompt/steps/step-context-optimization.js +6 -3
- package/dist/prompt/steps/step-context-optimization.js.map +1 -1
- package/dist/prompt/steps/step-iterate/handlers/container-task/command-execution-loop.d.ts +7 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/command-execution-loop.js +301 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/command-execution-loop.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/complete-task.d.ts +4 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/complete-task.js +49 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/complete-task.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-from-container.d.ts +4 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-from-container.js +190 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-from-container.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-to-container.d.ts +4 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-to-container.js +139 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-to-container.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/edit-file.d.ts +10 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/edit-file.js +93 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/edit-file.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/fail-task.d.ts +4 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/fail-task.js +72 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/fail-task.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/gain-knowledge.d.ts +10 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/gain-knowledge.js +125 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/gain-knowledge.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/interrupt-controller.d.ts +19 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/interrupt-controller.js +33 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/interrupt-controller.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/query-knowledge.d.ts +8 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/query-knowledge.js +85 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/query-knowledge.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/request-secret.d.ts +6 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/request-secret.js +122 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/request-secret.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/run-command.d.ts +7 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/run-command.js +146 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/run-command.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/send-message.d.ts +4 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/send-message.js +56 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/send-message.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/set-execution-plan.d.ts +4 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/set-execution-plan.js +56 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/set-execution-plan.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/update-execution-plan.d.ts +4 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/update-execution-plan.js +39 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/update-execution-plan.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/view-file.d.ts +10 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/view-file.js +95 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/view-file.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/web-search.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/web-search.js +96 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/web-search.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/wrap-context.d.ts +4 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/wrap-context.js +123 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/commands/wrap-context.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-registry.d.ts +11 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-registry.js +50 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-registry.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-types.d.ts +28 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-types.js +2 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-types.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/container-task-orchestrator.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/container-task-orchestrator.js +202 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/container-task-orchestrator.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-check.d.ts +4 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-check.js +15 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-check.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-utils.d.ts +50 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-utils.js +358 -0
- package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-utils.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/file-request-utils.d.ts +47 -0
- package/dist/prompt/steps/step-iterate/handlers/file-request-utils.js +114 -0
- package/dist/prompt/steps/step-iterate/handlers/file-request-utils.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-code-execution.d.ts +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-code-execution.js +133 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-code-execution.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-code-generation.d.ts +4 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-code-generation.js +177 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-code-generation.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-compound-action.d.ts +20 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-compound-action.js +305 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-compound-action.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-confirm-code-generation.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-confirm-code-generation.js +40 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-confirm-code-generation.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-context-compression.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-context-compression.js +35 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-context-compression.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-context-optimization.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-context-optimization.js +34 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-context-optimization.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-conversation-graph.d.ts +11 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-conversation-graph.js +503 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-conversation-graph.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-create-file.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-create-file.js +159 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-create-file.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-end-conversation.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-end-conversation.js +30 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-end-conversation.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-explore-external-directories.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-explore-external-directories.js +280 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-explore-external-directories.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-genaicode-help.d.ts +8 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-genaicode-help.js +105 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-genaicode-help.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-generate-image.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-generate-image.js +110 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-generate-image.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-perform-analysis.d.ts +6 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-perform-analysis.js +110 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-perform-analysis.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-project-command.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-project-command.js +280 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-project-command.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-pull-app-context.d.ts +9 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-pull-app-context.js +94 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-pull-app-context.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-pull-console-logs.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-pull-console-logs.js +174 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-pull-console-logs.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-push-app-context.d.ts +9 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-push-app-context.js +104 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-push-app-context.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-read-external-files.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-read-external-files.js +149 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-read-external-files.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-reasoning-inference.d.ts +7 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-reasoning-inference.js +119 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-reasoning-inference.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-remove-files-from-context.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-remove-files-from-context.js +100 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-remove-files-from-context.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-request-files-content.d.ts +8 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-request-files-content.js +146 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-request-files-content.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-request-files-fragments.d.ts +8 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-request-files-fragments.js +197 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-request-files-fragments.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-request-git-context.d.ts +3 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-request-git-context.js +251 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-request-git-context.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-request-permissions.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-request-permissions.js +83 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-request-permissions.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-run-bash-command.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-run-bash-command.js +185 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-run-bash-command.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-run-container-task.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-run-container-task.js +7 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-run-container-task.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-search-code.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-search-code.js +96 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-search-code.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-send-message.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-send-message.js +21 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-send-message.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-structured-question.d.ts +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-structured-question.js +72 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-structured-question.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-update-file.d.ts +2 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-update-file.js +161 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-update-file.js.map +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-web-search.d.ts +1 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-web-search.js +85 -0
- package/dist/prompt/steps/step-iterate/handlers/handle-web-search.js.map +1 -0
- package/dist/prompt/steps/step-iterate/iterate-handler.d.ts +4 -0
- package/dist/prompt/steps/step-iterate/iterate-handler.js +14 -0
- package/dist/prompt/steps/step-iterate/iterate-handler.js.map +1 -0
- package/dist/prompt/steps/step-iterate/step-iterate-handlers.d.ts +3 -0
- package/dist/prompt/steps/step-iterate/step-iterate-handlers.js +5 -0
- package/dist/prompt/steps/step-iterate/step-iterate-handlers.js.map +1 -0
- package/dist/prompt/steps/step-iterate/step-iterate-types.d.ts +255 -0
- package/dist/prompt/steps/step-iterate/step-iterate-types.js +2 -0
- package/dist/prompt/steps/step-iterate/step-iterate-types.js.map +1 -0
- package/dist/prompt/steps/step-iterate/step-iterate.d.ts +37 -0
- package/dist/prompt/steps/step-iterate/step-iterate.js +132 -0
- package/dist/prompt/steps/step-iterate/step-iterate.js.map +1 -0
- package/dist/prompt/steps/step-summarization.js +9 -19
- package/dist/prompt/steps/step-summarization.js.map +1 -1
- package/dist/prompt/systemprompt.js +93 -168
- package/dist/prompt/systemprompt.js.map +1 -1
- package/dist/prompt/token-estimator.js +1 -1
- package/dist/prompt/token-estimator.js.map +1 -1
- package/dist/vite-genaicode/console-interceptor.d.ts +19 -6
- package/dist/vite-genaicode/console-interceptor.js +45 -13
- package/dist/vite-genaicode/console-interceptor.js.map +1 -1
- package/dist/vite-genaicode/vite-genaicode-frontend.js +1 -1
- package/dist/vite-genaicode/vite-genaicode-frontend.js.map +1 -1
- package/package.json +7 -6
- package/dist/main/ui/frontend/assets/index-5-emJmrg.js +0 -2881
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
import { putAssistantMessage, putSystemMessage, putUserMessage } from '../../../../main/common/content-bus.js';
|
|
2
|
+
import { ModelType } from '../../../../ai-service/common-types.js';
|
|
3
|
+
import { getFunctionDefs } from '../../../function-calling.js';
|
|
4
|
+
import { registerActionHandler } from '../step-iterate-handlers.js';
|
|
5
|
+
import { getActionHandler } from '../iterate-handler.js';
|
|
6
|
+
import { askUserForConfirmationWithAnswer } from '../../../../main/common/user-actions.js';
|
|
7
|
+
export const CONVERSATION_GRAPH_PROMPT = `# Conversation Graph Guide
|
|
8
|
+
|
|
9
|
+
A conversation graph is a flexible structure for managing complex interactions. It consists of nodes (conversation states) connected by edges (transitions).
|
|
10
|
+
|
|
11
|
+
## Core Components
|
|
12
|
+
|
|
13
|
+
1. **Nodes (States)**
|
|
14
|
+
- Each node represents a distinct state in the conversation
|
|
15
|
+
- Contains:
|
|
16
|
+
- id: Unique identifier
|
|
17
|
+
- actionType: The action to perform
|
|
18
|
+
- instruction: Internal guidance for execution
|
|
19
|
+
|
|
20
|
+
2. **Edges (Transitions)**
|
|
21
|
+
- Connect nodes to define possible conversation flows
|
|
22
|
+
- Contains:
|
|
23
|
+
- sourceNode: Starting point
|
|
24
|
+
- targetNode: Destination
|
|
25
|
+
- instruction: Condition for transition
|
|
26
|
+
|
|
27
|
+
## Key Concepts
|
|
28
|
+
|
|
29
|
+
- **State Management**: Nodes capture the current state and required action
|
|
30
|
+
- **Flow Control**: Edges determine how the conversation can progress
|
|
31
|
+
- **Flexibility**: Support for various conversation patterns and flows
|
|
32
|
+
- **Context Awareness**: Each node operates with awareness of the conversation state
|
|
33
|
+
- **User Interaction**: User can reject or accept some of the actions, so the graph should account for that
|
|
34
|
+
|
|
35
|
+
## Implementation Notes
|
|
36
|
+
|
|
37
|
+
- Nodes should be self-contained and focused
|
|
38
|
+
- Edges should have clear, evaluatable conditions
|
|
39
|
+
- Any node can connect to any other node if logically appropriate
|
|
40
|
+
- Nodes and edges must formulate a graph structure, allowing for complex interactions
|
|
41
|
+
|
|
42
|
+
## Graph Structure requirements and constraints
|
|
43
|
+
|
|
44
|
+
- The graph may contain cycles, but should be designed to avoid infinite loops
|
|
45
|
+
- Each node should be reachable from the entry node
|
|
46
|
+
- The entry node should be clearly defined and serve as the starting point for the conversation
|
|
47
|
+
|
|
48
|
+
## Technical Details
|
|
49
|
+
|
|
50
|
+
Nodes require:
|
|
51
|
+
- Unique ID for reference
|
|
52
|
+
- Valid action type
|
|
53
|
+
- Clear execution instructions
|
|
54
|
+
|
|
55
|
+
Edges require:
|
|
56
|
+
- Valid source and target node IDs
|
|
57
|
+
- Clear transition conditions
|
|
58
|
+
|
|
59
|
+
# Let's get started!
|
|
60
|
+
|
|
61
|
+
0. Read and understand the conersation we had so far (context).
|
|
62
|
+
1. Think about the big picture of the upcoming conversation flow and the desired outcome.
|
|
63
|
+
2. Define the entry node to start the upcoming conversation.
|
|
64
|
+
3. Create nodes with reasoning, action type, and instructions.
|
|
65
|
+
4. Connect nodes with edges to define the conversation flow.
|
|
66
|
+
`;
|
|
67
|
+
export const getEdgeEvaluationPrompt = (currentNode, outgoingEdges) => {
|
|
68
|
+
return `We are evaluating the outgoing edges from the current node(${currentNode.id}):
|
|
69
|
+
|
|
70
|
+
${outgoingEdges.map((edge) => `- ${edge.targetNode}: ${edge.instruction}`).join('\n')}
|
|
71
|
+
|
|
72
|
+
Select the correct edge, or terminate if the conversation should stop. Use the 'evaluateEdge' function.`;
|
|
73
|
+
};
|
|
74
|
+
export const GRAPH_ANALYSIS_PROMPT_TEXT = `Please analyze the conversation graph provided by the assistant in the preceding message. Simulate diverse conversation paths mentally and identify any structural or logical problems, dead ends, unreachable nodes, missing transitions, or potential infinite loops. Explain the problems you find in detail. If no significant problems are found, state that clearly.`;
|
|
75
|
+
export const GRAPH_REVISION_PROMPT_TEXT = `Based on the analysis provided in the preceding message, generate a new, improved conversation graph using the 'conversationGraph' function. Ensure the new graph addresses the identified problems and better facilitates the original conversation goal.`;
|
|
76
|
+
registerActionHandler('conversationGraph', handleConversationGraph);
|
|
77
|
+
/**
|
|
78
|
+
* Main handler for the conversationGraph action.
|
|
79
|
+
* Orchestrates confirmation, generation, analysis/revision, and traversal.
|
|
80
|
+
*/
|
|
81
|
+
export async function handleConversationGraph(props) {
|
|
82
|
+
const state = {
|
|
83
|
+
prompt: [...props.prompt], // Work on a copy
|
|
84
|
+
currentGraphState: null,
|
|
85
|
+
conversationGraphCall: null,
|
|
86
|
+
};
|
|
87
|
+
try {
|
|
88
|
+
// 1. Confirm Execution
|
|
89
|
+
const userConfirmation = await _confirmGraphExecution(props.iterateCall, state, props.options);
|
|
90
|
+
if (!userConfirmation.confirmed) {
|
|
91
|
+
props.prompt.push(...state.prompt.slice(props.prompt.length)); // Update original prompt if declined
|
|
92
|
+
return { breakLoop: false, items: [] };
|
|
93
|
+
}
|
|
94
|
+
// 2. Generate Initial Graph
|
|
95
|
+
const initialGraphCall = await _generateInitialGraph(props.iterateCall, state, props.generateContentFn, props.options);
|
|
96
|
+
if (!initialGraphCall) {
|
|
97
|
+
props.prompt.push(...state.prompt.slice(props.prompt.length)); // Update original prompt on failure
|
|
98
|
+
return { breakLoop: false, items: [] };
|
|
99
|
+
}
|
|
100
|
+
// 3. Analyze and Revise Graph
|
|
101
|
+
const finalGraphCall = await _analyzeAndReviseGraph(state, props.generateContentFn, props.options);
|
|
102
|
+
if (!finalGraphCall) {
|
|
103
|
+
// This case implies the initial generation failed, handled in _generateInitialGraph
|
|
104
|
+
// If analysis/revision failed, we still proceed with the initial graph (returned by _analyzeAndReviseGraph)
|
|
105
|
+
// So, if finalGraphCall is null here, something went very wrong earlier.
|
|
106
|
+
throw new Error('Unexpected state: finalGraphCall is null after analysis/revision.');
|
|
107
|
+
}
|
|
108
|
+
state.conversationGraphCall = finalGraphCall; // Ensure state uses the final graph
|
|
109
|
+
// 4. Traverse Graph
|
|
110
|
+
const traversalResult = await _traverseGraph(state, props, userConfirmation);
|
|
111
|
+
// Update the original prompt with the full history from the graph execution
|
|
112
|
+
props.prompt.splice(0, props.prompt.length, ...state.prompt);
|
|
113
|
+
return traversalResult;
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
// Ensure final state is marked inactive on error
|
|
117
|
+
if (state.currentGraphState) {
|
|
118
|
+
state.currentGraphState = { ...state.currentGraphState, isActive: false };
|
|
119
|
+
}
|
|
120
|
+
putSystemMessage('Error during conversation graph execution', {
|
|
121
|
+
error,
|
|
122
|
+
conversationGraphState: state.currentGraphState,
|
|
123
|
+
});
|
|
124
|
+
// Add error context to the prompt
|
|
125
|
+
state.prompt.push({
|
|
126
|
+
type: 'assistant',
|
|
127
|
+
text: 'An error occurred during conversation graph execution.',
|
|
128
|
+
}, {
|
|
129
|
+
type: 'user',
|
|
130
|
+
text: 'Lets continue the conversation.',
|
|
131
|
+
});
|
|
132
|
+
// Update the original prompt with the history including the error
|
|
133
|
+
props.prompt.splice(0, props.prompt.length, ...state.prompt);
|
|
134
|
+
return { breakLoop: false, items: [] };
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// Helper: Confirm Graph Execution with User
|
|
138
|
+
async function _confirmGraphExecution(iterateCall, state, options) {
|
|
139
|
+
const userConfirmation = await askUserForConfirmationWithAnswer('The assistant wants to perform a conversation graph. Do you want to proceed?', 'Run conversation graph', 'Decline', true, options);
|
|
140
|
+
if (userConfirmation.answer) {
|
|
141
|
+
putUserMessage(userConfirmation.answer);
|
|
142
|
+
}
|
|
143
|
+
if (!userConfirmation.confirmed) {
|
|
144
|
+
putSystemMessage('Conversation graph declined.');
|
|
145
|
+
state.prompt.push({
|
|
146
|
+
type: 'assistant',
|
|
147
|
+
text: iterateCall.args?.message ?? '',
|
|
148
|
+
}, {
|
|
149
|
+
type: 'user',
|
|
150
|
+
text: 'Declined conversation graph. ' + (userConfirmation.answer ? `\n\n${userConfirmation.answer}` : ''),
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
return userConfirmation;
|
|
154
|
+
}
|
|
155
|
+
// Helper: Generate Initial Conversation Graph
|
|
156
|
+
async function _generateInitialGraph(iterateCall, state, generateContentFn, options) {
|
|
157
|
+
putSystemMessage('Generating conversation graph...');
|
|
158
|
+
const initialGraphResponse = await generateContentFn([
|
|
159
|
+
...state.prompt,
|
|
160
|
+
{
|
|
161
|
+
type: 'assistant',
|
|
162
|
+
text: iterateCall.args?.message ?? '',
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
type: 'user',
|
|
166
|
+
text: CONVERSATION_GRAPH_PROMPT,
|
|
167
|
+
},
|
|
168
|
+
], {
|
|
169
|
+
functionDefs: getFunctionDefs(),
|
|
170
|
+
requiredFunctionName: 'conversationGraph',
|
|
171
|
+
temperature: 0.7,
|
|
172
|
+
modelType: ModelType.DEFAULT,
|
|
173
|
+
expectedResponseType: {
|
|
174
|
+
text: false,
|
|
175
|
+
functionCall: true,
|
|
176
|
+
media: false,
|
|
177
|
+
},
|
|
178
|
+
}, options);
|
|
179
|
+
const conversationGraphCall = initialGraphResponse
|
|
180
|
+
.filter((item) => item.type === 'functionCall')
|
|
181
|
+
.map((item) => item.functionCall)[0];
|
|
182
|
+
if (!conversationGraphCall || !conversationGraphCall.args) {
|
|
183
|
+
putSystemMessage('Failed to generate initial conversation graph.');
|
|
184
|
+
state.prompt.push({
|
|
185
|
+
type: 'assistant',
|
|
186
|
+
text: 'I encountered an issue generating the conversation plan.',
|
|
187
|
+
}, {
|
|
188
|
+
type: 'user',
|
|
189
|
+
text: 'Okay, unable to generate graph.',
|
|
190
|
+
});
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
state.prompt.push({
|
|
194
|
+
type: 'assistant',
|
|
195
|
+
text: iterateCall.args?.message ?? '',
|
|
196
|
+
functionCalls: [conversationGraphCall],
|
|
197
|
+
});
|
|
198
|
+
state.conversationGraphCall = conversationGraphCall;
|
|
199
|
+
state.currentGraphState = {
|
|
200
|
+
nodes: conversationGraphCall.args.nodes,
|
|
201
|
+
edges: conversationGraphCall.args.edges,
|
|
202
|
+
currentNodeId: null,
|
|
203
|
+
isActive: false,
|
|
204
|
+
};
|
|
205
|
+
return conversationGraphCall;
|
|
206
|
+
}
|
|
207
|
+
// Helper: Analyze and Revise Graph
|
|
208
|
+
async function _analyzeAndReviseGraph(state, generateContentFn, options) {
|
|
209
|
+
if (!state.conversationGraphCall || !state.currentGraphState) {
|
|
210
|
+
return null; // Should not happen if called correctly
|
|
211
|
+
}
|
|
212
|
+
const initialGraphCall = state.conversationGraphCall;
|
|
213
|
+
putSystemMessage('Starting automatic graph analysis...', {
|
|
214
|
+
conversationGraphState: state.currentGraphState,
|
|
215
|
+
...initialGraphCall.args,
|
|
216
|
+
});
|
|
217
|
+
const analysisPrompt = [
|
|
218
|
+
{
|
|
219
|
+
type: 'assistant',
|
|
220
|
+
text: CONVERSATION_GRAPH_PROMPT,
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
type: 'assistant',
|
|
224
|
+
text: 'I have prepared a conversation graph for you.',
|
|
225
|
+
functionCalls: [initialGraphCall],
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
type: 'user',
|
|
229
|
+
text: GRAPH_ANALYSIS_PROMPT_TEXT,
|
|
230
|
+
functionResponses: [
|
|
231
|
+
{
|
|
232
|
+
name: 'conversationGraph',
|
|
233
|
+
call_id: initialGraphCall.id,
|
|
234
|
+
content: '',
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
},
|
|
238
|
+
];
|
|
239
|
+
const analysisResult = await generateContentFn(analysisPrompt, {
|
|
240
|
+
modelType: ModelType.CHEAP,
|
|
241
|
+
temperature: 0.5,
|
|
242
|
+
expectedResponseType: { text: true, functionCall: false, media: false },
|
|
243
|
+
}, options);
|
|
244
|
+
const analysisText = analysisResult.find((part) => part.type === 'text')?.text;
|
|
245
|
+
if (analysisText) {
|
|
246
|
+
analysisPrompt.push({ type: 'assistant', text: analysisText });
|
|
247
|
+
putSystemMessage('Attempting to fix graph based on analysis...', {
|
|
248
|
+
conversationGraphState: state.currentGraphState,
|
|
249
|
+
analysisText,
|
|
250
|
+
});
|
|
251
|
+
const revisionPrompt = [
|
|
252
|
+
...analysisPrompt,
|
|
253
|
+
{
|
|
254
|
+
type: 'user',
|
|
255
|
+
text: GRAPH_REVISION_PROMPT_TEXT,
|
|
256
|
+
},
|
|
257
|
+
];
|
|
258
|
+
const revisionResult = await generateContentFn(revisionPrompt, {
|
|
259
|
+
modelType: ModelType.DEFAULT,
|
|
260
|
+
temperature: 0.7,
|
|
261
|
+
functionDefs: getFunctionDefs(),
|
|
262
|
+
requiredFunctionName: 'conversationGraph',
|
|
263
|
+
expectedResponseType: {
|
|
264
|
+
text: false,
|
|
265
|
+
functionCall: true,
|
|
266
|
+
media: false,
|
|
267
|
+
},
|
|
268
|
+
}, options);
|
|
269
|
+
const revisedGraphCall = revisionResult
|
|
270
|
+
.filter((item) => item.type === 'functionCall')
|
|
271
|
+
.map((item) => item.functionCall)[0];
|
|
272
|
+
if (revisedGraphCall?.args?.nodes?.length) {
|
|
273
|
+
state.conversationGraphCall = {
|
|
274
|
+
...initialGraphCall,
|
|
275
|
+
args: { ...initialGraphCall.args, ...revisedGraphCall.args },
|
|
276
|
+
};
|
|
277
|
+
state.currentGraphState = {
|
|
278
|
+
...state.currentGraphState,
|
|
279
|
+
nodes: state.conversationGraphCall.args.nodes,
|
|
280
|
+
edges: state.conversationGraphCall.args.edges,
|
|
281
|
+
};
|
|
282
|
+
putSystemMessage('Graph revised successfully.', {
|
|
283
|
+
conversationGraphState: state.currentGraphState,
|
|
284
|
+
...state.conversationGraphCall.args,
|
|
285
|
+
});
|
|
286
|
+
return state.conversationGraphCall;
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
putSystemMessage('Failed to generate revised conversation graph, keeping original.', {
|
|
290
|
+
conversationGraphState: state.currentGraphState,
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
putSystemMessage('LLM failed to provide analysis text. Proceeding with original graph.', {
|
|
296
|
+
conversationGraphState: state.currentGraphState,
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
return initialGraphCall; // Return original if revision failed or wasn't needed
|
|
300
|
+
}
|
|
301
|
+
// Helper: Execute Node Action
|
|
302
|
+
async function _executeNodeAction(currentNode, state, props) {
|
|
303
|
+
const nodeIterateCall = {
|
|
304
|
+
name: 'iterate',
|
|
305
|
+
args: {
|
|
306
|
+
message: currentNode.instruction, // Use node instruction as message hint
|
|
307
|
+
actionType: currentNode.actionType,
|
|
308
|
+
},
|
|
309
|
+
};
|
|
310
|
+
putSystemMessage(`Executing node ${currentNode.id} (Action: ${currentNode.actionType})`, {
|
|
311
|
+
conversationGraphState: state.currentGraphState,
|
|
312
|
+
nodeDetails: currentNode,
|
|
313
|
+
});
|
|
314
|
+
// Generate a message for the assistant to say before executing the action
|
|
315
|
+
const [sendMessage] = (await props.generateContentFn(state.prompt, {
|
|
316
|
+
functionDefs: getFunctionDefs(),
|
|
317
|
+
requiredFunctionName: 'sendMessage',
|
|
318
|
+
temperature: 0.7,
|
|
319
|
+
modelType: ModelType.CHEAP,
|
|
320
|
+
expectedResponseType: {
|
|
321
|
+
text: false,
|
|
322
|
+
functionCall: true,
|
|
323
|
+
media: false,
|
|
324
|
+
},
|
|
325
|
+
}, props.options))
|
|
326
|
+
.filter((item) => item.type === 'functionCall')
|
|
327
|
+
.map((item) => item.functionCall);
|
|
328
|
+
if (sendMessage?.args?.message) {
|
|
329
|
+
putAssistantMessage(sendMessage.args.message, sendMessage.args);
|
|
330
|
+
nodeIterateCall.args.message = sendMessage.args.message;
|
|
331
|
+
}
|
|
332
|
+
const currentNodeHandler = getActionHandler(currentNode.actionType);
|
|
333
|
+
const nodeResult = await currentNodeHandler({
|
|
334
|
+
...props,
|
|
335
|
+
iterateCall: nodeIterateCall,
|
|
336
|
+
prompt: state.prompt, // Pass the current prompt state
|
|
337
|
+
});
|
|
338
|
+
// Add results from the node handler to history
|
|
339
|
+
if (nodeResult.items && nodeResult.items.length > 0) {
|
|
340
|
+
for (const item of nodeResult.items) {
|
|
341
|
+
if (item?.assistant) {
|
|
342
|
+
state.prompt.push(item.assistant);
|
|
343
|
+
}
|
|
344
|
+
if (item?.user) {
|
|
345
|
+
putUserMessage(item.user.text ?? '', item.user.data, undefined, item.user.images, item.user);
|
|
346
|
+
state.prompt.push(item.user);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return nodeResult;
|
|
351
|
+
}
|
|
352
|
+
// Helper: Evaluate Next Step (Edges)
|
|
353
|
+
async function _evaluateNextStep(currentNode, state, generateContentFn, options) {
|
|
354
|
+
const outgoingEdges = state.currentGraphState.edges.filter((edge) => edge.sourceNode === currentNode.id);
|
|
355
|
+
if (outgoingEdges.length === 0) {
|
|
356
|
+
putSystemMessage(`No outgoing edges found from node ${currentNode.id}. Ending execution.`, {
|
|
357
|
+
conversationGraphState: { ...state.currentGraphState, isActive: false },
|
|
358
|
+
});
|
|
359
|
+
return { nextNode: null, terminate: true };
|
|
360
|
+
}
|
|
361
|
+
const edgeEvaluationResult = await generateContentFn([
|
|
362
|
+
...state.prompt,
|
|
363
|
+
{
|
|
364
|
+
type: 'user',
|
|
365
|
+
text: getEdgeEvaluationPrompt(currentNode, outgoingEdges),
|
|
366
|
+
},
|
|
367
|
+
], {
|
|
368
|
+
functionDefs: getFunctionDefs(),
|
|
369
|
+
requiredFunctionName: 'evaluateEdge',
|
|
370
|
+
temperature: 0.2,
|
|
371
|
+
modelType: ModelType.CHEAP,
|
|
372
|
+
expectedResponseType: {
|
|
373
|
+
text: false,
|
|
374
|
+
functionCall: true,
|
|
375
|
+
media: false,
|
|
376
|
+
},
|
|
377
|
+
}, options);
|
|
378
|
+
const evaluateEdge = edgeEvaluationResult
|
|
379
|
+
.filter((item) => item.type === 'functionCall')
|
|
380
|
+
.map((item) => item.functionCall)[0];
|
|
381
|
+
if (!evaluateEdge?.args) {
|
|
382
|
+
putSystemMessage(`Failed to evaluate edges from node ${currentNode.id}. Ending execution.`, {
|
|
383
|
+
conversationGraphState: { ...state.currentGraphState, isActive: false },
|
|
384
|
+
});
|
|
385
|
+
return { nextNode: null, terminate: true };
|
|
386
|
+
}
|
|
387
|
+
state.prompt.push({ type: 'assistant', functionCalls: [evaluateEdge] });
|
|
388
|
+
state.prompt.push({
|
|
389
|
+
type: 'user',
|
|
390
|
+
functionResponses: [
|
|
391
|
+
{
|
|
392
|
+
name: 'evaluateEdge',
|
|
393
|
+
call_id: evaluateEdge.id,
|
|
394
|
+
content: JSON.stringify(evaluateEdge.args),
|
|
395
|
+
},
|
|
396
|
+
],
|
|
397
|
+
text: `Edge evaluated: ${evaluateEdge.args.shouldTerminate ? 'Terminate' : (evaluateEdge.args.selectedEdge?.targetNode ?? 'Error')}`,
|
|
398
|
+
});
|
|
399
|
+
if (evaluateEdge.args.shouldTerminate || !evaluateEdge.args.selectedEdge) {
|
|
400
|
+
putSystemMessage('Conversation graph traversal terminated by edge evaluation.', {
|
|
401
|
+
conversationGraphState: { ...state.currentGraphState, isActive: false },
|
|
402
|
+
});
|
|
403
|
+
return { nextNode: null, terminate: true };
|
|
404
|
+
}
|
|
405
|
+
const nextNodeId = evaluateEdge.args.selectedEdge.targetNode;
|
|
406
|
+
const nextNode = state.currentGraphState.nodes.find((node) => node.id === nextNodeId);
|
|
407
|
+
if (!nextNode) {
|
|
408
|
+
putSystemMessage(`Target node ${nextNodeId} not found. Ending execution.`, {
|
|
409
|
+
conversationGraphState: { ...state.currentGraphState, isActive: false, currentNodeId: null },
|
|
410
|
+
});
|
|
411
|
+
return { nextNode: null, terminate: true };
|
|
412
|
+
}
|
|
413
|
+
return { nextNode, terminate: false };
|
|
414
|
+
}
|
|
415
|
+
// Helper: Traverse the Graph
|
|
416
|
+
async function _traverseGraph(state, props, userConfirmation) {
|
|
417
|
+
if (!state.conversationGraphCall?.args || !state.currentGraphState) {
|
|
418
|
+
throw new Error('Cannot traverse graph without a valid graph definition.');
|
|
419
|
+
}
|
|
420
|
+
const { entryNode, nodes } = state.conversationGraphCall.args;
|
|
421
|
+
let currentNode = nodes.find((node) => node.id === entryNode);
|
|
422
|
+
if (!currentNode) {
|
|
423
|
+
state.currentGraphState = { ...state.currentGraphState, isActive: false, currentNodeId: null };
|
|
424
|
+
putSystemMessage('Error occurred during conversation graph execution (entry node not found).', {
|
|
425
|
+
conversationGraphState: state.currentGraphState,
|
|
426
|
+
});
|
|
427
|
+
state.prompt.push({
|
|
428
|
+
type: 'user',
|
|
429
|
+
text: 'Okay, unable to start graph execution (entry node not found).',
|
|
430
|
+
functionResponses: [
|
|
431
|
+
{
|
|
432
|
+
name: 'conversationGraph',
|
|
433
|
+
call_id: state.conversationGraphCall.id,
|
|
434
|
+
content: '',
|
|
435
|
+
},
|
|
436
|
+
],
|
|
437
|
+
});
|
|
438
|
+
return { breakLoop: false, items: [] };
|
|
439
|
+
}
|
|
440
|
+
state.currentGraphState = { ...state.currentGraphState, currentNodeId: currentNode.id, isActive: true };
|
|
441
|
+
putSystemMessage('Starting conversation graph traversal.', {
|
|
442
|
+
conversationGraphState: state.currentGraphState,
|
|
443
|
+
entryNode,
|
|
444
|
+
nodes,
|
|
445
|
+
edges: state.currentGraphState.edges,
|
|
446
|
+
});
|
|
447
|
+
// Add prompt to history about user accepting the graph
|
|
448
|
+
state.prompt.push({
|
|
449
|
+
type: 'user',
|
|
450
|
+
text: 'I accept the conversation graph and will proceed with it.' +
|
|
451
|
+
(userConfirmation.answer ? `\n\n${userConfirmation.answer}` : ''), // Assuming confirmation happened before
|
|
452
|
+
functionResponses: [
|
|
453
|
+
{
|
|
454
|
+
name: 'conversationGraph',
|
|
455
|
+
call_id: state.conversationGraphCall.id,
|
|
456
|
+
content: '',
|
|
457
|
+
},
|
|
458
|
+
],
|
|
459
|
+
});
|
|
460
|
+
const visitedNodes = new Set();
|
|
461
|
+
let iteration = 0;
|
|
462
|
+
const MAX_ITERATIONS = 50;
|
|
463
|
+
while (currentNode && iteration < MAX_ITERATIONS) {
|
|
464
|
+
iteration++;
|
|
465
|
+
visitedNodes.add(currentNode.id);
|
|
466
|
+
state.currentGraphState = { ...state.currentGraphState, currentNodeId: currentNode.id, isActive: true };
|
|
467
|
+
const nodeResult = await _executeNodeAction(currentNode, state, props);
|
|
468
|
+
if (nodeResult.breakLoop) {
|
|
469
|
+
state.currentGraphState = { ...state.currentGraphState, isActive: false };
|
|
470
|
+
putSystemMessage(`Node action ${currentNode.actionType} requested to break loop.`, {
|
|
471
|
+
conversationGraphState: state.currentGraphState,
|
|
472
|
+
});
|
|
473
|
+
return nodeResult; // Propagate breakLoop
|
|
474
|
+
}
|
|
475
|
+
const { nextNode, terminate } = await _evaluateNextStep(currentNode, state, props.generateContentFn, props.options);
|
|
476
|
+
if (terminate) {
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
479
|
+
currentNode = nextNode;
|
|
480
|
+
// Update state for the next iteration (will be sent at the start of the next loop)
|
|
481
|
+
if (currentNode) {
|
|
482
|
+
state.currentGraphState = { ...state.currentGraphState, currentNodeId: currentNode.id };
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
if (iteration >= MAX_ITERATIONS) {
|
|
486
|
+
putSystemMessage('Maximum iterations reached. Stopping traversal.', {
|
|
487
|
+
conversationGraphState: { ...state.currentGraphState, isActive: false },
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
state.currentGraphState = { ...state.currentGraphState, isActive: false };
|
|
491
|
+
putSystemMessage('Conversation graph traversal completed.', {
|
|
492
|
+
conversationGraphState: state.currentGraphState,
|
|
493
|
+
});
|
|
494
|
+
state.prompt.push({
|
|
495
|
+
type: 'assistant',
|
|
496
|
+
text: 'Conversation graph traversal completed.',
|
|
497
|
+
}, {
|
|
498
|
+
type: 'user',
|
|
499
|
+
text: 'Lets continue the conversation.',
|
|
500
|
+
});
|
|
501
|
+
return { breakLoop: false, items: [] };
|
|
502
|
+
}
|
|
503
|
+
//# sourceMappingURL=handle-conversation-graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-conversation-graph.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-iterate/handlers/handle-conversation-graph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC/G,OAAO,EAAgB,SAAS,EAAc,MAAM,wCAAwC,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAQ/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gCAAgC,EAA0B,MAAM,yCAAyC,CAAC;AAEnH,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DxC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,WAA6B,EAAE,aAAiC,EAAE,EAAE;IAC1G,OAAO,8DAA8D,WAAW,CAAC,EAAE;;EAEnF,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC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