genaicode 0.5.1 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (627) hide show
  1. package/README.md +7 -11
  2. package/dist/ai-service/anthropic.js +7 -2
  3. package/dist/ai-service/anthropic.js.map +1 -1
  4. package/dist/ai-service/chat-gpt.d.ts +2 -0
  5. package/dist/ai-service/chat-gpt.js +7 -4
  6. package/dist/ai-service/chat-gpt.js.map +1 -1
  7. package/dist/ai-service/common.test.js +2 -1
  8. package/dist/ai-service/common.test.js.map +1 -1
  9. package/dist/ai-service/dall-e.js +1 -0
  10. package/dist/ai-service/dall-e.js.map +1 -1
  11. package/dist/ai-service/vertex-ai-claude.js +1 -0
  12. package/dist/ai-service/vertex-ai-claude.js.map +1 -1
  13. package/dist/cli/cli-options.js +10 -22
  14. package/dist/cli/cli-options.js.map +1 -1
  15. package/dist/cli/cli-params.d.ts +1 -5
  16. package/dist/cli/cli-params.js +10 -29
  17. package/dist/cli/cli-params.js.map +1 -1
  18. package/dist/cli/validate-cli-params.js +16 -11
  19. package/dist/cli/validate-cli-params.js.map +1 -1
  20. package/dist/cli/validate-cli-params.test.js +2 -2
  21. package/dist/cli/validate-cli-params.test.js.map +1 -1
  22. package/dist/examples/genaicode_plugins/fake_ai_service.d.ts +3 -0
  23. package/dist/examples/genaicode_plugins/fake_ai_service.js +11 -0
  24. package/dist/examples/genaicode_plugins/fake_ai_service.js.map +1 -0
  25. package/dist/examples/genaicode_plugins/grok_ai_service.d.ts +3 -0
  26. package/dist/examples/genaicode_plugins/grok_ai_service.js +153 -0
  27. package/dist/examples/genaicode_plugins/grok_ai_service.js.map +1 -0
  28. package/dist/examples/genaicode_plugins/nonsense_operation.d.ts +3 -0
  29. package/dist/examples/genaicode_plugins/nonsense_operation.js +23 -0
  30. package/dist/examples/genaicode_plugins/nonsense_operation.js.map +1 -0
  31. package/dist/files/path-utils.d.ts +1 -0
  32. package/dist/files/path-utils.js +12 -0
  33. package/dist/files/path-utils.js.map +1 -0
  34. package/dist/files/update-files.d.ts +1 -1
  35. package/dist/files/update-files.js +8 -183
  36. package/dist/files/update-files.js.map +1 -1
  37. package/dist/index.d.ts +6 -1
  38. package/dist/index.js +6 -0
  39. package/dist/index.js.map +1 -1
  40. package/dist/main/codegen-types.d.ts +31 -1
  41. package/dist/main/codegen-utils.d.ts +3 -0
  42. package/dist/main/codegen-utils.js +16 -0
  43. package/dist/main/codegen-utils.js.map +1 -0
  44. package/dist/main/codegen.js +15 -26
  45. package/dist/main/codegen.js.map +1 -1
  46. package/dist/main/codegen.test.js +12 -15
  47. package/dist/main/codegen.test.js.map +1 -1
  48. package/dist/main/common/user-actions.d.ts +14 -2
  49. package/dist/main/common/user-actions.js +16 -1
  50. package/dist/main/common/user-actions.js.map +1 -1
  51. package/dist/main/config-lib.d.ts +1 -0
  52. package/dist/main/config-lib.js +7 -0
  53. package/dist/main/config-lib.js.map +1 -1
  54. package/dist/main/config.js +3 -0
  55. package/dist/main/config.js.map +1 -1
  56. package/dist/main/interactive/user-action-handlers.js +2 -2
  57. package/dist/main/interactive/user-action-handlers.js.map +1 -1
  58. package/dist/main/plugin-loader.d.ts +9 -0
  59. package/dist/main/plugin-loader.js +55 -0
  60. package/dist/main/plugin-loader.js.map +1 -0
  61. package/dist/main/ui/backend/api-utils.js +2 -2
  62. package/dist/main/ui/backend/api-utils.js.map +1 -1
  63. package/dist/main/ui/backend/api.js +15 -3
  64. package/dist/main/ui/backend/api.js.map +1 -1
  65. package/dist/main/ui/backend/service.d.ts +6 -11
  66. package/dist/main/ui/backend/service.js +11 -7
  67. package/dist/main/ui/backend/service.js.map +1 -1
  68. package/dist/main/ui/common/api-types.d.ts +20 -0
  69. package/dist/main/ui/common/api-types.js +2 -0
  70. package/dist/main/ui/common/api-types.js.map +1 -0
  71. package/dist/main/ui/frontend/assets/{index-Dicb_1yw.js → index-Dk_qaEQg.js} +75 -72
  72. package/dist/main/ui/frontend/index.html +1 -1
  73. package/dist/main/ui/user-action-handlers.js +9 -4
  74. package/dist/main/ui/user-action-handlers.js.map +1 -1
  75. package/dist/operations/create-directory/create-directory-def.d.ts +9 -0
  76. package/dist/operations/create-directory/create-directory-def.js +22 -0
  77. package/dist/operations/create-directory/create-directory-def.js.map +1 -0
  78. package/dist/operations/create-directory/create-directory-executor.d.ts +6 -0
  79. package/dist/operations/create-directory/create-directory-executor.js +22 -0
  80. package/dist/operations/create-directory/create-directory-executor.js.map +1 -0
  81. package/dist/operations/create-file/create-file-def.d.ts +10 -0
  82. package/dist/operations/create-file/create-file-def.js +26 -0
  83. package/dist/operations/create-file/create-file-def.js.map +1 -0
  84. package/dist/operations/create-file/create-file-executor.d.ts +6 -0
  85. package/dist/operations/create-file/create-file-executor.js +27 -0
  86. package/dist/operations/create-file/create-file-executor.js.map +1 -0
  87. package/dist/operations/delete-file/delete-file-def.d.ts +9 -0
  88. package/dist/operations/delete-file/delete-file-def.js +22 -0
  89. package/dist/operations/delete-file/delete-file-def.js.map +1 -0
  90. package/dist/operations/delete-file/delete-file-executor.d.ts +6 -0
  91. package/dist/operations/delete-file/delete-file-executor.js +23 -0
  92. package/dist/operations/delete-file/delete-file-executor.js.map +1 -0
  93. package/dist/operations/download-file/download-file-def.d.ts +10 -0
  94. package/dist/operations/download-file/download-file-def.js +26 -0
  95. package/dist/operations/download-file/download-file-def.js.map +1 -0
  96. package/dist/operations/download-file/download-file-executor.d.ts +6 -0
  97. package/dist/operations/download-file/download-file-executor.js +44 -0
  98. package/dist/operations/download-file/download-file-executor.js.map +1 -0
  99. package/dist/operations/imgly-remove-background/imgly-remove-background-def.d.ts +10 -0
  100. package/dist/operations/imgly-remove-background/imgly-remove-background-def.js +26 -0
  101. package/dist/operations/imgly-remove-background/imgly-remove-background-def.js.map +1 -0
  102. package/dist/operations/imgly-remove-background/imgly-remove-background-executor.d.ts +6 -0
  103. package/dist/operations/imgly-remove-background/imgly-remove-background-executor.js +40 -0
  104. package/dist/operations/imgly-remove-background/imgly-remove-background-executor.js.map +1 -0
  105. package/dist/operations/move-file/move-file-def.d.ts +10 -0
  106. package/dist/operations/move-file/move-file-def.js +26 -0
  107. package/dist/operations/move-file/move-file-def.js.map +1 -0
  108. package/dist/operations/move-file/move-file-executor.d.ts +6 -0
  109. package/dist/operations/move-file/move-file-executor.js +29 -0
  110. package/dist/operations/move-file/move-file-executor.js.map +1 -0
  111. package/dist/operations/operations-index.d.ts +3 -0
  112. package/dist/operations/operations-index.js +33 -0
  113. package/dist/operations/operations-index.js.map +1 -0
  114. package/dist/operations/patch-file/patch-file-def.d.ts +10 -0
  115. package/dist/operations/patch-file/patch-file-def.js +39 -0
  116. package/dist/operations/patch-file/patch-file-def.js.map +1 -0
  117. package/dist/operations/patch-file/patch-file-executor.d.ts +5 -0
  118. package/dist/operations/patch-file/patch-file-executor.js +26 -0
  119. package/dist/operations/patch-file/patch-file-executor.js.map +1 -0
  120. package/dist/operations/resize-image/resize-image-def.d.ts +13 -0
  121. package/dist/operations/resize-image/resize-image-def.js +37 -0
  122. package/dist/operations/resize-image/resize-image-def.js.map +1 -0
  123. package/dist/operations/resize-image/resize-image-executor.d.ts +5 -0
  124. package/dist/operations/resize-image/resize-image-executor.js +30 -0
  125. package/dist/operations/resize-image/resize-image-executor.js.map +1 -0
  126. package/dist/operations/split-image/split-image-def.d.ts +18 -0
  127. package/dist/operations/split-image/split-image-def.js +46 -0
  128. package/dist/operations/split-image/split-image-def.js.map +1 -0
  129. package/dist/operations/split-image/split-image-executor.d.ts +6 -0
  130. package/dist/operations/split-image/split-image-executor.js +51 -0
  131. package/dist/operations/split-image/split-image-executor.js.map +1 -0
  132. package/dist/operations/update-file/update-file-def.d.ts +10 -0
  133. package/dist/operations/update-file/update-file-def.js +26 -0
  134. package/dist/operations/update-file/update-file-def.js.map +1 -0
  135. package/dist/operations/update-file/update-file-executor.d.ts +5 -0
  136. package/dist/operations/update-file/update-file-executor.js +22 -0
  137. package/dist/operations/update-file/update-file-executor.js.map +1 -0
  138. package/dist/prompt/ai-service-fallback.js.map +1 -1
  139. package/dist/prompt/function-calling-validate.js +2 -2
  140. package/dist/prompt/function-calling-validate.js.map +1 -1
  141. package/dist/prompt/function-calling.d.ts +1 -1
  142. package/dist/prompt/function-calling.js +29 -44
  143. package/dist/prompt/function-calling.js.map +1 -1
  144. package/dist/prompt/function-defs/ask-question-reflect.d.ts +2 -20
  145. package/dist/prompt/function-defs/ask-question-reflect.js.map +1 -1
  146. package/dist/prompt/function-defs/ask-question.d.ts +2 -73
  147. package/dist/prompt/function-defs/ask-question.js +28 -14
  148. package/dist/prompt/function-defs/ask-question.js.map +1 -1
  149. package/dist/prompt/function-defs/codegen-summary.d.ts +2 -62
  150. package/dist/prompt/function-defs/codegen-summary.js +4 -2
  151. package/dist/prompt/function-defs/codegen-summary.js.map +1 -1
  152. package/dist/prompt/function-defs/explanation.d.ts +2 -14
  153. package/dist/prompt/function-defs/explanation.js.map +1 -1
  154. package/dist/prompt/function-defs/generate-image.d.ts +2 -38
  155. package/dist/prompt/function-defs/generate-image.js.map +1 -1
  156. package/dist/prompt/function-defs/get-image-assets.d.ts +2 -17
  157. package/dist/prompt/function-defs/get-image-assets.js.map +1 -1
  158. package/dist/prompt/function-defs/get-source-code.d.ts +2 -17
  159. package/dist/prompt/function-defs/get-source-code.js.map +1 -1
  160. package/dist/prompt/function-defs/optimize-context.d.ts +2 -43
  161. package/dist/prompt/function-defs/optimize-context.js.map +1 -1
  162. package/dist/prompt/function-defs/read-history.d.ts +2 -13
  163. package/dist/prompt/function-defs/read-history.js.map +1 -1
  164. package/dist/prompt/function-defs/set-summaries.d.ts +2 -28
  165. package/dist/prompt/function-defs/set-summaries.js.map +1 -1
  166. package/dist/prompt/function-defs/update-history.d.ts +2 -18
  167. package/dist/prompt/function-defs/update-history.js.map +1 -1
  168. package/dist/prompt/prompt-service.js +6 -6
  169. package/dist/prompt/prompt-service.js.map +1 -1
  170. package/dist/prompt/prompt-service.test.js +16 -19
  171. package/dist/prompt/prompt-service.test.js.map +1 -1
  172. package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.d.ts +2 -0
  173. package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.js +16 -0
  174. package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.js.map +1 -0
  175. package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.d.ts +2 -0
  176. package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js +37 -0
  177. package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js.map +1 -0
  178. package/dist/prompt/steps/step-ask-question/handlers/context-optimization.d.ts +2 -0
  179. package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js +36 -0
  180. package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js.map +1 -0
  181. package/dist/prompt/steps/step-ask-question/handlers/default-action.d.ts +2 -0
  182. package/dist/prompt/steps/step-ask-question/handlers/default-action.js +18 -0
  183. package/dist/prompt/steps/step-ask-question/handlers/default-action.js.map +1 -0
  184. package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer.d.ts +2 -0
  185. package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer.js +20 -0
  186. package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer.js.map +1 -0
  187. package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.d.ts +2 -0
  188. package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js +43 -0
  189. package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js.map +1 -0
  190. package/dist/prompt/steps/step-ask-question/handlers/request-files-content.d.ts +2 -0
  191. package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js +49 -0
  192. package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js.map +1 -0
  193. package/dist/prompt/steps/step-ask-question/handlers/request-permissions.d.ts +2 -0
  194. package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js +46 -0
  195. package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js.map +1 -0
  196. package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.d.ts +2 -0
  197. package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.js +16 -0
  198. package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.js.map +1 -0
  199. package/dist/prompt/steps/step-ask-question/step-ask-question-handlers.d.ts +0 -0
  200. package/dist/prompt/steps/step-ask-question/step-ask-question-handlers.js +2 -0
  201. package/dist/prompt/steps/step-ask-question/step-ask-question-handlers.js.map +1 -0
  202. package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.d.ts +4 -0
  203. package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.js +91 -0
  204. package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.js.map +1 -0
  205. package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts +56 -0
  206. package/dist/prompt/steps/step-ask-question/step-ask-question-types.js +2 -0
  207. package/dist/prompt/steps/step-ask-question/step-ask-question-types.js.map +1 -0
  208. package/dist/prompt/steps/step-ask-question/step-ask-question.d.ts +6 -0
  209. package/dist/prompt/steps/step-ask-question/step-ask-question.js +95 -0
  210. package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -0
  211. package/dist/prompt/steps/step-context-optimization.js +9 -2
  212. package/dist/prompt/steps/step-context-optimization.js.map +1 -1
  213. package/dist/prompt/steps/step-generate-summary.js +2 -2
  214. package/dist/prompt/steps/step-generate-summary.js.map +1 -1
  215. package/dist/prompt/steps/step-history-update.js +2 -2
  216. package/dist/prompt/steps/step-history-update.js.map +1 -1
  217. package/dist/prompt/steps/step-summarization.js +2 -2
  218. package/dist/prompt/steps/step-summarization.js.map +1 -1
  219. package/dist/src/ai-service/ai-studio.d.ts +6 -0
  220. package/dist/src/ai-service/ai-studio.js +190 -0
  221. package/dist/src/ai-service/ai-studio.js.map +1 -0
  222. package/dist/src/ai-service/anthropic.d.ts +6 -0
  223. package/dist/src/ai-service/anthropic.js +150 -0
  224. package/dist/src/ai-service/anthropic.js.map +1 -0
  225. package/dist/src/ai-service/chat-gpt.d.ts +5 -0
  226. package/dist/src/ai-service/chat-gpt.js +146 -0
  227. package/dist/src/ai-service/chat-gpt.js.map +1 -0
  228. package/dist/src/ai-service/common.d.ts +69 -0
  229. package/dist/src/ai-service/common.js +38 -0
  230. package/dist/src/ai-service/common.js.map +1 -0
  231. package/dist/src/ai-service/common.test.d.ts +1 -0
  232. package/dist/src/ai-service/common.test.js +86 -0
  233. package/dist/src/ai-service/common.test.js.map +1 -0
  234. package/dist/src/ai-service/dall-e.d.ts +14 -0
  235. package/dist/src/ai-service/dall-e.js +50 -0
  236. package/dist/src/ai-service/dall-e.js.map +1 -0
  237. package/dist/src/ai-service/unescape-function-call.d.ts +7 -0
  238. package/dist/src/ai-service/unescape-function-call.js +59 -0
  239. package/dist/src/ai-service/unescape-function-call.js.map +1 -0
  240. package/dist/src/ai-service/unescape-function-call.test.d.ts +1 -0
  241. package/dist/src/ai-service/unescape-function-call.test.js +18 -0
  242. package/dist/src/ai-service/unescape-function-call.test.js.map +1 -0
  243. package/dist/src/ai-service/vertex-ai-claude.d.ts +5 -0
  244. package/dist/src/ai-service/vertex-ai-claude.js +104 -0
  245. package/dist/src/ai-service/vertex-ai-claude.js.map +1 -0
  246. package/dist/src/ai-service/vertex-ai-imagen.d.ts +14 -0
  247. package/dist/src/ai-service/vertex-ai-imagen.js +77 -0
  248. package/dist/src/ai-service/vertex-ai-imagen.js.map +1 -0
  249. package/dist/src/ai-service/vertex-ai.d.ts +6 -0
  250. package/dist/src/ai-service/vertex-ai.js +202 -0
  251. package/dist/src/ai-service/vertex-ai.js.map +1 -0
  252. package/dist/src/cli/cli-options.d.ts +10 -0
  253. package/dist/src/cli/cli-options.js +132 -0
  254. package/dist/src/cli/cli-options.js.map +1 -0
  255. package/dist/src/cli/cli-options.test.d.ts +1 -0
  256. package/dist/src/cli/cli-options.test.js +34 -0
  257. package/dist/src/cli/cli-options.test.js.map +1 -0
  258. package/dist/src/cli/cli-params.d.ts +32 -0
  259. package/dist/src/cli/cli-params.js +106 -0
  260. package/dist/src/cli/cli-params.js.map +1 -0
  261. package/dist/src/cli/cli-params.test.d.ts +1 -0
  262. package/dist/src/cli/cli-params.test.js +38 -0
  263. package/dist/src/cli/cli-params.test.js.map +1 -0
  264. package/dist/src/cli/service-autodetect.d.ts +2 -0
  265. package/dist/src/cli/service-autodetect.js +17 -0
  266. package/dist/src/cli/service-autodetect.js.map +1 -0
  267. package/dist/src/cli/service-autodetect.test.d.ts +1 -0
  268. package/dist/src/cli/service-autodetect.test.js +38 -0
  269. package/dist/src/cli/service-autodetect.test.js.map +1 -0
  270. package/dist/src/cli/validate-cli-params.d.ts +18 -0
  271. package/dist/src/cli/validate-cli-params.js +145 -0
  272. package/dist/src/cli/validate-cli-params.js.map +1 -0
  273. package/dist/src/cli/validate-cli-params.test.d.ts +1 -0
  274. package/dist/src/cli/validate-cli-params.test.js +106 -0
  275. package/dist/src/cli/validate-cli-params.test.js.map +1 -0
  276. package/dist/src/files/cache-file.d.ts +3 -0
  277. package/dist/src/files/cache-file.js +36 -0
  278. package/dist/src/files/cache-file.js.map +1 -0
  279. package/dist/src/files/file-utils.d.ts +2 -0
  280. package/dist/src/files/file-utils.js +7 -0
  281. package/dist/src/files/file-utils.js.map +1 -0
  282. package/dist/src/files/file-utils.test.d.ts +1 -0
  283. package/dist/src/files/file-utils.test.js +18 -0
  284. package/dist/src/files/file-utils.test.js.map +1 -0
  285. package/dist/src/files/find-files.d.ts +9 -0
  286. package/dist/src/files/find-files.js +81 -0
  287. package/dist/src/files/find-files.js.map +1 -0
  288. package/dist/src/files/path-utils.d.ts +1 -0
  289. package/dist/src/files/path-utils.js +12 -0
  290. package/dist/src/files/path-utils.js.map +1 -0
  291. package/dist/src/files/read-files.d.ts +21 -0
  292. package/dist/src/files/read-files.js +68 -0
  293. package/dist/src/files/read-files.js.map +1 -0
  294. package/dist/src/files/read-files.test.d.ts +1 -0
  295. package/dist/src/files/read-files.test.js +89 -0
  296. package/dist/src/files/read-files.test.js.map +1 -0
  297. package/dist/src/files/temp-buffer.d.ts +2 -0
  298. package/dist/src/files/temp-buffer.js +12 -0
  299. package/dist/src/files/temp-buffer.js.map +1 -0
  300. package/dist/src/files/update-files.d.ts +6 -0
  301. package/dist/src/files/update-files.js +19 -0
  302. package/dist/src/files/update-files.js.map +1 -0
  303. package/dist/src/images/ensure-alpha.d.ts +1 -0
  304. package/dist/src/images/ensure-alpha.js +5 -0
  305. package/dist/src/images/ensure-alpha.js.map +1 -0
  306. package/dist/src/images/imgly-remove-background.d.ts +2 -0
  307. package/dist/src/images/imgly-remove-background.js +21 -0
  308. package/dist/src/images/imgly-remove-background.js.map +1 -0
  309. package/dist/src/images/resize-image.d.ts +19 -0
  310. package/dist/src/images/resize-image.js +22 -0
  311. package/dist/src/images/resize-image.js.map +1 -0
  312. package/dist/src/images/split-image.d.ts +18 -0
  313. package/dist/src/images/split-image.js +25 -0
  314. package/dist/src/images/split-image.js.map +1 -0
  315. package/dist/src/index.d.ts +3 -0
  316. package/dist/src/index.js +3 -0
  317. package/dist/src/index.js.map +1 -0
  318. package/dist/src/main/codegen-types.d.ts +58 -0
  319. package/dist/src/main/codegen-types.js +2 -0
  320. package/dist/src/main/codegen-types.js.map +1 -0
  321. package/dist/src/main/codegen-utils.d.ts +3 -0
  322. package/dist/src/main/codegen-utils.js +18 -0
  323. package/dist/src/main/codegen-utils.js.map +1 -0
  324. package/dist/src/main/codegen.d.ts +4 -0
  325. package/dist/src/main/codegen.js +201 -0
  326. package/dist/src/main/codegen.js.map +1 -0
  327. package/dist/src/main/codegen.test.d.ts +3 -0
  328. package/dist/src/main/codegen.test.js +288 -0
  329. package/dist/src/main/codegen.test.js.map +1 -0
  330. package/dist/src/main/common/content-bus-types.d.ts +21 -0
  331. package/dist/src/main/common/content-bus-types.js +11 -0
  332. package/dist/src/main/common/content-bus-types.js.map +1 -0
  333. package/dist/src/main/common/content-bus.d.ts +10 -0
  334. package/dist/src/main/common/content-bus.js +39 -0
  335. package/dist/src/main/common/content-bus.js.map +1 -0
  336. package/dist/src/main/common/cost-collector.d.ts +11 -0
  337. package/dist/src/main/common/cost-collector.js +90 -0
  338. package/dist/src/main/common/cost-collector.js.map +1 -0
  339. package/dist/src/main/common/user-actions.d.ts +19 -0
  340. package/dist/src/main/common/user-actions.js +30 -0
  341. package/dist/src/main/common/user-actions.js.map +1 -0
  342. package/dist/src/main/config-lib.d.ts +36 -0
  343. package/dist/src/main/config-lib.js +51 -0
  344. package/dist/src/main/config-lib.js.map +1 -0
  345. package/dist/src/main/config-lib.test.d.ts +1 -0
  346. package/dist/src/main/config-lib.test.js +64 -0
  347. package/dist/src/main/config-lib.test.js.map +1 -0
  348. package/dist/src/main/config.d.ts +7 -0
  349. package/dist/src/main/config.js +51 -0
  350. package/dist/src/main/config.js.map +1 -0
  351. package/dist/src/main/interactive/codegen-interactive.d.ts +2 -0
  352. package/dist/src/main/interactive/codegen-interactive.js +61 -0
  353. package/dist/src/main/interactive/codegen-interactive.js.map +1 -0
  354. package/dist/src/main/interactive/codegen-interactive.test.d.ts +5 -0
  355. package/dist/src/main/interactive/codegen-interactive.test.js +79 -0
  356. package/dist/src/main/interactive/codegen-interactive.test.js.map +1 -0
  357. package/dist/src/main/interactive/codegen-worker.d.ts +3 -0
  358. package/dist/src/main/interactive/codegen-worker.js +54 -0
  359. package/dist/src/main/interactive/codegen-worker.js.map +1 -0
  360. package/dist/src/main/interactive/common.d.ts +5 -0
  361. package/dist/src/main/interactive/common.js +51 -0
  362. package/dist/src/main/interactive/common.js.map +1 -0
  363. package/dist/src/main/interactive/configure.d.ts +2 -0
  364. package/dist/src/main/interactive/configure.js +99 -0
  365. package/dist/src/main/interactive/configure.js.map +1 -0
  366. package/dist/src/main/interactive/error-handling.d.ts +1 -0
  367. package/dist/src/main/interactive/error-handling.js +43 -0
  368. package/dist/src/main/interactive/error-handling.js.map +1 -0
  369. package/dist/src/main/interactive/help.d.ts +1 -0
  370. package/dist/src/main/interactive/help.js +22 -0
  371. package/dist/src/main/interactive/help.js.map +1 -0
  372. package/dist/src/main/interactive/process-comments.d.ts +2 -0
  373. package/dist/src/main/interactive/process-comments.js +39 -0
  374. package/dist/src/main/interactive/process-comments.js.map +1 -0
  375. package/dist/src/main/interactive/select-ai-service.d.ts +2 -0
  376. package/dist/src/main/interactive/select-ai-service.js +27 -0
  377. package/dist/src/main/interactive/select-ai-service.js.map +1 -0
  378. package/dist/src/main/interactive/task-file.d.ts +2 -0
  379. package/dist/src/main/interactive/task-file.js +35 -0
  380. package/dist/src/main/interactive/task-file.js.map +1 -0
  381. package/dist/src/main/interactive/text-prompt.d.ts +2 -0
  382. package/dist/src/main/interactive/text-prompt.js +18 -0
  383. package/dist/src/main/interactive/text-prompt.js.map +1 -0
  384. package/dist/src/main/interactive/user-action-handlers.d.ts +1 -0
  385. package/dist/src/main/interactive/user-action-handlers.js +13 -0
  386. package/dist/src/main/interactive/user-action-handlers.js.map +1 -0
  387. package/dist/src/main/interactive/user-interrupt.d.ts +1 -0
  388. package/dist/src/main/interactive/user-interrupt.js +36 -0
  389. package/dist/src/main/interactive/user-interrupt.js.map +1 -0
  390. package/dist/src/main/plugin-loader.d.ts +6 -0
  391. package/dist/src/main/plugin-loader.js +40 -0
  392. package/dist/src/main/plugin-loader.js.map +1 -0
  393. package/dist/src/main/ui/backend/api-utils.d.ts +2 -0
  394. package/dist/src/main/ui/backend/api-utils.js +18 -0
  395. package/dist/src/main/ui/backend/api-utils.js.map +1 -0
  396. package/dist/src/main/ui/backend/api.d.ts +2 -0
  397. package/dist/src/main/ui/backend/api.js +210 -0
  398. package/dist/src/main/ui/backend/api.js.map +1 -0
  399. package/dist/src/main/ui/backend/server.d.ts +7 -0
  400. package/dist/src/main/ui/backend/server.js +83 -0
  401. package/dist/src/main/ui/backend/server.js.map +1 -0
  402. package/dist/src/main/ui/backend/service.d.ts +44 -0
  403. package/dist/src/main/ui/backend/service.js +171 -0
  404. package/dist/src/main/ui/backend/service.js.map +1 -0
  405. package/dist/src/main/ui/codegen-ui.d.ts +2 -0
  406. package/dist/src/main/ui/codegen-ui.js +13 -0
  407. package/dist/src/main/ui/codegen-ui.js.map +1 -0
  408. package/dist/src/main/ui/common/api-types.d.ts +20 -0
  409. package/dist/src/main/ui/common/api-types.js +2 -0
  410. package/dist/src/main/ui/common/api-types.js.map +1 -0
  411. package/dist/src/main/ui/user-action-handlers.d.ts +2 -0
  412. package/dist/src/main/ui/user-action-handlers.js +14 -0
  413. package/dist/src/main/ui/user-action-handlers.js.map +1 -0
  414. package/dist/src/operations/create-directory/create-directory-def.d.ts +9 -0
  415. package/dist/src/operations/create-directory/create-directory-def.js +22 -0
  416. package/dist/src/operations/create-directory/create-directory-def.js.map +1 -0
  417. package/dist/src/operations/create-directory/create-directory-executor.d.ts +6 -0
  418. package/dist/src/operations/create-directory/create-directory-executor.js +22 -0
  419. package/dist/src/operations/create-directory/create-directory-executor.js.map +1 -0
  420. package/dist/src/operations/create-file/create-file-def.d.ts +10 -0
  421. package/dist/src/operations/create-file/create-file-def.js +26 -0
  422. package/dist/src/operations/create-file/create-file-def.js.map +1 -0
  423. package/dist/src/operations/create-file/create-file-executor.d.ts +6 -0
  424. package/dist/src/operations/create-file/create-file-executor.js +27 -0
  425. package/dist/src/operations/create-file/create-file-executor.js.map +1 -0
  426. package/dist/src/operations/delete-file/delete-file-def.d.ts +9 -0
  427. package/dist/src/operations/delete-file/delete-file-def.js +22 -0
  428. package/dist/src/operations/delete-file/delete-file-def.js.map +1 -0
  429. package/dist/src/operations/delete-file/delete-file-executor.d.ts +6 -0
  430. package/dist/src/operations/delete-file/delete-file-executor.js +23 -0
  431. package/dist/src/operations/delete-file/delete-file-executor.js.map +1 -0
  432. package/dist/src/operations/download-file/download-file-def.d.ts +10 -0
  433. package/dist/src/operations/download-file/download-file-def.js +26 -0
  434. package/dist/src/operations/download-file/download-file-def.js.map +1 -0
  435. package/dist/src/operations/download-file/download-file-executor.d.ts +6 -0
  436. package/dist/src/operations/download-file/download-file-executor.js +44 -0
  437. package/dist/src/operations/download-file/download-file-executor.js.map +1 -0
  438. package/dist/src/operations/imgly-remove-background/imgly-remove-background-def.d.ts +10 -0
  439. package/dist/src/operations/imgly-remove-background/imgly-remove-background-def.js +26 -0
  440. package/dist/src/operations/imgly-remove-background/imgly-remove-background-def.js.map +1 -0
  441. package/dist/src/operations/imgly-remove-background/imgly-remove-background-executor.d.ts +6 -0
  442. package/dist/src/operations/imgly-remove-background/imgly-remove-background-executor.js +40 -0
  443. package/dist/src/operations/imgly-remove-background/imgly-remove-background-executor.js.map +1 -0
  444. package/dist/src/operations/move-file/move-file-def.d.ts +10 -0
  445. package/dist/src/operations/move-file/move-file-def.js +26 -0
  446. package/dist/src/operations/move-file/move-file-def.js.map +1 -0
  447. package/dist/src/operations/move-file/move-file-executor.d.ts +6 -0
  448. package/dist/src/operations/move-file/move-file-executor.js +29 -0
  449. package/dist/src/operations/move-file/move-file-executor.js.map +1 -0
  450. package/dist/src/operations/operations-index.d.ts +3 -0
  451. package/dist/src/operations/operations-index.js +33 -0
  452. package/dist/src/operations/operations-index.js.map +1 -0
  453. package/dist/src/operations/patch-file/patch-file-def.d.ts +10 -0
  454. package/dist/src/operations/patch-file/patch-file-def.js +39 -0
  455. package/dist/src/operations/patch-file/patch-file-def.js.map +1 -0
  456. package/dist/src/operations/patch-file/patch-file-executor.d.ts +5 -0
  457. package/dist/src/operations/patch-file/patch-file-executor.js +26 -0
  458. package/dist/src/operations/patch-file/patch-file-executor.js.map +1 -0
  459. package/dist/src/operations/resize-image/resize-image-def.d.ts +13 -0
  460. package/dist/src/operations/resize-image/resize-image-def.js +37 -0
  461. package/dist/src/operations/resize-image/resize-image-def.js.map +1 -0
  462. package/dist/src/operations/resize-image/resize-image-executor.d.ts +5 -0
  463. package/dist/src/operations/resize-image/resize-image-executor.js +30 -0
  464. package/dist/src/operations/resize-image/resize-image-executor.js.map +1 -0
  465. package/dist/src/operations/split-image/split-image-def.d.ts +18 -0
  466. package/dist/src/operations/split-image/split-image-def.js +46 -0
  467. package/dist/src/operations/split-image/split-image-def.js.map +1 -0
  468. package/dist/src/operations/split-image/split-image-executor.d.ts +6 -0
  469. package/dist/src/operations/split-image/split-image-executor.js +51 -0
  470. package/dist/src/operations/split-image/split-image-executor.js.map +1 -0
  471. package/dist/src/operations/update-file/update-file-def.d.ts +10 -0
  472. package/dist/src/operations/update-file/update-file-def.js +26 -0
  473. package/dist/src/operations/update-file/update-file-def.js.map +1 -0
  474. package/dist/src/operations/update-file/update-file-executor.d.ts +5 -0
  475. package/dist/src/operations/update-file/update-file-executor.js +22 -0
  476. package/dist/src/operations/update-file/update-file-executor.js.map +1 -0
  477. package/dist/src/prompt/ai-service-fallback.d.ts +3 -0
  478. package/dist/src/prompt/ai-service-fallback.js +84 -0
  479. package/dist/src/prompt/ai-service-fallback.js.map +1 -0
  480. package/dist/src/prompt/function-calling-validate.d.ts +3 -0
  481. package/dist/src/prompt/function-calling-validate.js +99 -0
  482. package/dist/src/prompt/function-calling-validate.js.map +1 -0
  483. package/dist/src/prompt/function-calling.d.ts +5 -0
  484. package/dist/src/prompt/function-calling.js +43 -0
  485. package/dist/src/prompt/function-calling.js.map +1 -0
  486. package/dist/src/prompt/function-defs/ask-question-reflect.d.ts +2 -0
  487. package/dist/src/prompt/function-defs/ask-question-reflect.js +21 -0
  488. package/dist/src/prompt/function-defs/ask-question-reflect.js.map +1 -0
  489. package/dist/src/prompt/function-defs/ask-question.d.ts +8 -0
  490. package/dist/src/prompt/function-defs/ask-question.js +100 -0
  491. package/dist/src/prompt/function-defs/ask-question.js.map +1 -0
  492. package/dist/src/prompt/function-defs/codegen-summary.d.ts +5 -0
  493. package/dist/src/prompt/function-defs/codegen-summary.js +82 -0
  494. package/dist/src/prompt/function-defs/codegen-summary.js.map +1 -0
  495. package/dist/src/prompt/function-defs/explanation.d.ts +5 -0
  496. package/dist/src/prompt/function-defs/explanation.js +18 -0
  497. package/dist/src/prompt/function-defs/explanation.js.map +1 -0
  498. package/dist/src/prompt/function-defs/generate-image.d.ts +5 -0
  499. package/dist/src/prompt/function-defs/generate-image.js +42 -0
  500. package/dist/src/prompt/function-defs/generate-image.js.map +1 -0
  501. package/dist/src/prompt/function-defs/get-image-assets.d.ts +5 -0
  502. package/dist/src/prompt/function-defs/get-image-assets.js +21 -0
  503. package/dist/src/prompt/function-defs/get-image-assets.js.map +1 -0
  504. package/dist/src/prompt/function-defs/get-source-code.d.ts +5 -0
  505. package/dist/src/prompt/function-defs/get-source-code.js +22 -0
  506. package/dist/src/prompt/function-defs/get-source-code.js.map +1 -0
  507. package/dist/src/prompt/function-defs/optimize-context.d.ts +5 -0
  508. package/dist/src/prompt/function-defs/optimize-context.js +47 -0
  509. package/dist/src/prompt/function-defs/optimize-context.js.map +1 -0
  510. package/dist/src/prompt/function-defs/read-history.d.ts +2 -0
  511. package/dist/src/prompt/function-defs/read-history.js +14 -0
  512. package/dist/src/prompt/function-defs/read-history.js.map +1 -0
  513. package/dist/src/prompt/function-defs/set-summaries.d.ts +5 -0
  514. package/dist/src/prompt/function-defs/set-summaries.js +32 -0
  515. package/dist/src/prompt/function-defs/set-summaries.js.map +1 -0
  516. package/dist/src/prompt/function-defs/update-history.d.ts +5 -0
  517. package/dist/src/prompt/function-defs/update-history.js +22 -0
  518. package/dist/src/prompt/function-defs/update-history.js.map +1 -0
  519. package/dist/src/prompt/limits.d.ts +3 -0
  520. package/dist/src/prompt/limits.js +21 -0
  521. package/dist/src/prompt/limits.js.map +1 -0
  522. package/dist/src/prompt/limits.test.d.ts +1 -0
  523. package/dist/src/prompt/limits.test.js +35 -0
  524. package/dist/src/prompt/limits.test.js.map +1 -0
  525. package/dist/src/prompt/prompt-codegen.d.ts +9 -0
  526. package/dist/src/prompt/prompt-codegen.js +117 -0
  527. package/dist/src/prompt/prompt-codegen.js.map +1 -0
  528. package/dist/src/prompt/prompt-codegen.test.d.ts +1 -0
  529. package/dist/src/prompt/prompt-codegen.test.js +98 -0
  530. package/dist/src/prompt/prompt-codegen.test.js.map +1 -0
  531. package/dist/src/prompt/prompt-consts.d.ts +1 -0
  532. package/dist/src/prompt/prompt-consts.js +2 -0
  533. package/dist/src/prompt/prompt-consts.js.map +1 -0
  534. package/dist/src/prompt/prompt-service-ask-question.test.d.ts +4 -0
  535. package/dist/src/prompt/prompt-service-ask-question.test.js +215 -0
  536. package/dist/src/prompt/prompt-service-ask-question.test.js.map +1 -0
  537. package/dist/src/prompt/prompt-service.d.ts +5 -0
  538. package/dist/src/prompt/prompt-service.js +214 -0
  539. package/dist/src/prompt/prompt-service.js.map +1 -0
  540. package/dist/src/prompt/prompt-service.test.d.ts +2 -0
  541. package/dist/src/prompt/prompt-service.test.js +553 -0
  542. package/dist/src/prompt/prompt-service.test.js.map +1 -0
  543. package/dist/src/prompt/steps/step-ask-question/handlers/cancel-code-generation.d.ts +2 -0
  544. package/dist/src/prompt/steps/step-ask-question/handlers/cancel-code-generation.js +16 -0
  545. package/dist/src/prompt/steps/step-ask-question/handlers/cancel-code-generation.js.map +1 -0
  546. package/dist/src/prompt/steps/step-ask-question/handlers/confirm-code-generation.d.ts +2 -0
  547. package/dist/src/prompt/steps/step-ask-question/handlers/confirm-code-generation.js +37 -0
  548. package/dist/src/prompt/steps/step-ask-question/handlers/confirm-code-generation.js.map +1 -0
  549. package/dist/src/prompt/steps/step-ask-question/handlers/context-optimization.d.ts +2 -0
  550. package/dist/src/prompt/steps/step-ask-question/handlers/context-optimization.js +36 -0
  551. package/dist/src/prompt/steps/step-ask-question/handlers/context-optimization.js.map +1 -0
  552. package/dist/src/prompt/steps/step-ask-question/handlers/default-action.d.ts +2 -0
  553. package/dist/src/prompt/steps/step-ask-question/handlers/default-action.js +18 -0
  554. package/dist/src/prompt/steps/step-ask-question/handlers/default-action.js.map +1 -0
  555. package/dist/src/prompt/steps/step-ask-question/handlers/handle-request-answer.d.ts +2 -0
  556. package/dist/src/prompt/steps/step-ask-question/handlers/handle-request-answer.js +20 -0
  557. package/dist/src/prompt/steps/step-ask-question/handlers/handle-request-answer.js.map +1 -0
  558. package/dist/src/prompt/steps/step-ask-question/handlers/remove-files-from-context.d.ts +2 -0
  559. package/dist/src/prompt/steps/step-ask-question/handlers/remove-files-from-context.js +43 -0
  560. package/dist/src/prompt/steps/step-ask-question/handlers/remove-files-from-context.js.map +1 -0
  561. package/dist/src/prompt/steps/step-ask-question/handlers/request-files-content.d.ts +2 -0
  562. package/dist/src/prompt/steps/step-ask-question/handlers/request-files-content.js +49 -0
  563. package/dist/src/prompt/steps/step-ask-question/handlers/request-files-content.js.map +1 -0
  564. package/dist/src/prompt/steps/step-ask-question/handlers/request-permissions.d.ts +2 -0
  565. package/dist/src/prompt/steps/step-ask-question/handlers/request-permissions.js +46 -0
  566. package/dist/src/prompt/steps/step-ask-question/handlers/request-permissions.js.map +1 -0
  567. package/dist/src/prompt/steps/step-ask-question/handlers/start-code-generation.d.ts +2 -0
  568. package/dist/src/prompt/steps/step-ask-question/handlers/start-code-generation.js +16 -0
  569. package/dist/src/prompt/steps/step-ask-question/handlers/start-code-generation.js.map +1 -0
  570. package/dist/src/prompt/steps/step-ask-question/step-ask-question-handlers.d.ts +0 -0
  571. package/dist/src/prompt/steps/step-ask-question/step-ask-question-handlers.js +2 -0
  572. package/dist/src/prompt/steps/step-ask-question/step-ask-question-handlers.js.map +1 -0
  573. package/dist/src/prompt/steps/step-ask-question/step-ask-question-reflect.d.ts +4 -0
  574. package/dist/src/prompt/steps/step-ask-question/step-ask-question-reflect.js +91 -0
  575. package/dist/src/prompt/steps/step-ask-question/step-ask-question-reflect.js.map +1 -0
  576. package/dist/src/prompt/steps/step-ask-question/step-ask-question-types.d.ts +55 -0
  577. package/dist/src/prompt/steps/step-ask-question/step-ask-question-types.js +2 -0
  578. package/dist/src/prompt/steps/step-ask-question/step-ask-question-types.js.map +1 -0
  579. package/dist/src/prompt/steps/step-ask-question/step-ask-question.d.ts +6 -0
  580. package/dist/src/prompt/steps/step-ask-question/step-ask-question.js +88 -0
  581. package/dist/src/prompt/steps/step-ask-question/step-ask-question.js.map +1 -0
  582. package/dist/src/prompt/steps/step-context-optimization.d.ts +4 -0
  583. package/dist/src/prompt/steps/step-context-optimization.js +200 -0
  584. package/dist/src/prompt/steps/step-context-optimization.js.map +1 -0
  585. package/dist/src/prompt/steps/step-generate-image.d.ts +2 -0
  586. package/dist/src/prompt/steps/step-generate-image.js +29 -0
  587. package/dist/src/prompt/steps/step-generate-image.js.map +1 -0
  588. package/dist/src/prompt/steps/step-generate-summary.d.ts +3 -0
  589. package/dist/src/prompt/steps/step-generate-summary.js +41 -0
  590. package/dist/src/prompt/steps/step-generate-summary.js.map +1 -0
  591. package/dist/src/prompt/steps/step-history-update.d.ts +5 -0
  592. package/dist/src/prompt/steps/step-history-update.js +54 -0
  593. package/dist/src/prompt/steps/step-history-update.js.map +1 -0
  594. package/dist/src/prompt/steps/step-summarization.d.ts +8 -0
  595. package/dist/src/prompt/steps/step-summarization.js +75 -0
  596. package/dist/src/prompt/steps/step-summarization.js.map +1 -0
  597. package/dist/src/prompt/steps/step-validate-recover.d.ts +2 -0
  598. package/dist/src/prompt/steps/step-validate-recover.js +51 -0
  599. package/dist/src/prompt/steps/step-validate-recover.js.map +1 -0
  600. package/dist/src/prompt/steps/step-verify-patch.d.ts +6 -0
  601. package/dist/src/prompt/steps/step-verify-patch.js +34 -0
  602. package/dist/src/prompt/steps/step-verify-patch.js.map +1 -0
  603. package/dist/src/prompt/steps/steps-types.d.ts +16 -0
  604. package/dist/src/prompt/steps/steps-types.js +6 -0
  605. package/dist/src/prompt/steps/steps-types.js.map +1 -0
  606. package/dist/src/prompt/steps/steps-utils.d.ts +7 -0
  607. package/dist/src/prompt/steps/steps-utils.js +11 -0
  608. package/dist/src/prompt/steps/steps-utils.js.map +1 -0
  609. package/dist/src/prompt/systemprompt.d.ts +3 -0
  610. package/dist/src/prompt/systemprompt.js +209 -0
  611. package/dist/src/prompt/systemprompt.js.map +1 -0
  612. package/dist/src/prompt/systemprompt.test.d.ts +3 -0
  613. package/dist/src/prompt/systemprompt.test.js +43 -0
  614. package/dist/src/prompt/systemprompt.test.js.map +1 -0
  615. package/dist/src/prompt/token-estimator.d.ts +8 -0
  616. package/dist/src/prompt/token-estimator.js +31 -0
  617. package/dist/src/prompt/token-estimator.js.map +1 -0
  618. package/dist/src/vite-genaicode/vite-genaicode-frontend.d.ts +1 -0
  619. package/dist/src/vite-genaicode/vite-genaicode-frontend.js +142 -0
  620. package/dist/src/vite-genaicode/vite-genaicode-frontend.js.map +1 -0
  621. package/dist/src/vite-genaicode/vite-genaicode-plugin.d.ts +7 -0
  622. package/dist/src/vite-genaicode/vite-genaicode-plugin.js +40 -0
  623. package/dist/src/vite-genaicode/vite-genaicode-plugin.js.map +1 -0
  624. package/dist/vite-genaicode/vite-genaicode-plugin.d.ts +2 -1
  625. package/dist/vite-genaicode/vite-genaicode-plugin.js +20 -5
  626. package/dist/vite-genaicode/vite-genaicode-plugin.js.map +1 -1
  627. package/package.json +6 -3
