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.
Files changed (294) hide show
  1. package/dist/ai-service/ai-studio.d.ts +2 -18
  2. package/dist/ai-service/ai-studio.js +88 -32
  3. package/dist/ai-service/ai-studio.js.map +1 -1
  4. package/dist/ai-service/anthropic.js +87 -45
  5. package/dist/ai-service/anthropic.js.map +1 -1
  6. package/dist/ai-service/common-types.d.ts +36 -3
  7. package/dist/ai-service/common-types.js +0 -2
  8. package/dist/ai-service/common-types.js.map +1 -1
  9. package/dist/ai-service/common.js +0 -2
  10. package/dist/ai-service/common.js.map +1 -1
  11. package/dist/ai-service/files-api.d.ts +33 -0
  12. package/dist/ai-service/files-api.js +239 -0
  13. package/dist/ai-service/files-api.js.map +1 -0
  14. package/dist/ai-service/github-models.js +0 -2
  15. package/dist/ai-service/github-models.js.map +1 -1
  16. package/dist/ai-service/local-llm.js +0 -4
  17. package/dist/ai-service/local-llm.js.map +1 -1
  18. package/dist/ai-service/openai-responses.js +62 -16
  19. package/dist/ai-service/openai-responses.js.map +1 -1
  20. package/dist/ai-service/openai.js +157 -54
  21. package/dist/ai-service/openai.js.map +1 -1
  22. package/dist/ai-service/service-configurations-types.d.ts +0 -1
  23. package/dist/ai-service/service-configurations.js +19 -20
  24. package/dist/ai-service/service-configurations.js.map +1 -1
  25. package/dist/ai-service/vertex-ai.js +2 -1
  26. package/dist/ai-service/vertex-ai.js.map +1 -1
  27. package/dist/cli/cli-params.js +2 -2
  28. package/dist/cli/cli-params.js.map +1 -1
  29. package/dist/files/file-id-utils.js +1 -1
  30. package/dist/files/file-id-utils.js.map +1 -1
  31. package/dist/files/read-files.js +10 -6
  32. package/dist/files/read-files.js.map +1 -1
  33. package/dist/files/source-code-types.d.ts +9 -5
  34. package/dist/files/source-code-utils.d.ts +2 -1
  35. package/dist/files/source-code-utils.js +30 -12
  36. package/dist/files/source-code-utils.js.map +1 -1
  37. package/dist/files/summary-cache.d.ts +6 -4
  38. package/dist/files/summary-cache.js +3 -2
  39. package/dist/files/summary-cache.js.map +1 -1
  40. package/dist/index.d.ts +1 -1
  41. package/dist/index.js +1 -1
  42. package/dist/index.js.map +1 -1
  43. package/dist/main/codegen-types.d.ts +2 -2
  44. package/dist/main/common/content-bus-types.d.ts +14 -0
  45. package/dist/main/common/content-bus.d.ts +3 -1
  46. package/dist/main/common/content-bus.js +28 -3
  47. package/dist/main/common/content-bus.js.map +1 -1
  48. package/dist/main/common/user-actions.d.ts +1 -1
  49. package/dist/main/config-types.d.ts +0 -3
  50. package/dist/main/config-types.js.map +1 -1
  51. package/dist/main/config.js +1 -1
  52. package/dist/main/config.js.map +1 -1
  53. package/dist/main/plugin-loader.d.ts +1 -1
  54. package/dist/main/ui/backend/endpoints/compress-context-endpoint.d.ts +1 -0
  55. package/dist/main/ui/backend/endpoints/compress-context-endpoint.js +18 -0
  56. package/dist/main/ui/backend/endpoints/compress-context-endpoint.js.map +1 -0
  57. package/dist/main/ui/backend/endpoints/config-endpoint.js +1 -1
  58. package/dist/main/ui/backend/endpoints/config-endpoint.js.map +1 -1
  59. package/dist/main/ui/backend/endpoints/context-endpoint.js +102 -0
  60. package/dist/main/ui/backend/endpoints/context-endpoint.js.map +1 -1
  61. package/dist/main/ui/backend/endpoints/edit-message-endpoint.js +9 -6
  62. package/dist/main/ui/backend/endpoints/edit-message-endpoint.js.map +1 -1
  63. package/dist/main/ui/backend/endpoints/index.d.ts +1 -0
  64. package/dist/main/ui/backend/endpoints/index.js +1 -0
  65. package/dist/main/ui/backend/endpoints/index.js.map +1 -1
  66. package/dist/main/ui/backend/endpoints/interrupt-execution-endpoint.js +1 -1
  67. package/dist/main/ui/backend/endpoints/interrupt-execution-endpoint.js.map +1 -1
  68. package/dist/main/ui/backend/service.d.ts +68 -7
  69. package/dist/main/ui/backend/service.js +301 -28
  70. package/dist/main/ui/backend/service.js.map +1 -1
  71. package/dist/main/ui/codegen-ui.js +2 -2
  72. package/dist/main/ui/codegen-ui.js.map +1 -1
  73. package/dist/main/ui/common/api-types.d.ts +6 -2
  74. package/dist/main/ui/common/api-types.js.map +1 -1
  75. package/dist/main/ui/frontend/assets/index-DAM_kJhM.js +3445 -0
  76. package/dist/main/ui/frontend/index.html +1 -1
  77. package/dist/prompt/context-utils.d.ts +7 -0
  78. package/dist/prompt/context-utils.js +33 -0
  79. package/dist/prompt/context-utils.js.map +1 -0
  80. package/dist/prompt/function-calling.js +4 -5
  81. package/dist/prompt/function-calling.js.map +1 -1
  82. package/dist/prompt/function-defs/code-execution.d.ts +7 -0
  83. package/dist/prompt/function-defs/code-execution.js +27 -0
  84. package/dist/prompt/function-defs/code-execution.js.map +1 -0
  85. package/dist/prompt/function-defs/conversation-graph.d.ts +1 -1
  86. package/dist/prompt/function-defs/conversation-graph.js +1 -1
  87. package/dist/prompt/function-defs/conversation-graph.js.map +1 -1
  88. package/dist/prompt/function-defs/get-source-code.js +3 -3
  89. package/dist/prompt/function-defs/iterate.d.ts +20 -0
  90. package/dist/prompt/function-defs/iterate.js +373 -0
  91. package/dist/prompt/function-defs/iterate.js.map +1 -0
  92. package/dist/prompt/function-defs/set-summaries.js +6 -2
  93. package/dist/prompt/function-defs/set-summaries.js.map +1 -1
  94. package/dist/prompt/limits.js +1 -1
  95. package/dist/prompt/prompt-service.js +13 -10
  96. package/dist/prompt/prompt-service.js.map +1 -1
  97. package/dist/prompt/source-code-optimize.d.ts +2 -0
  98. package/dist/prompt/source-code-optimize.js +27 -0
  99. package/dist/prompt/source-code-optimize.js.map +1 -0
  100. package/dist/prompt/steps/step-ask-question/step-ask-question.js +7 -1
  101. package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -1
  102. package/dist/prompt/steps/step-codegen-planning.js +6 -2
  103. package/dist/prompt/steps/step-codegen-planning.js.map +1 -1
  104. package/dist/prompt/steps/step-context-compression.js +5 -0
  105. package/dist/prompt/steps/step-context-compression.js.map +1 -1
  106. package/dist/prompt/steps/step-context-optimization.js +6 -3
  107. package/dist/prompt/steps/step-context-optimization.js.map +1 -1
  108. package/dist/prompt/steps/step-iterate/handlers/container-task/command-execution-loop.d.ts +7 -0
  109. package/dist/prompt/steps/step-iterate/handlers/container-task/command-execution-loop.js +301 -0
  110. package/dist/prompt/steps/step-iterate/handlers/container-task/command-execution-loop.js.map +1 -0
  111. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/complete-task.d.ts +4 -0
  112. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/complete-task.js +49 -0
  113. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/complete-task.js.map +1 -0
  114. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-from-container.d.ts +4 -0
  115. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-from-container.js +190 -0
  116. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-from-container.js.map +1 -0
  117. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-to-container.d.ts +4 -0
  118. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-to-container.js +139 -0
  119. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-to-container.js.map +1 -0
  120. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/edit-file.d.ts +10 -0
  121. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/edit-file.js +93 -0
  122. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/edit-file.js.map +1 -0
  123. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/fail-task.d.ts +4 -0
  124. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/fail-task.js +72 -0
  125. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/fail-task.js.map +1 -0
  126. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/gain-knowledge.d.ts +10 -0
  127. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/gain-knowledge.js +125 -0
  128. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/gain-knowledge.js.map +1 -0
  129. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/interrupt-controller.d.ts +19 -0
  130. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/interrupt-controller.js +33 -0
  131. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/interrupt-controller.js.map +1 -0
  132. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/query-knowledge.d.ts +8 -0
  133. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/query-knowledge.js +85 -0
  134. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/query-knowledge.js.map +1 -0
  135. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/request-secret.d.ts +6 -0
  136. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/request-secret.js +122 -0
  137. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/request-secret.js.map +1 -0
  138. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/run-command.d.ts +7 -0
  139. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/run-command.js +146 -0
  140. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/run-command.js.map +1 -0
  141. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/send-message.d.ts +4 -0
  142. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/send-message.js +56 -0
  143. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/send-message.js.map +1 -0
  144. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/set-execution-plan.d.ts +4 -0
  145. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/set-execution-plan.js +56 -0
  146. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/set-execution-plan.js.map +1 -0
  147. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/update-execution-plan.d.ts +4 -0
  148. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/update-execution-plan.js +39 -0
  149. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/update-execution-plan.js.map +1 -0
  150. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/view-file.d.ts +10 -0
  151. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/view-file.js +95 -0
  152. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/view-file.js.map +1 -0
  153. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/web-search.d.ts +2 -0
  154. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/web-search.js +96 -0
  155. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/web-search.js.map +1 -0
  156. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/wrap-context.d.ts +4 -0
  157. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/wrap-context.js +123 -0
  158. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/wrap-context.js.map +1 -0
  159. package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-registry.d.ts +11 -0
  160. package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-registry.js +50 -0
  161. package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-registry.js.map +1 -0
  162. package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-types.d.ts +28 -0
  163. package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-types.js +2 -0
  164. package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-types.js.map +1 -0
  165. package/dist/prompt/steps/step-iterate/handlers/container-task/container-task-orchestrator.d.ts +2 -0
  166. package/dist/prompt/steps/step-iterate/handlers/container-task/container-task-orchestrator.js +202 -0
  167. package/dist/prompt/steps/step-iterate/handlers/container-task/container-task-orchestrator.js.map +1 -0
  168. package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-check.d.ts +4 -0
  169. package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-check.js +15 -0
  170. package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-check.js.map +1 -0
  171. package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-utils.d.ts +50 -0
  172. package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-utils.js +358 -0
  173. package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-utils.js.map +1 -0
  174. package/dist/prompt/steps/step-iterate/handlers/file-request-utils.d.ts +47 -0
  175. package/dist/prompt/steps/step-iterate/handlers/file-request-utils.js +114 -0
  176. package/dist/prompt/steps/step-iterate/handlers/file-request-utils.js.map +1 -0
  177. package/dist/prompt/steps/step-iterate/handlers/handle-code-execution.d.ts +1 -0
  178. package/dist/prompt/steps/step-iterate/handlers/handle-code-execution.js +133 -0
  179. package/dist/prompt/steps/step-iterate/handlers/handle-code-execution.js.map +1 -0
  180. package/dist/prompt/steps/step-iterate/handlers/handle-code-generation.d.ts +4 -0
  181. package/dist/prompt/steps/step-iterate/handlers/handle-code-generation.js +177 -0
  182. package/dist/prompt/steps/step-iterate/handlers/handle-code-generation.js.map +1 -0
  183. package/dist/prompt/steps/step-iterate/handlers/handle-compound-action.d.ts +20 -0
  184. package/dist/prompt/steps/step-iterate/handlers/handle-compound-action.js +305 -0
  185. package/dist/prompt/steps/step-iterate/handlers/handle-compound-action.js.map +1 -0
  186. package/dist/prompt/steps/step-iterate/handlers/handle-confirm-code-generation.d.ts +2 -0
  187. package/dist/prompt/steps/step-iterate/handlers/handle-confirm-code-generation.js +40 -0
  188. package/dist/prompt/steps/step-iterate/handlers/handle-confirm-code-generation.js.map +1 -0
  189. package/dist/prompt/steps/step-iterate/handlers/handle-context-compression.d.ts +2 -0
  190. package/dist/prompt/steps/step-iterate/handlers/handle-context-compression.js +35 -0
  191. package/dist/prompt/steps/step-iterate/handlers/handle-context-compression.js.map +1 -0
  192. package/dist/prompt/steps/step-iterate/handlers/handle-context-optimization.d.ts +2 -0
  193. package/dist/prompt/steps/step-iterate/handlers/handle-context-optimization.js +34 -0
  194. package/dist/prompt/steps/step-iterate/handlers/handle-context-optimization.js.map +1 -0
  195. package/dist/prompt/steps/step-iterate/handlers/handle-conversation-graph.d.ts +11 -0
  196. package/dist/prompt/steps/step-iterate/handlers/handle-conversation-graph.js +503 -0
  197. package/dist/prompt/steps/step-iterate/handlers/handle-conversation-graph.js.map +1 -0
  198. package/dist/prompt/steps/step-iterate/handlers/handle-create-file.d.ts +2 -0
  199. package/dist/prompt/steps/step-iterate/handlers/handle-create-file.js +159 -0
  200. package/dist/prompt/steps/step-iterate/handlers/handle-create-file.js.map +1 -0
  201. package/dist/prompt/steps/step-iterate/handlers/handle-end-conversation.d.ts +2 -0
  202. package/dist/prompt/steps/step-iterate/handlers/handle-end-conversation.js +30 -0
  203. package/dist/prompt/steps/step-iterate/handlers/handle-end-conversation.js.map +1 -0
  204. package/dist/prompt/steps/step-iterate/handlers/handle-explore-external-directories.d.ts +2 -0
  205. package/dist/prompt/steps/step-iterate/handlers/handle-explore-external-directories.js +280 -0
  206. package/dist/prompt/steps/step-iterate/handlers/handle-explore-external-directories.js.map +1 -0
  207. package/dist/prompt/steps/step-iterate/handlers/handle-genaicode-help.d.ts +8 -0
  208. package/dist/prompt/steps/step-iterate/handlers/handle-genaicode-help.js +105 -0
  209. package/dist/prompt/steps/step-iterate/handlers/handle-genaicode-help.js.map +1 -0
  210. package/dist/prompt/steps/step-iterate/handlers/handle-generate-image.d.ts +2 -0
  211. package/dist/prompt/steps/step-iterate/handlers/handle-generate-image.js +110 -0
  212. package/dist/prompt/steps/step-iterate/handlers/handle-generate-image.js.map +1 -0
  213. package/dist/prompt/steps/step-iterate/handlers/handle-perform-analysis.d.ts +6 -0
  214. package/dist/prompt/steps/step-iterate/handlers/handle-perform-analysis.js +110 -0
  215. package/dist/prompt/steps/step-iterate/handlers/handle-perform-analysis.js.map +1 -0
  216. package/dist/prompt/steps/step-iterate/handlers/handle-project-command.d.ts +2 -0
  217. package/dist/prompt/steps/step-iterate/handlers/handle-project-command.js +280 -0
  218. package/dist/prompt/steps/step-iterate/handlers/handle-project-command.js.map +1 -0
  219. package/dist/prompt/steps/step-iterate/handlers/handle-pull-app-context.d.ts +9 -0
  220. package/dist/prompt/steps/step-iterate/handlers/handle-pull-app-context.js +94 -0
  221. package/dist/prompt/steps/step-iterate/handlers/handle-pull-app-context.js.map +1 -0
  222. package/dist/prompt/steps/step-iterate/handlers/handle-pull-console-logs.d.ts +2 -0
  223. package/dist/prompt/steps/step-iterate/handlers/handle-pull-console-logs.js +174 -0
  224. package/dist/prompt/steps/step-iterate/handlers/handle-pull-console-logs.js.map +1 -0
  225. package/dist/prompt/steps/step-iterate/handlers/handle-push-app-context.d.ts +9 -0
  226. package/dist/prompt/steps/step-iterate/handlers/handle-push-app-context.js +104 -0
  227. package/dist/prompt/steps/step-iterate/handlers/handle-push-app-context.js.map +1 -0
  228. package/dist/prompt/steps/step-iterate/handlers/handle-read-external-files.d.ts +2 -0
  229. package/dist/prompt/steps/step-iterate/handlers/handle-read-external-files.js +149 -0
  230. package/dist/prompt/steps/step-iterate/handlers/handle-read-external-files.js.map +1 -0
  231. package/dist/prompt/steps/step-iterate/handlers/handle-reasoning-inference.d.ts +7 -0
  232. package/dist/prompt/steps/step-iterate/handlers/handle-reasoning-inference.js +119 -0
  233. package/dist/prompt/steps/step-iterate/handlers/handle-reasoning-inference.js.map +1 -0
  234. package/dist/prompt/steps/step-iterate/handlers/handle-remove-files-from-context.d.ts +2 -0
  235. package/dist/prompt/steps/step-iterate/handlers/handle-remove-files-from-context.js +100 -0
  236. package/dist/prompt/steps/step-iterate/handlers/handle-remove-files-from-context.js.map +1 -0
  237. package/dist/prompt/steps/step-iterate/handlers/handle-request-files-content.d.ts +8 -0
  238. package/dist/prompt/steps/step-iterate/handlers/handle-request-files-content.js +146 -0
  239. package/dist/prompt/steps/step-iterate/handlers/handle-request-files-content.js.map +1 -0
  240. package/dist/prompt/steps/step-iterate/handlers/handle-request-files-fragments.d.ts +8 -0
  241. package/dist/prompt/steps/step-iterate/handlers/handle-request-files-fragments.js +197 -0
  242. package/dist/prompt/steps/step-iterate/handlers/handle-request-files-fragments.js.map +1 -0
  243. package/dist/prompt/steps/step-iterate/handlers/handle-request-git-context.d.ts +3 -0
  244. package/dist/prompt/steps/step-iterate/handlers/handle-request-git-context.js +251 -0
  245. package/dist/prompt/steps/step-iterate/handlers/handle-request-git-context.js.map +1 -0
  246. package/dist/prompt/steps/step-iterate/handlers/handle-request-permissions.d.ts +2 -0
  247. package/dist/prompt/steps/step-iterate/handlers/handle-request-permissions.js +83 -0
  248. package/dist/prompt/steps/step-iterate/handlers/handle-request-permissions.js.map +1 -0
  249. package/dist/prompt/steps/step-iterate/handlers/handle-run-bash-command.d.ts +2 -0
  250. package/dist/prompt/steps/step-iterate/handlers/handle-run-bash-command.js +185 -0
  251. package/dist/prompt/steps/step-iterate/handlers/handle-run-bash-command.js.map +1 -0
  252. package/dist/prompt/steps/step-iterate/handlers/handle-run-container-task.d.ts +2 -0
  253. package/dist/prompt/steps/step-iterate/handlers/handle-run-container-task.js +7 -0
  254. package/dist/prompt/steps/step-iterate/handlers/handle-run-container-task.js.map +1 -0
  255. package/dist/prompt/steps/step-iterate/handlers/handle-search-code.d.ts +2 -0
  256. package/dist/prompt/steps/step-iterate/handlers/handle-search-code.js +96 -0
  257. package/dist/prompt/steps/step-iterate/handlers/handle-search-code.js.map +1 -0
  258. package/dist/prompt/steps/step-iterate/handlers/handle-send-message.d.ts +2 -0
  259. package/dist/prompt/steps/step-iterate/handlers/handle-send-message.js +21 -0
  260. package/dist/prompt/steps/step-iterate/handlers/handle-send-message.js.map +1 -0
  261. package/dist/prompt/steps/step-iterate/handlers/handle-structured-question.d.ts +1 -0
  262. package/dist/prompt/steps/step-iterate/handlers/handle-structured-question.js +72 -0
  263. package/dist/prompt/steps/step-iterate/handlers/handle-structured-question.js.map +1 -0
  264. package/dist/prompt/steps/step-iterate/handlers/handle-update-file.d.ts +2 -0
  265. package/dist/prompt/steps/step-iterate/handlers/handle-update-file.js +161 -0
  266. package/dist/prompt/steps/step-iterate/handlers/handle-update-file.js.map +1 -0
  267. package/dist/prompt/steps/step-iterate/handlers/handle-web-search.d.ts +1 -0
  268. package/dist/prompt/steps/step-iterate/handlers/handle-web-search.js +85 -0
  269. package/dist/prompt/steps/step-iterate/handlers/handle-web-search.js.map +1 -0
  270. package/dist/prompt/steps/step-iterate/iterate-handler.d.ts +4 -0
  271. package/dist/prompt/steps/step-iterate/iterate-handler.js +14 -0
  272. package/dist/prompt/steps/step-iterate/iterate-handler.js.map +1 -0
  273. package/dist/prompt/steps/step-iterate/step-iterate-handlers.d.ts +3 -0
  274. package/dist/prompt/steps/step-iterate/step-iterate-handlers.js +5 -0
  275. package/dist/prompt/steps/step-iterate/step-iterate-handlers.js.map +1 -0
  276. package/dist/prompt/steps/step-iterate/step-iterate-types.d.ts +255 -0
  277. package/dist/prompt/steps/step-iterate/step-iterate-types.js +2 -0
  278. package/dist/prompt/steps/step-iterate/step-iterate-types.js.map +1 -0
  279. package/dist/prompt/steps/step-iterate/step-iterate.d.ts +37 -0
  280. package/dist/prompt/steps/step-iterate/step-iterate.js +132 -0
  281. package/dist/prompt/steps/step-iterate/step-iterate.js.map +1 -0
  282. package/dist/prompt/steps/step-summarization.js +9 -19
  283. package/dist/prompt/steps/step-summarization.js.map +1 -1
  284. package/dist/prompt/systemprompt.js +93 -168
  285. package/dist/prompt/systemprompt.js.map +1 -1
  286. package/dist/prompt/token-estimator.js +1 -1
  287. package/dist/prompt/token-estimator.js.map +1 -1
  288. package/dist/vite-genaicode/console-interceptor.d.ts +19 -6
  289. package/dist/vite-genaicode/console-interceptor.js +45 -13
  290. package/dist/vite-genaicode/console-interceptor.js.map +1 -1
  291. package/dist/vite-genaicode/vite-genaicode-frontend.js +1 -1
  292. package/dist/vite-genaicode/vite-genaicode-frontend.js.map +1 -1
  293. package/package.json +7 -6
  294. package/dist/main/ui/frontend/assets/index-5-emJmrg.js +0 -2881