@@ -0,0 +1,46 @@
1
+ import { askUserForConfirmation } from '../../../../main/common/user-actions.js';
2
+ import { StepResult } from '../../steps-types.js';
3
+ export async function handleRequestPermissions({ askQuestionCall, options, }) {
4
+ const userConfirmation = await askUserForConfirmation('The assistant is requesting additional permissions. Do you want to grant them?', false);
5
+ const user = {
6
+ type: 'user',
7
+ text: userConfirmation ? 'Permissions granted.' : 'Permission request denied.',
8
+ functionResponses: [{ name: 'askQuestion', call_id: askQuestionCall.id ?? '', content: undefined }],
9
+ };
10
+ if (userConfirmation) {
11
+ updatePermissions(askQuestionCall, options);
12
+ }
13
+ return {
14
+ breakLoop: false,
15
+ stepResult: StepResult.CONTINUE,
16
+ items: [
17
+ {
18
+ assistant: { type: 'assistant', text: askQuestionCall.args?.content ?? '', functionCalls: [askQuestionCall] },
19
+ user,
20
+ },
21
+ ],
22
+ };
23
+ }
24
+ function updatePermissions(askQuestionCall, options) {
25
+ if (askQuestionCall.args &&
26
+ typeof askQuestionCall.args === 'object' &&
27
+ 'requestPermissions' in askQuestionCall.args) {
28
+ const permissions = askQuestionCall.args.requestPermissions;
29
+ if (permissions && typeof permissions === 'object') {
30
+ if ('enableImagen' in permissions && permissions.enableImagen) {
31
+ options.imagen = options.aiService === 'chat-gpt' ? 'dall-e' : 'vertex-ai';
32
+ }
33
+ if ('enableVision' in permissions && permissions.enableVision)
34
+ options.vision = true;
35
+ if ('allowDirectoryCreate' in permissions && permissions.allowDirectoryCreate)
36
+ options.allowDirectoryCreate = true;
37
+ if ('allowFileCreate' in permissions && permissions.allowFileCreate)
38
+ options.allowFileCreate = true;
39
+ if ('allowFileDelete' in permissions && permissions.allowFileDelete)
40
+ options.allowFileDelete = true;
41
+ if ('allowFileMove' in permissions && permissions.allowFileMove)
42
+ options.allowFileMove = true;
43
+ }
44
+ }
45
+ }
46
+ //# sourceMappingURL=request-permissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-permissions.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/request-permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,EAC7C,eAAe,EACf,OAAO,GACY;IACnB,MAAM,gBAAgB,GAAG,MAAM,sBAAsB,CACnD,gFAAgF,EAChF,KAAK,CACN,CAAC;IAEF,MAAM,IAAI,GAAa;QACrB,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,4BAA4B;QAC9E,iBAAiB,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;KACpG,CAAC;IAEF,IAAI,gBAAgB,EAAE,CAAC;QACrB,iBAAiB,CAAC,eAAe,E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,IAAI,WAAW,IAAI,WAAW,CAAC,aAAa;gBAAE,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;QAChG,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { ActionHandlerProps, ActionResult } from '../step-ask-question-types.js';
2
+ export declare function handleStartCodeGeneration({ askQuestionCall }: ActionHandlerProps): Promise<ActionResult>;
@@ -0,0 +1,16 @@
1
+ import { putSystemMessage } from '../../../../main/common/content-bus.js';
2
+ import { StepResult } from '../../steps-types.js';
3
+ export async function handleStartCodeGeneration({ askQuestionCall }) {
4
+ putSystemMessage('Proceeding with code generation.');
5
+ return {
6
+ breakLoop: true,
7
+ stepResult: StepResult.CONTINUE,
8
+ items: [
9
+ {
10
+ assistant: { type: 'assistant', text: askQuestionCall.args?.content ?? '', functionCalls: [] },
11
+ user: { type: 'user', text: 'Proceeding with code generation.' },
12
+ },
13
+ ],
14
+ };
15
+ }
16
+ //# sourceMappingURL=start-code-generation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-code-generation.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/start-code-generation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,EAAE,eAAe,EAAsB;IACrF,gBAAgB,CAAC,kCAAkC,CAAC,CAAC;IACrD,OAAO;QACL,SAAS,EAAE,IAAI;QACf,UAAU,EAAE,UAAU,CAAC,QAAQ;QAC/B,KAAK,EAAE;YACL;gBACE,SAAS,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE;gBAC9F,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kCAAkC,EAAE;aACjE;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=step-ask-question-handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-ask-question-handlers.js","sourceRoot":"","sources":["../../../../src/prompt/steps/step-ask-question/step-ask-question-handlers.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { FunctionDef, GenerateContentFunction, PromptItem } from '../../../ai-service/common.js';
2
+ import { CodegenOptions } from '../../../main/codegen-types.js';
3
+ import { AskQuestionCall, EscalationDecision, SelfReflectionContext } from './step-ask-question-types.js';
4
+ export declare function performSelfReflection(askQuestionCall: AskQuestionCall, context: SelfReflectionContext, prompt: PromptItem[], functionDefs: FunctionDef[], options: CodegenOptions, generateContentFn: GenerateContentFunction): Promise<EscalationDecision>;
@@ -0,0 +1,91 @@
1
+ import { validateAndRecoverSingleResult } from '../step-validate-recover.js';
2
+ const SELF_REFLECT_PROMPT = `Please reflect on your last response provided in \`askQuestion\` function call in the context of our conversation by considering these questions:
3
+
4
+ - Did you fully understand and address the user's request?
5
+ - Was your response clear, accurate, and helpful?
6
+ - Are you confident that no further clarification or escalation is needed?
7
+ - Is your response too similar to previous questions or responses in the conversation?
8
+ - Is your response adding value to the conversation or moving it forward?
9
+ - Are you maintaining your own identity and perspective as an AI assistant?
10
+ - Are you directly addressing the user's points without deflecting or prolonging the conversation?
11
+ - Are you providing clear, concise, and helpful responses without being overly cautious or evasive?
12
+ - Are you demonstrating confidence and competence in your abilities without expressing unnecessary uncertainty?
13
+
14
+ Common problems/pitfalls:
15
+
16
+ - There is an in-depth question to the user, but actionType is set to confirmCodeGeneration, while it should be requestAnswer
17
+ - Question was already answered before, but the assistant is asking the same question again
18
+ - The question content is incomplete, for example the question content ends with a colon
19
+ - Saying that an analysis will be done, instead of actually doing the analysis
20
+ - The response is too similar to a previous question or response
21
+ - The assistant takes on the user's voice or persona instead of maintaining its own identity
22
+
23
+ Specific examples of problematic responses:
24
+
25
+ 1. User: "What's the weather like today?"
26
+ Assistant: "To provide information about today's weather, I'll need to know your location. What city are you in?"
27
+ User: "New York"
28
+ Assistant: "To give you accurate weather information for New York, I'll need to know which specific area of New York you're interested in. Could you please provide more details about your location?"
29
+ Problem: The assistant is being overly cautious and asking for unnecessary details, prolonging the conversation instead of providing a helpful response based on the information already given.
30
+
31
+ 2. User: "Can you explain how to implement a binary search algorithm?"
32
+ Assistant: "Certainly! I'd be happy to explain how to implement a binary search algorithm. Before we begin, could you tell me what programming language you'd like the explanation in?"
33
+ User: "Python"
34
+ Assistant: "Great choice! Python is an excellent language for implementing a binary search algorithm. Before we dive into the Python implementation, could you let me know your level of experience with Python programming?"
35
+ Problem: The assistant is asking for excessive context before providing the requested explanation, which may frustrate the user who was expecting a more direct response.
36
+
37
+ 3. User: "I'm not convinced if those responses are really problematic"
38
+ Assistant: "I'm not convinced if those responses in the "Specific examples of problematic responses" section are really problematic. Could you provide more context or clarification on why you consider them to be problematic examples?"
39
+ Problem: The assistant is repeating the user's statement and asking for clarification instead of engaging with the user's perspective. This response fails to maintain the assistant's identity and doesn't add value to the conversation.
40
+
41
+ If your response meets the criteria for a clear, helpful, and non-repetitive answer, continue the conversation as usual. If you believe that escalating to a more advanced model would significantly improve assistance or if the response is too similar to previous interactions, please indicate that using the \`shouldEscalate\` parameter and provide a \`reason\`.`;
42
+ export async function performSelfReflection(askQuestionCall, context, prompt, functionDefs, options, generateContentFn) {
43
+ if (!options.selfReflectionEnabled) {
44
+ return {
45
+ shouldEscalate: false,
46
+ reason: 'Self-reflection is disabled by user configuration.',
47
+ };
48
+ }
49
+ const currentTime = Date.now();
50
+ const { shouldEscalate, reason } = await runSelfReflect(askQuestionCall, prompt, functionDefs, options, generateContentFn);
51
+ if (shouldEscalate) {
52
+ context.escalationCount++;
53
+ context.lastEscalationTime = currentTime;
54
+ }
55
+ return {
56
+ shouldEscalate,
57
+ reason,
58
+ };
59
+ }
60
+ async function runSelfReflect(askQuestionCall, prompt, functionDefs, options, generateContentFn) {
61
+ const currentResponse = askQuestionCall.args?.content ?? '';
62
+ const reflectRequest = [
63
+ [
64
+ ...prompt,
65
+ { type: 'assistant', text: currentResponse, functionCalls: [askQuestionCall] },
66
+ {
67
+ type: 'user',
68
+ text: SELF_REFLECT_PROMPT,
69
+ functionResponses: [{ name: 'askQuestion', call_id: askQuestionCall.id ?? '', content: undefined }],
70
+ },
71
+ ],
72
+ functionDefs,
73
+ 'askQuestionReflect',
74
+ 0.2,
75
+ true,
76
+ options,
77
+ ];
78
+ let result = await generateContentFn(...reflectRequest);
79
+ result = await validateAndRecoverSingleResult(reflectRequest, result, generateContentFn);
80
+ const reflectionResult = result.find((call) => call.name === 'askQuestionReflect')?.args;
81
+ const shouldEscalate = (reflectionResult?.shouldEscalate ?? 0) > 50;
82
+ const reason = reflectionResult?.reason || '';
83
+ return {
84
+ shouldEscalate,
85
+ reason: reason ||
86
+ (shouldEscalate
87
+ ? 'Response requires escalation to a more advanced model'
88
+ : 'Response does not require escalation'),
89
+ };
90
+ }
91
+ //# sourceMappingURL=step-ask-question-reflect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-ask-question-reflect.js","sourceRoot":"","sources":["../../../../src/prompt/steps/step-ask-question/step-ask-question-reflect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAG7E,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0WAuC8U,CAAC;AAE3W,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,eAAgC,EAChC,OAA8B,EAC9B,MAAoB,EACpB,YAA2B,EAC3B,OAAuB,EACvB,iBAA0C;IAE1C,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;QACnC,OAAO;YACL,cAAc,EAAE,KAAK;YACrB,MAAM,EAAE,oDAAoD;SAC7D,CAAC;IACJ,CAAC;IA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AI,CAAC;IACzF,MAAM,cAAc,GAAG,CAAE,gBAAgB,EAAE,cAAqC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;IAC5F,MAAM,MAAM,GAAI,gBAAgB,EAAE,MAAiB,IAAI,EAAE,CAAC;IAE1D,OAAO;QACL,cAAc;QACd,MAAM,EACJ,MAAM;YACN,CAAC,cAAc;gBACb,CAAC,CAAC,uDAAuD;gBACzD,CAAC,CAAC,sCAAsC,CAAC;KAC9C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { FunctionCall, GenerateContentFunction, PromptItem } from '../../../ai-service/common.js';
2
+ import { CodegenOptions } from '../../../main/codegen-types.js';
3
+ import { StepResult } from '../steps-types.js';
4
+ import { PluginActionType } from '../../../main/codegen-types.js';
5
+ export type ActionType = 'requestAnswer' | 'requestPermissions' | 'requestFilesContent' | 'removeFilesFromContext' | 'confirmCodeGeneration' | 'startCodeGeneration' | 'cancelCodeGeneration' | 'contextOptimization' | PluginActionType;
6
+ type AskQuestionArgs = {
7
+ actionType: ActionType;
8
+ content: string;
9
+ requestFilesContent?: string[];
10
+ requestPermissions?: Record<'allowDirectoryCreate' | 'allowFileCreate' | 'allowFileDelete' | 'allowFileMove' | 'enableVision' | 'enableImagen', boolean>;
11
+ removeFilesFromContext?: string[];
12
+ };
13
+ export type AskQuestionCall = FunctionCall<AskQuestionArgs>;
14
+ export interface AssistantItem {
15
+ type: 'assistant';
16
+ text: string;
17
+ functionCalls: FunctionCall[];
18
+ cache?: true;
19
+ }
20
+ export interface UserItem {
21
+ type: 'user';
22
+ text: string;
23
+ functionResponses?: Array<{
24
+ name: string;
25
+ call_id: string;
26
+ content: string | undefined;
27
+ }>;
28
+ cache?: true;
29
+ }
30
+ export interface ActionResult {
31
+ breakLoop: boolean;
32
+ stepResult: StepResult;
33
+ items: Array<{
34
+ assistant: AssistantItem;
35
+ user: UserItem;
36
+ }>;
37
+ }
38
+ export type ActionHandlerProps = {
39
+ askQuestionCall: AskQuestionCall;
40
+ prompt: PromptItem[];
41
+ options: CodegenOptions;
42
+ generateContentFn: GenerateContentFunction;
43
+ messages: {
44
+ contextSourceCode: (paths: string[], pathsOnly: boolean) => string;
45
+ };
46
+ };
47
+ export type ActionHandler = (props: ActionHandlerProps) => Promise<ActionResult>;
48
+ export interface EscalationDecision {
49
+ shouldEscalate: boolean;
50
+ reason: string;
51
+ }
52
+ export interface SelfReflectionContext {
53
+ escalationCount: number;
54
+ lastEscalationTime: number;
55
+ }
56
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=step-ask-question-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-ask-question-types.js","sourceRoot":"","sources":["../../../../src/prompt/steps/step-ask-question/step-ask-question-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { FunctionDef, GenerateContentFunction, PromptItem } from '../../../ai-service/common.js';
2
+ import { StepResult } from '../steps-types.js';
3
+ import { CodegenOptions } from '../../../main/codegen-types.js';
4
+ export declare function executeStepAskQuestion(generateContentFn: GenerateContentFunction, prompt: PromptItem[], functionDefs: FunctionDef[], temperature: number, messages: {
5
+ contextSourceCode: (paths: string[], pathsOnly: boolean) => string;
6
+ }, options: CodegenOptions): Promise<StepResult>;
@@ -0,0 +1,95 @@
1
+ import { StepResult } from '../steps-types.js';
2
+ import { putAssistantMessage, putSystemMessage, putUserMessage } from '../../../main/common/content-bus.js';
3
+ import { abortController } from '../../../main/interactive/codegen-worker.js';
4
+ import { validateAndRecoverSingleResult } from '../step-validate-recover.js';
5
+ import { handleRequestFilesContent } from './handlers/request-files-content.js';
6
+ import { handleContextOptimization } from './handlers/context-optimization.js';
7
+ import { handleRemoveFilesFromContext } from './handlers/remove-files-from-context.js';
8
+ import { handleRequestPermissions } from './handlers/request-permissions.js';
9
+ import { handleDefaultAction } from './handlers/default-action.js';
10
+ import { handleRequestAnswer } from './handlers/handle-request-answer.js';
11
+ import { handleStartCodeGeneration } from './handlers/start-code-generation.js';
12
+ import { handleConfirmCodeGeneration } from './handlers/confirm-code-generation.js';
13
+ import { handleCancelCodeGeneration } from './handlers/cancel-code-generation.js';
14
+ import { getRegisteredActionHandlers } from '../../../main/plugin-loader.js';
15
+ import { performSelfReflection } from './step-ask-question-reflect.js';
16
+ export async function executeStepAskQuestion(generateContentFn, prompt, functionDefs, temperature, messages, options) {
17
+ console.log('Allowing the assistant to ask a question...');
18
+ const selfReflectionContext = {
19
+ escalationCount: 0,
20
+ lastEscalationTime: 0,
21
+ };
22
+ while (!abortController?.signal.aborted) {
23
+ try {
24
+ const askQuestionCall = await getAskQuestionCall(generateContentFn, prompt, functionDefs, temperature, options, selfReflectionContext);
25
+ if (!askQuestionCall) {
26
+ break;
27
+ }
28
+ console.log('Assistant asks:', askQuestionCall.args);
29
+ if (askQuestionCall.args?.content) {
30
+ putAssistantMessage(askQuestionCall.args.content, askQuestionCall.args);
31
+ }
32
+ const actionType = askQuestionCall.args?.actionType;
33
+ if (actionType) {
34
+ const actionHandler = getActionHandler(actionType);
35
+ const result = await actionHandler({ askQuestionCall, prompt, options, messages, generateContentFn });
36
+ // This is important to display the content to the user interface (ui or interactive cli)
37
+ putUserMessage(result.items.slice(-1)[0].user.text);
38
+ if (result.breakLoop) {
39
+ return result.stepResult;
40
+ }
41
+ prompt.push(...result.items.map(({ assistant, user }) => [assistant, user]).flat());
42
+ console.log('The question was answered');
43
+ }
44
+ else {
45
+ console.error('Invalid action type received');
46
+ break;
47
+ }
48
+ }
49
+ catch (error) {
50
+ console.error('Error in executeStepAskQuestion:', error);
51
+ putSystemMessage(`An error occurred: ${error instanceof Error ? error.message : String(error)}`);
52
+ return StepResult.BREAK;
53
+ }
54
+ }
55
+ putSystemMessage('Assistant did not ask a question. This unexpected, we need to abort.');
56
+ return StepResult.BREAK;
57
+ }
58
+ async function getAskQuestionCall(generateContentFn, prompt, functionDefs, temperature, options, selfReflectionContext) {
59
+ const askQuestionRequest = [prompt, functionDefs, 'askQuestion', temperature, true, options];
60
+ let askQuestionResult = await generateContentFn(...askQuestionRequest);
61
+ askQuestionResult = await validateAndRecoverSingleResult(askQuestionRequest, askQuestionResult, generateContentFn);
62
+ const cheapModelResponse = askQuestionResult.find((call) => call.name === 'askQuestion');
63
+ if (cheapModelResponse) {
64
+ const escalationDecision = await performSelfReflection(cheapModelResponse, selfReflectionContext, prompt, functionDefs, options, generateContentFn);
65
+ if (escalationDecision.shouldEscalate) {
66
+ console.log('Self-reflection suggests escalating to non-cheap model.');
67
+ // Re-run with non-cheap model
68
+ const nonCheapRequest = [prompt, functionDefs, 'askQuestion', temperature, false, options];
69
+ let nonCheapResult = await generateContentFn(...nonCheapRequest);
70
+ nonCheapResult = await validateAndRecoverSingleResult(nonCheapRequest, nonCheapResult, generateContentFn);
71
+ return nonCheapResult.find((call) => call.name === 'askQuestion');
72
+ }
73
+ }
74
+ return cheapModelResponse;
75
+ }
76
+ function getActionHandler(actionType) {
77
+ // First, check if there's a plugin-provided handler for this action type
78
+ const pluginHandler = getRegisteredActionHandlers().get(actionType);
79
+ if (pluginHandler) {
80
+ return pluginHandler;
81
+ }
82
+ // If no plugin handler is found, use the built-in handlers
83
+ const handlers = {
84
+ cancelCodeGeneration: handleCancelCodeGeneration,
85
+ confirmCodeGeneration: handleConfirmCodeGeneration,
86
+ startCodeGeneration: handleStartCodeGeneration,
87
+ requestFilesContent: handleRequestFilesContent,
88
+ requestPermissions: handleRequestPermissions,
89
+ removeFilesFromContext: handleRemoveFilesFromContext,
90
+ requestAnswer: handleRequestAnswer,
91
+ contextOptimization: handleContextOptimization,
92
+ };
93
+ return handlers[actionType] || handleDefaultAction;
94
+ }
95
+ //# sourceMappingURL=step-ask-question.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-ask-question.js","sourceRoot":"","sources":["../../../../src/prompt/steps/step-ask-question/step-ask-question.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAA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AAiB,CAAC,GAAG,eAAe,CAAC,CAAC;YACjE,cAAc,GAAG,MAAM,8BAA8B,CAAC,eAAe,EAAE,cAAc,EAAE,iBAAiB,CAAC,CAAC;YAC1G,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,aAAa,CAAgC,CAAC;QACnG,CAAC;IACH,CAAC;IAED,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,SAAS,gBAAgB,CAAC,UAAsB;IAC9C,yEAAyE;IACzE,MAAM,aAAa,GAAG,2BAA2B,EAAE,CAAC,GAAG,CAAC,UAAgC,CAAC,CAAC;IAC1F,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,2DAA2D;IAC3D,MAAM,QAAQ,GAAsC;QAClD,oBAAoB,EAAE,0BAA0B;QAChD,qBAAqB,EAAE,2BAA2B;QAClD,mBAAmB,EAAE,yBAAyB;QAC9C,mBAAmB,EAAE,yBAAyB;QAC9C,kBAAkB,EAAE,wBAAwB;QAC5C,sBAAsB,EAAE,4BAA4B;QACpD,aAAa,EAAE,mBAAmB;QAClC,mBAAmB,EAAE,yBAAyB;KAC/C,CAAC;IAEF,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,mBAAmB,CAAC;AACrD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { putSystemMessage } from '../../main/common/content-bus.js';
2
2
  import { getSourceCode } from '../../files/read-files.js';
3
- import { functionDefs } from '../function-calling.js';
3
+ import { getFunctionDefs } from '../function-calling.js';
4
4
  import { StepResult } from './steps-types.js';
5
5
  import { estimateTokenCount } from '../token-estimator.js';
6
6
  import { getSummary } from './step-summarization.js';
@@ -113,7 +113,14 @@ export async function executeStepContextOptimization(generateContentFn, prompt,
113
113
  ],
114
114
  },
115
115
  ];
116
- const request = [optimizationPrompt, functionDefs, 'optimizeContext', 0.2, true, options];
116
+ const request = [
117
+ optimizationPrompt,
118
+ getFunctionDefs(),
119
+ 'optimizeContext',
120
+ 0.2,
121
+ true,
122
+ options,
123
+ ];
117
124
  let result = await generateContentFn(...request);
118
125
  result = await validateAndRecoverSingleResult(request, result, generateContentFn);
119
126
  const batchOptimized = parseOptimizationResult(result);
@@ -1 +1 @@
1
- {"version":3,"file":"step-context-optimization.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-context-optimization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAiB,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkE3B,CAAC;AAEF,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,iBAA0C,EAC1C,MAAoB,EACpB,OAAuB;IAEvB,MAAM,cAAc,GAAG,aAAa,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IAClE,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACzD,IAAI,CAAC,kBAAkB,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,oFAAoF,CAAC,CA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mB,CAAC,IAAI,CAAC,GAAG,OAAO;gBACjC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE;gBAChB,CAAC,CAAC;oBACE,OAAO,EAAE,IAAI;iBACd,CAAC;QACR,CAAC;IACH,CAAC;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC"}
1
+ {"version":3,"file":"step-context-optimization.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-context-optimization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAiB,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkE3B,CAAC;AAEF,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,iBAA0C,EAC1C,MAAoB,EACpB,OAAuB;IAEvB,MAAM,cAAc,GAAG,aAAa,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IAClE,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACzD,IAAI,CAAC,kBAAkB,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,oF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;aAAM,CAAC;YACN,mBAAmB,CAAC,IAAI,CAAC,GAAG,OAAO;gBACjC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE;gBAChB,CAAC,CAAC;oBACE,OAAO,EAAE,IAAI;iBACd,CAAC;QACR,CAAC;IACH,CAAC;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { putSystemMessage } from '../../main/common/content-bus.js';
2
- import { functionDefs } from '../function-calling.js';
2
+ import { getFunctionDefs } from '../function-calling.js';
3
3
  import { ChatMessageFlags } from '../../main/common/content-bus-types.js';
4
4
  export async function executeStepGenerateSummary(generateContentFn, prompt, options) {
5
5
  if (!options.conversationSummaryEnabled) {
@@ -15,7 +15,7 @@ export async function executeStepGenerateSummary(generateContentFn, prompt, opti
15
15
  text: `Now please summarize our conversation, I want maximum 1 sentence of maximum 10 words explaning the conversation.`,
16
16
  },
17
17
  ],
18
- functionDefs,
18
+ getFunctionDefs(),
19
19
  'explanation',
20
20
  0.3, // Use a lower temperature for more focused summaries
21
21
  true, // Use cheap model by default for summaries
@@ -1 +1 @@
1
- {"version":3,"file":"step-generate-summary.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-generate-summary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,iBAA0C,EAC1C,MAAoB,EACpB,OAAuB;IAEvB,IAAI,CAAC,OAAO,CAAC,0BAA0B,EAAE,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,uEAAuE,CAAC,CAAC;QACrF,OAAO;IACT,CAAC;IAED,MAAM,cAAc,GAAwB;QAC1C;YACE,GAAG,MAAM;YACT,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,oCAAoC,EAAE;YACjE;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,kHAAkH;aACzH;SACF;QACD,YAAY;QACZ,aAAa;QACb,GAAG,EAAE,qDAAqD;QAC1D,IAAI,EAAE,2CAA2C;QACjD,OAAO;KACR,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,MAAM,iBAAiB,CAAC,GAAG,cAAc,CAAC,CAAC;QACjE,MAAM,kBAAkB,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC;QAErF,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,IAAI,IAAI,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtG,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC;YACzD,gBAAgB,CAAC,gCAAgC,EAAE,mBAAmB,EAAE,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,CAAC;QACnH,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;QAC/D,gBAAgB,CAAC,0CAA0C,CAAC,CAAC;QAC7D,OAAO;IACT,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"step-generate-summary.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-generate-summary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,iB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ache } from '../../files/cache-file.js';
2
2
  import { putSystemMessage } from '../../main/common/content-bus.js';
3
- import { functionDefs } from '../function-calling.js';
3
+ import { getFunctionDefs } from '../function-calling.js';
4
4
  import { StepResult } from './steps-types.js';
5
5
  import { validateAndRecoverSingleResult } from './step-validate-recover.js';
6
6
  export async function executeStepHistoryUpdate(generateContentFn, prompt, options) {
@@ -38,7 +38,7 @@ ${currentHistory}
38
38
  `,
39
39
  },
40
40
  ];
41
- const request = [optimizationPrompt, functionDefs, 'updateHistory', 1, true, options];
41
+ const request = [optimizationPrompt, getFunctionDefs(), 'updateHistory', 1, true, options];
42
42
  let result = await generateContentFn(...request);
43
43
  result = await validateAndRecoverSingleResult(request, result, generateContentFn);
44
44
  const { newHistoryContent, recentConversationSummary } = result.find((call) => call.name === 'updateHistory')?.args ?? {};
@@ -1 +1 @@
1
- {"version":3,"file":"step-history-update.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-history-update.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAE5E,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,iBAA0C,EAC1C,MAAoB,EACpB,OAAuB;IAEvB,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAE3C,MAAM,kBAAkB,GAAiB;QACvC,GAAG,MAAM;QACT;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,qEAAqE;SAC5E;QACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE;;wBAEY,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;;;;;;;;;;;;;;;;;;EAkB9C,cA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MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAE3C,MAAM,kBAAkB,GAAiB;QACvC,GAAG,MAAM;QACT;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,qEAAqE;SAC5E;QACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE;;wBAEY,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;;;;;;;;;;;;;;;;;;EAkB9C,cAAc;;CAEf;SACI;KACF,CAAC;IAEF,MAAM,OAAO,GAAwB,CAAC,kBAAkB,EAAE,eAAe,EAAE,EAAE,eAAe,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAChH,IAAI,MAAM,GAAG,MAAM,iBAAiB,CAAC,GAAG,OAAO,CAAC,CAAC;IACjD,MAAM,GAAG,MAAM,8BAA8B,CAAC,OAAO,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAClF,MAAM,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,GACpD,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC;IACnE,IAAI,iBAAiB,EAAE,CAAC;QACtB,gBAAgB,CAAC,iBAAiB,EAAE,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,CAAC,CAAC;QACtF,UAAU,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,UAAU,CAAC,QAAQ,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,SAAS,CAAC,SAAS,EAAE,0DAA0D,CAAC,CAAC;AAC1F,CAAC"}
@@ -1,4 +1,4 @@
1
- import { functionDefs } from '../function-calling.js';
1
+ import { getFunctionDefs } from '../function-calling.js';
2
2
  import { md5, readCache, writeCache } from '../../files/cache-file.js';
3
3
  import { putSystemMessage } from '../../main/common/content-bus.js';
4
4
  import { estimateTokenCount } from '../token-estimator.js';
@@ -45,7 +45,7 @@ async function summarizeBatch(generateContentFn, items, options) {
45
45
  functionResponses: [{ name: 'getSourceCode', call_id: 'get_source_code', content: JSON.stringify(batch) }],
46
46
  },
47
47
  ];
48
- const request = [summarizationPrompt, functionDefs, 'setSummaries', 0.2, true, options];
48
+ const request = [summarizationPrompt, getFunctionDefs(), 'setSummaries', 0.2, true, options];
49
49
  let result = await generateContentFn(...request);
50
50
  result = await validateAndRecoverSingleResult(request, result, generateContentFn);
51
51
  const batchSummaries = parseSummarizationResult(result);
@@ -1 +1 @@
1
- {"version":3,"file":"step-summarization.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-summarization.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAE5E,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B,MAAM,oBAAoB,GAAG,iDAAiD,kBAAkB;;;sCAG1D,kBAAkB;;CAEvD,CAAC;AAEF,MAAM,YAAY,GAAiB,SAAS,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAkB,CAAC,CAAC;AAEvG,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,iBAA0C,EAC1C,UAAyB,EACzB,OAAuB;IAEvB,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAA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U,EAAE,kBAAkB,CAAC,OAAO,CAAC;gBACvC,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC;aACvB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,YAAY,CAAC,QAAQ,GAAG,aAAa,CAAC;IAEtC,UAAU,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAEtC,gBAAgB,CAAC,+CAA+C,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,wBAAwB,CAAC,MAAsB;IACtD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACjH,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACvC,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5F,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { FunctionCall, FunctionDef, PromptItem } from './common.js';
2
+ import { CodegenOptions } from '../main/codegen-types.js';
3
+ /**
4
+ * This function generates content using the Anthropic Claude model via Vertex AI.
5
+ */
6
+ export declare function generateContent(prompt: PromptItem[], functionDefs: FunctionDef[], requiredFunctionName: string | null, temperature: number, cheap: boolean | undefined, options: CodegenOptions): Promise<FunctionCall[]>;