@@ -0,0 +1,305 @@
1
+ import { ModelType } from '../../../../ai-service/common-types.js';
2
+ import { askUserForConfirmationWithAnswer } from '../../../../main/common/user-actions.js';
3
+ import { getOperationExecutor, getOperationDefs } from '../../../../operations/operations-index.js';
4
+ import { registerActionHandler } from '../step-iterate-handlers.js';
5
+ import { putAssistantMessage, putSystemMessage, putUserMessage } from '../../../../main/common/content-bus.js';
6
+ import { getFunctionDefs } from '../../../function-calling.js';
7
+ import { getCompoundActionDef } from '../../../function-defs/compound-action.js';
8
+ import { executeStepEnsureContext } from '../../step-ensure-context.js';
9
+ import { StepResult } from '../../steps-types.js';
10
+ import { getSourceCode } from '../../../../files/read-files.js';
11
+ import { executeStepVerifyPatch } from '../../step-verify-patch.js';
12
+ /**
13
+ * Constructs the prompt for the initial planning phase of a compound action.
14
+ * @param basePrompt The current conversation history.
15
+ * @param assistantMessage The assistant's message initiating the compound action.
16
+ * @param compoundActionDef The function definition for the compound action planner.
17
+ * @returns The prompt items for the planning phase.
18
+ */
19
+ export function constructCompoundActionPlanningPrompt(basePrompt, assistantMessage, compoundActionDef) {
20
+ return [
21
+ ...basePrompt,
22
+ {
23
+ type: 'assistant',
24
+ text: assistantMessage ?? '',
25
+ },
26
+ {
27
+ type: 'user',
28
+ text: `Based on the conversation history and my last message, please identify the sequence of file operations (like ${getOperationDefs()
29
+ .map((op) => op.name)
30
+ .join(', ')}). For each operation, specify the target 'filePath' where applicable. Provide an array of actions and a concise summary message for my confirmation. Please provide information about dependency between actions. Use the "${compoundActionDef.name}" function to return this information.`,
31
+ },
32
+ ];
33
+ }
34
+ /**
35
+ * Constructs the prompt for inferring parameters for a specific action within a compound action.
36
+ * @param basePrompt The current conversation history (which includes prior planning and parameter inferences).
37
+ * @param actionId The unique ID of the current action.
38
+ * @param actionName The name of the current action (e.g., "createFile").
39
+ * @param operationDef The function definition for the current action.
40
+ * @returns The prompt items for the parameter inference phase.
41
+ */
42
+ export function constructCompoundActionParameterInferencePrompt(basePrompt, actionId, actionName, operationDef) {
43
+ return [
44
+ ...basePrompt,
45
+ {
46
+ type: 'user',
47
+ text: `Now, for the action "${actionId}:${actionName}", please determine the specific parameters required. Refer to its definition: ${JSON.stringify(operationDef.parameters)}. Use the "${actionName}" function to return these parameters.`,
48
+ },
49
+ ];
50
+ }
51
+ export const handleCompoundAction = async ({ iterateCall, options, generateContentFn, prompt, }) => {
52
+ const compoundActionDef = getCompoundActionDef();
53
+ let actions = [];
54
+ let summary = '';
55
+ let initialInferenceCall;
56
+ // Step 1: Infer High-Level Plan (Action Types and Summary)
57
+ try {
58
+ putSystemMessage('Inferring high-level plan for compound action...');
59
+ const initialInferencePrompt = constructCompoundActionPlanningPrompt(prompt, iterateCall.args?.message, compoundActionDef);
60
+ const initialResult = await generateContentFn(initialInferencePrompt, {
61
+ modelType: ModelType.CHEAP, // Use a capable model for planning
62
+ functionDefs: getFunctionDefs(), // getFunctionDefs() already includes compoundActionDef
63
+ requiredFunctionName: compoundActionDef.name,
64
+ temperature: 0.2,
65
+ expectedResponseType: { text: false, functionCall: true, media: false },
66
+ }, options);
67
+ initialInferenceCall = initialResult.find((part) => part.type === 'functionCall')?.functionCall;
68
+ if (!initialInferenceCall?.args?.actions || initialInferenceCall.args.actions.length === 0) {
69
+ putSystemMessage('AI failed to generate a list of action types or returned an empty list. Cannot proceed.');
70
+ prompt.push({
71
+ type: 'assistant',
72
+ text: iterateCall.args?.message ?? '',
73
+ });
74
+ prompt.push({
75
+ type: 'user',
76
+ text: 'I was unable to determine the necessary actions. Could you please clarify your request or try rephrasing it?',
77
+ });
78
+ return { breakLoop: false, items: [] };
79
+ }
80
+ actions = initialInferenceCall.args.actions;
81
+ summary = initialInferenceCall.args.summary;
82
+ putSystemMessage(`Inferred actions`, { actions, summary });
83
+ }
84
+ catch (error) {
85
+ const errorMessage = error instanceof Error ? error.message : String(error);
86
+ putSystemMessage(`Error during high-level plan inference: ${errorMessage}`);
87
+ prompt.push({
88
+ type: 'assistant',
89
+ text: iterateCall.args?.message ?? '',
90
+ }, {
91
+ type: 'user',
92
+ text: `I encountered an error while planning the actions: ${errorMessage}. Please clarify your request.`,
93
+ });
94
+ return { breakLoop: false, items: [] };
95
+ }
96
+ prompt.push({
97
+ type: 'assistant',
98
+ text: iterateCall.args?.message ?? '', // This is the original assistant message that triggered compound action
99
+ functionCalls: [initialInferenceCall], // The AI call for planning
100
+ });
101
+ // prompt user for confirmation of the inferred actions
102
+ let confirmation = await askUserForConfirmationWithAnswer('The assistant is ready to start working on the inferred actions. Do you want to proceed?', 'Yes, proceed with these actions', 'No, I want to change something', true, options);
103
+ if (confirmation.answer) {
104
+ putUserMessage(confirmation.answer);
105
+ }
106
+ if (!confirmation.confirmed) {
107
+ putSystemMessage('User declined the proposed actions.');
108
+ prompt.push({
109
+ type: 'user',
110
+ text: `Declining the proposed actions. ${confirmation.answer ?? ''}`,
111
+ functionResponses: [
112
+ {
113
+ name: initialInferenceCall.name,
114
+ call_id: initialInferenceCall.id,
115
+ content: '',
116
+ },
117
+ ],
118
+ });
119
+ return { breakLoop: false, items: [] };
120
+ }
121
+ putSystemMessage('User confirmed the proposed actions. Proceeding with parameter inference...');
122
+ // Ensure context for all planned files
123
+ const uniqueFilePaths = Array.from(new Set(actions.map((a) => a.filePath).filter((p) => !!p)));
124
+ if (uniqueFilePaths.length > 0) {
125
+ const contextAssuranceCall = {
126
+ name: 'contextAssurance',
127
+ args: { filePaths: uniqueFilePaths },
128
+ };
129
+ const contextResult = await executeStepEnsureContext(prompt, contextAssuranceCall, options);
130
+ if (contextResult === StepResult.BREAK) {
131
+ putSystemMessage('Error: Context ensuring failed during compound action. Aborting.');
132
+ return { breakLoop: false, items: [] };
133
+ }
134
+ }
135
+ // Add initial planning call to conversation history
136
+ prompt.push({
137
+ type: 'user', // User function response for the planning call (empty content as it was a planning step)
138
+ text: `Accepting the proposed actions. ${confirmation.answer ?? ''}`,
139
+ functionResponses: [
140
+ {
141
+ name: initialInferenceCall.name,
142
+ call_id: initialInferenceCall.id,
143
+ content: '',
144
+ },
145
+ ],
146
+ },
147
+ // Assistant message indicating planning is done, before parameter inference starts
148
+ {
149
+ type: 'assistant',
150
+ text: `I have inferred the actions and I am ready to determine their parameters.`,
151
+ });
152
+ // Step 2: Infer Parameters for Each Action
153
+ const detailedActions = [];
154
+ let parameterInferenceFailed = false;
155
+ const completedActionIds = new Set();
156
+ let actionsToInfer = [...actions]; // Create a mutable copy
157
+ while (actionsToInfer.length > 0) {
158
+ const processableActions = actionsToInfer.filter((action) => !action.dependsOn || action.dependsOn.every((dep) => completedActionIds.has(dep)));
159
+ if (processableActions.length === 0 && actionsToInfer.length > 0) {
160
+ putSystemMessage('Error: Circular dependency or unresolvable dependencies in compound actions.');
161
+ parameterInferenceFailed = true;
162
+ break;
163
+ }
164
+ if (processableActions.length === 0)
165
+ break; // All done or stuck
166
+ const results = await Promise.allSettled(processableActions.map(async (actionToProcess) => {
167
+ const { id: actionId, name: actionName, filePath } = actionToProcess;
168
+ const currentOperationDef = getOperationDefs().find((op) => op.name === actionName);
169
+ if (!currentOperationDef) {
170
+ putSystemMessage(`Error: Operation definition not found for action "${actionId}:${actionName}". Skipping this action.`);
171
+ parameterInferenceFailed = true;
172
+ return { success: false, actionId };
173
+ }
174
+ try {
175
+ putSystemMessage(`Inferring parameters for action: ${actionId}:${actionName}...`);
176
+ const paramInferencePrompt = constructCompoundActionParameterInferencePrompt(prompt, // Pass the *current* prompt history
177
+ actionId, actionName, currentOperationDef);
178
+ const paramResult = await generateContentFn(paramInferencePrompt, {
179
+ modelType: ModelType.DEFAULT,
180
+ functionDefs: getFunctionDefs(), // getFunctionDefs() includes all operation defs
181
+ requiredFunctionName: actionName,
182
+ temperature: 0.1,
183
+ expectedResponseType: { text: false, functionCall: true, media: false },
184
+ }, options);
185
+ let paramFunctionCall = paramResult.find((part) => part.type === 'functionCall')?.functionCall;
186
+ if (!paramFunctionCall?.args) {
187
+ putSystemMessage(`AI failed to generate parameters for action "${actionId}:${actionName}".`);
188
+ parameterInferenceFailed = true;
189
+ return { success: false, actionId };
190
+ }
191
+ if (actionName === 'patchFile') {
192
+ paramFunctionCall = await executeStepVerifyPatch(paramFunctionCall.args, generateContentFn, prompt, getFunctionDefs(), options.temperature, false, options);
193
+ if (!paramFunctionCall || !paramFunctionCall.args) {
194
+ putSystemMessage(`Error verifying patch for action "${actionId}:${actionName}".`);
195
+ parameterInferenceFailed = true;
196
+ return { success: false, actionId };
197
+ }
198
+ }
199
+ if (filePath) {
200
+ const fileSource = getSourceCode({ filterPaths: [filePath], forceAll: true }, options)[filePath];
201
+ if (fileSource && 'content' in fileSource) {
202
+ paramFunctionCall.args.oldContent = fileSource.content;
203
+ }
204
+ }
205
+ detailedActions.push({ name: actionName, args: paramFunctionCall.args });
206
+ putSystemMessage(`Inferred parameters for ${actionId}:${actionName}`, { ...paramFunctionCall });
207
+ // Add this specific parameter inference to the prompt history for subsequent inferences
208
+ prompt.push({
209
+ type: 'assistant',
210
+ text: `Inferring parameters for ${actionId}:${actionName}.`, // Short text for assistant turn
211
+ functionCalls: [paramFunctionCall],
212
+ }, {
213
+ type: 'user',
214
+ functionResponses: [
215
+ {
216
+ name: paramFunctionCall.name,
217
+ call_id: paramFunctionCall.id,
218
+ content: '', // Empty content for the function response
219
+ },
220
+ ],
221
+ });
222
+ completedActionIds.add(actionId);
223
+ return { success: true, actionId };
224
+ }
225
+ catch (error) {
226
+ const errorMessage = error instanceof Error ? error.message : String(error);
227
+ putSystemMessage(`Error inferring parameters for action "${actionName}": ${errorMessage}`);
228
+ parameterInferenceFailed = true;
229
+ return { success: false, actionId };
230
+ }
231
+ }));
232
+ // Filter out processed actions from actionsToInfer
233
+ actionsToInfer = actionsToInfer.filter((action) => !processableActions.find((pa) => pa.id === action.id));
234
+ if (results.some((result) => result.status === 'rejected' || (result.status === 'fulfilled' && !result.value.success))) {
235
+ putSystemMessage('Some actions failed to infer parameters. Stopping parameter inference.');
236
+ parameterInferenceFailed = true;
237
+ break;
238
+ }
239
+ }
240
+ if (parameterInferenceFailed) {
241
+ const assistantMessage = 'I was unable to determine all the necessary parameters for the requested actions. Please review the errors and try again, perhaps with more specific instructions.';
242
+ putAssistantMessage(assistantMessage);
243
+ prompt.push({
244
+ type: 'assistant',
245
+ text: assistantMessage,
246
+ });
247
+ // No user response needed here, assistant states the failure.
248
+ return { breakLoop: false, items: [] };
249
+ }
250
+ // Step 3: Consolidate and Confirm with User
251
+ putSystemMessage('Proposed actions', { actions: detailedActions });
252
+ confirmation = await askUserForConfirmationWithAnswer('Code changes are generated, now what?', 'Apply code changes', 'Reject code changes', true, options);
253
+ if (confirmation.answer) {
254
+ putUserMessage(confirmation.answer);
255
+ }
256
+ if (!confirmation.confirmed) {
257
+ putSystemMessage('User declined code changes.');
258
+ prompt.push({
259
+ type: 'user',
260
+ text: `Rejecting proposed code changes. ${confirmation.answer ?? ''}`,
261
+ });
262
+ return { breakLoop: false, items: [] };
263
+ }
264
+ // Step 4: Execute Actions
265
+ putSystemMessage('User accepted code changes. Applying...');
266
+ let executionError = null;
267
+ let executionErrorMessage = '';
268
+ prompt.push({
269
+ type: 'user', // User confirms the plan
270
+ text: `Applying code changes. ${confirmation.answer ?? 'Yes'}`,
271
+ });
272
+ for (const [index, action] of detailedActions.entries()) {
273
+ putSystemMessage(`Executing action ${index + 1}/${detailedActions.length}: ${action.name}`);
274
+ const executor = getOperationExecutor(action.name);
275
+ if (!executor) {
276
+ executionErrorMessage = `Error: Operation executor not found for action "${action.name}". Skipping this action.`;
277
+ putSystemMessage(executionErrorMessage);
278
+ continue;
279
+ }
280
+ try {
281
+ await executor(action.args, options);
282
+ putSystemMessage(`Action ${action.name} completed successfully.`);
283
+ }
284
+ catch (error) {
285
+ executionError = error instanceof Error ? error : new Error(String(error));
286
+ executionErrorMessage = `Error executing action ${index + 1} (${action.name}): ${executionError.message}. Stopping batch execution.`;
287
+ putSystemMessage(executionErrorMessage);
288
+ }
289
+ }
290
+ const finalAssistantMessage = executionError
291
+ ? `Failed to execute the batch: ${executionErrorMessage}`
292
+ : 'Successfully executed all actions in the batch.';
293
+ putAssistantMessage(finalAssistantMessage);
294
+ prompt.push({
295
+ type: 'assistant',
296
+ text: finalAssistantMessage,
297
+ });
298
+ // No final user "Thank you" here, as it would be a new turn.
299
+ return {
300
+ breakLoop: false,
301
+ items: [],
302
+ };
303
+ };
304
+ registerActionHandler('compoundAction', handleCompoundAction);
305
+ //# sourceMappingURL=handle-compound-action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-compound-action.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-iterate/handlers/handle-compound-action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAA2B,MAAM,wCAAwC,CAAC;AAE1G,OAAO,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC/G,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE;;;;;;GAMG;AACH,MAAM,UAAU,qCAAqC,CACnD,UAAwB,EACxB,gBAAoC,EACpC,iBAA8B;IAE9B,OAAO;QACL,GAAG,UAAU;QACb;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,gBAAgB,IAAI,EAAE;SAC7B;QACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,gHAAgH,gBAAgB,EAAE;iBACrI,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;iBACpB,IAAI,CACH,IAAI,CACL,+NACD,iBAAiB,CAAC,IACpB,wCAAwC;SACzC;KACF,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MACzE,cAAc,CAAC,OACjB,6BAA6B,CAAC;YAC9B,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IAED,MAAM,qBAAqB,GAAG,cAAc;QAC1C,CAAC,CAAC,gCAAgC,qBAAqB,EAAE;QACzD,CAAC,CAAC,iDAAiD,CAAC;IAEtD,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;IAE3C,MAAM,CAAC,IAAI,CAAC;QACV,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,qBAAqB;KAC5B,CAAC,CAAC;IACH,6DAA6D;IAE7D,OAAO;QACL,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,EAAE;KACV,CAAC;AACJ,CAAC,CAAC;AAEF,qBAAqB,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { ActionHandlerProps, ActionResult } from '../step-iterate-types.js';
2
+ export declare function handleConfirmCodeGeneration({ iterateCall, options, prompt, ...props }: ActionHandlerProps): Promise<ActionResult>;
@@ -0,0 +1,40 @@
1
+ import { putSystemMessage, putUserMessage } from '../../../../main/common/content-bus.js';
2
+ import { askUserForConfirmationWithAnswer } from '../../../../main/common/user-actions.js';
3
+ import { getActionHandler } from '../iterate-handler.js';
4
+ import { registerActionHandler } from '../step-iterate-handlers.js';
5
+ registerActionHandler('confirmCodeGeneration', handleConfirmCodeGeneration);
6
+ export async function handleConfirmCodeGeneration({ iterateCall, options, prompt, ...props }) {
7
+ const userConfirmation = await askUserForConfirmationWithAnswer('The assistant is ready to start code generation. Do you want to proceed?', 'Start code generation', 'Continue conversation', true, options);
8
+ if (userConfirmation.answer) {
9
+ putUserMessage(userConfirmation.answer);
10
+ }
11
+ if (userConfirmation.confirmed) {
12
+ putSystemMessage('Proceeding with code generation.');
13
+ prompt.push({
14
+ type: 'assistant',
15
+ text: iterateCall.args?.message ?? '',
16
+ }, {
17
+ type: 'user',
18
+ text: 'Confirmed. Proceed with code generation.' + (userConfirmation.answer ? ` ${userConfirmation.answer}` : ''),
19
+ });
20
+ return await getActionHandler('codeGeneration')({
21
+ iterateCall,
22
+ options,
23
+ prompt,
24
+ ...props,
25
+ });
26
+ }
27
+ else {
28
+ putSystemMessage('Declined. Continuing the conversation.');
29
+ prompt.push({ type: 'assistant', text: iterateCall.args?.message ?? '' }, {
30
+ type: 'user',
31
+ text: 'Declined. Please continue the conversation.' +
32
+ (userConfirmation.answer ? ` ${userConfirmation.answer}` : ''),
33
+ });
34
+ return {
35
+ breakLoop: false,
36
+ items: [],
37
+ };
38
+ }
39
+ }
40
+ //# sourceMappingURL=handle-confirm-code-generation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-confirm-code-generation.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-iterate/handlers/handle-confirm-code-generation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC1F,OAAO,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAGpE,qBAAqB,CAAC,uBAAuB,EAAE,2BAA2B,CAAC,CAAC;AAE5E,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,EAChD,WAAW,EACX,OAAO,EACP,MAAM,EACN,GAAG,KAAK,EACW;IACnB,MAAM,gBAAgB,GAAG,MAAM,gCAAgC,CAC7D,0EAA0E,EAC1E,uBAAuB,EACvB,uBAAuB,EACvB,IAAI,EACJ,OAAO,CACR,CAAC;IAEF,IAAI,gBAAgB,CAAC,MAAM,EAAE,CAAC;QAC5B,cAAc,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,gBAAgB,CAAC,SAAS,EAAE,CAAC;QAC/B,gBAAgB,CAAC,kCAAkC,CAAC,CAAC;QAErD,MAAM,CAAC,IAAI,CACT;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE;SACtC,EACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EACF,0CAA0C,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9G,CACF,CAAC;QAEF,OAAO,MAAM,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;YAC9C,WAAW;YACX,OAAO;YACP,MAAM;YACN,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,gBAAgB,CAAC,wCAAwC,CAAC,CAAC;QAC3D,MAAM,CAAC,IAAI,CACT,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,EAAE,EAC5D;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EACF,6CAA6C;gBAC7C,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACjE,CACF,CAAC;QAEF,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { ActionHandlerProps, ActionResult } from '../step-iterate-types.js';
2
+ export declare function handleContextCompression({ iterateCall, prompt, options, generateContentFn, }: ActionHandlerProps): Promise<ActionResult>;
@@ -0,0 +1,35 @@
1
+ import { executeStepContextCompression } from '../../step-context-compression.js';
2
+ import { putSystemMessage } from '../../../../main/common/content-bus.js';
3
+ import { StepResult } from '../../steps-types.js';
4
+ import { askUserForConfirmation } from '../../../../main/common/user-actions.js';
5
+ import { registerActionHandler } from '../step-iterate-handlers.js';
6
+ registerActionHandler('contextCompression', handleContextCompression);
7
+ export async function handleContextCompression({ iterateCall, prompt, options, generateContentFn, }) {
8
+ putSystemMessage('Context compression requested.');
9
+ // First confirmation: Ask user if they want to proceed with content generation
10
+ const compressionConfirm = await askUserForConfirmation('The assistant suggests compressing the context. Do you want to proceed with context compression?', false, options, 'Compress context', 'Continue conversation');
11
+ if (!compressionConfirm.confirmed) {
12
+ putSystemMessage('Context compression rejected.');
13
+ prompt.push({
14
+ type: 'assistant',
15
+ text: iterateCall.args?.message ?? '',
16
+ }, {
17
+ type: 'user',
18
+ text: 'Rejecting context compression.',
19
+ });
20
+ return {
21
+ breakLoop: false,
22
+ items: [],
23
+ };
24
+ }
25
+ try {
26
+ // Execute compression step
27
+ const result = await executeStepContextCompression(generateContentFn, prompt, options);
28
+ return { breakLoop: result === StepResult.BREAK, items: [] };
29
+ }
30
+ catch (error) {
31
+ putSystemMessage('Error during context compression', { error });
32
+ return { breakLoop: false, items: [] };
33
+ }
34
+ }
35
+ //# sourceMappingURL=handle-context-compression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-context-compression.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-iterate/handlers/handle-context-compression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAElF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,qBAAqB,CAAC,oBAAoB,EAAE,wBAAwB,CAAC,CAAC;AAEtE,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,EAC7C,WAAW,EACX,MAAM,EACN,OAAO,EACP,iBAAiB,GACE;IACnB,gBAAgB,CAAC,gCAAgC,CAAC,CAAC;IAEnD,+EAA+E;IAC/E,MAAM,kBAAkB,GAAG,MAAM,sBAAsB,CACrD,kGAAkG,EAClG,KAAK,EACL,OAAO,EACP,kBAAkB,EAClB,uBAAuB,CACxB,CAAC;IAEF,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,CAAC;QAClC,gBAAgB,CAAC,+BAA+B,CAAC,CAAC;QAElD,MAAM,CAAC,IAAI,CACT;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE;SACtC,EACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,gCAAgC;SACvC,CACF,CAAC;QAEF,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,2BAA2B;QAC3B,MAAM,MAAM,GAAG,MAAM,6BAA6B,CAAC,iBAAiB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAEvF,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAC/D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gBAAgB,CAAC,kCAAkC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAChE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACzC,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { ActionHandlerProps, ActionResult } from '../step-iterate-types.js';
2
+ export declare function handleContextOptimization({ iterateCall, prompt, options, generateContentFn, }: ActionHandlerProps): Promise<ActionResult>;
@@ -0,0 +1,34 @@
1
+ import { refreshFiles } from '../../../../files/find-files.js';
2
+ import { putSystemMessage } from '../../../../main/common/content-bus.js';
3
+ import { askUserForConfirmation } from '../../../../main/common/user-actions.js';
4
+ import { executeStepContextOptimization } from '../../step-context-optimization.js';
5
+ import { registerActionHandler } from '../step-iterate-handlers.js';
6
+ registerActionHandler('contextOptimization', handleContextOptimization);
7
+ export async function handleContextOptimization({ iterateCall, prompt, options, generateContentFn, }) {
8
+ const userConfirmation = await askUserForConfirmation('The assistant suggests optimizing the context to reduce token usage, cost, and latency. Do you want to proceed?', false, options);
9
+ prompt.push({
10
+ type: 'assistant',
11
+ text: iterateCall.args?.message ?? '',
12
+ });
13
+ prompt.push({
14
+ type: 'user',
15
+ text: userConfirmation.confirmed
16
+ ? 'Context optimization proposal accepted.'
17
+ : 'Context optimization proposal rejected.',
18
+ });
19
+ if (userConfirmation.confirmed) {
20
+ // the request may be caused be an appearance of a new file, so lets refresh
21
+ refreshFiles();
22
+ // Execute context optimization step
23
+ putSystemMessage('Executing context optimization step.');
24
+ await executeStepContextOptimization(generateContentFn, prompt, options);
25
+ }
26
+ else {
27
+ putSystemMessage('Context optimization rejected.');
28
+ }
29
+ return {
30
+ breakLoop: false,
31
+ items: [],
32
+ };
33
+ }
34
+ //# sourceMappingURL=handle-context-optimization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-context-optimization.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-iterate/handlers/handle-context-optimization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAGpE,qBAAqB,CAAC,qBAAqB,EAAE,yBAAyB,CAAC,CAAC;AAExE,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,EAC9C,WAAW,EACX,MAAM,EACN,OAAO,EACP,iBAAiB,GACE;IACnB,MAAM,gBAAgB,GAAG,MAAM,sBAAsB,CACnD,iHAAiH,EACjH,KAAK,EACL,OAAO,CACR,CAAC;IAEF,MAAM,CAAC,IAAI,CAAC;QACV,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE;KACtC,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CAAC;QACV,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,gBAAgB,CAAC,SAAS;YAC9B,CAAC,CAAC,yCAAyC;YAC3C,CAAC,CAAC,yCAAyC;KAC9C,CAAC,CAAC;IAEH,IAAI,gBAAgB,CAAC,SAAS,EAAE,CAAC;QAC/B,4EAA4E;QAC5E,YAAY,EAAE,CAAC;QAEf,oCAAoC;QACpC,gBAAgB,CAAC,sCAAsC,CAAC,CAAC;QACzD,MAAM,8BAA8B,CAAC,iBAAiB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;SAAM,CAAC;QACN,gBAAgB,CAAC,gCAAgC,CAAC,CAAC;IACrD,CAAC;IAED,OAAO;QACL,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,EAAE;KACV,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { ActionHandlerProps, ActionResult } from '../step-iterate-types.js';
2
+ import { ConversationEdge, ConversationNode } from '../../../function-defs/conversation-graph.js';
3
+ export declare const CONVERSATION_GRAPH_PROMPT = "# Conversation Graph Guide\n\nA conversation graph is a flexible structure for managing complex interactions. It consists of nodes (conversation states) connected by edges (transitions).\n\n## Core Components\n\n1. **Nodes (States)**\n - Each node represents a distinct state in the conversation\n - Contains:\n - id: Unique identifier\n - actionType: The action to perform\n - instruction: Internal guidance for execution\n\n2. **Edges (Transitions)**\n - Connect nodes to define possible conversation flows\n - Contains:\n - sourceNode: Starting point\n - targetNode: Destination\n - instruction: Condition for transition\n\n## Key Concepts\n\n- **State Management**: Nodes capture the current state and required action\n- **Flow Control**: Edges determine how the conversation can progress\n- **Flexibility**: Support for various conversation patterns and flows\n- **Context Awareness**: Each node operates with awareness of the conversation state\n- **User Interaction**: User can reject or accept some of the actions, so the graph should account for that\n\n## Implementation Notes\n\n- Nodes should be self-contained and focused\n- Edges should have clear, evaluatable conditions\n- Any node can connect to any other node if logically appropriate\n- Nodes and edges must formulate a graph structure, allowing for complex interactions\n\n## Graph Structure requirements and constraints\n\n- The graph may contain cycles, but should be designed to avoid infinite loops\n- Each node should be reachable from the entry node\n- The entry node should be clearly defined and serve as the starting point for the conversation\n\n## Technical Details\n\nNodes require:\n- Unique ID for reference\n- Valid action type\n- Clear execution instructions\n\nEdges require:\n- Valid source and target node IDs\n- Clear transition conditions\n\n# Let's get started!\n\n0. Read and understand the conersation we had so far (context).\n1. Think about the big picture of the upcoming conversation flow and the desired outcome.\n2. Define the entry node to start the upcoming conversation.\n3. Create nodes with reasoning, action type, and instructions.\n4. Connect nodes with edges to define the conversation flow.\n";
4
+ export declare const getEdgeEvaluationPrompt: (currentNode: ConversationNode, outgoingEdges: ConversationEdge[]) => string;
5
+ export declare 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.";
6
+ export declare 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.";
7
+ /**
8
+ * Main handler for the conversationGraph action.
9
+ * Orchestrates confirmation, generation, analysis/revision, and traversal.
10
+ */
11
+ export declare function handleConversationGraph(props: ActionHandlerProps): Promise<ActionResult>;