genaicode 0.14.2 → 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 (253) hide show
  1. package/dist/ai-service/ai-studio.d.ts +2 -18
  2. package/dist/ai-service/ai-studio.js +87 -31
  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/index.d.ts +1 -1
  30. package/dist/index.js +1 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/main/codegen-types.d.ts +2 -2
  33. package/dist/main/common/content-bus-types.d.ts +14 -0
  34. package/dist/main/common/content-bus.d.ts +1 -1
  35. package/dist/main/common/content-bus.js +21 -3
  36. package/dist/main/common/content-bus.js.map +1 -1
  37. package/dist/main/common/user-actions.d.ts +1 -1
  38. package/dist/main/config-types.d.ts +0 -3
  39. package/dist/main/config-types.js.map +1 -1
  40. package/dist/main/config.js +1 -1
  41. package/dist/main/config.js.map +1 -1
  42. package/dist/main/plugin-loader.d.ts +1 -1
  43. package/dist/main/ui/backend/endpoints/config-endpoint.js +1 -1
  44. package/dist/main/ui/backend/endpoints/config-endpoint.js.map +1 -1
  45. package/dist/main/ui/backend/endpoints/edit-message-endpoint.js +9 -6
  46. package/dist/main/ui/backend/endpoints/edit-message-endpoint.js.map +1 -1
  47. package/dist/main/ui/backend/endpoints/interrupt-execution-endpoint.js +1 -1
  48. package/dist/main/ui/backend/endpoints/interrupt-execution-endpoint.js.map +1 -1
  49. package/dist/main/ui/backend/service.d.ts +4 -4
  50. package/dist/main/ui/backend/service.js +49 -27
  51. package/dist/main/ui/backend/service.js.map +1 -1
  52. package/dist/main/ui/common/api-types.d.ts +1 -2
  53. package/dist/main/ui/common/api-types.js.map +1 -1
  54. package/dist/main/ui/frontend/assets/index-DAM_kJhM.js +3445 -0
  55. package/dist/main/ui/frontend/index.html +1 -1
  56. package/dist/prompt/function-calling.js +4 -5
  57. package/dist/prompt/function-calling.js.map +1 -1
  58. package/dist/prompt/function-defs/code-execution.d.ts +7 -0
  59. package/dist/prompt/function-defs/code-execution.js +27 -0
  60. package/dist/prompt/function-defs/code-execution.js.map +1 -0
  61. package/dist/prompt/function-defs/conversation-graph.d.ts +1 -1
  62. package/dist/prompt/function-defs/conversation-graph.js +1 -1
  63. package/dist/prompt/function-defs/conversation-graph.js.map +1 -1
  64. package/dist/prompt/function-defs/iterate.d.ts +20 -0
  65. package/dist/prompt/function-defs/iterate.js +373 -0
  66. package/dist/prompt/function-defs/iterate.js.map +1 -0
  67. package/dist/prompt/prompt-service.js +6 -6
  68. package/dist/prompt/prompt-service.js.map +1 -1
  69. package/dist/prompt/steps/step-codegen-planning.js +6 -2
  70. package/dist/prompt/steps/step-codegen-planning.js.map +1 -1
  71. package/dist/prompt/steps/step-iterate/handlers/container-task/command-execution-loop.d.ts +7 -0
  72. package/dist/prompt/steps/step-iterate/handlers/container-task/command-execution-loop.js +301 -0
  73. package/dist/prompt/steps/step-iterate/handlers/container-task/command-execution-loop.js.map +1 -0
  74. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/complete-task.d.ts +4 -0
  75. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/complete-task.js +49 -0
  76. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/complete-task.js.map +1 -0
  77. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-from-container.d.ts +4 -0
  78. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-from-container.js +190 -0
  79. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-from-container.js.map +1 -0
  80. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-to-container.d.ts +4 -0
  81. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-to-container.js +139 -0
  82. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/copy-to-container.js.map +1 -0
  83. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/edit-file.d.ts +10 -0
  84. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/edit-file.js +93 -0
  85. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/edit-file.js.map +1 -0
  86. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/fail-task.d.ts +4 -0
  87. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/fail-task.js +72 -0
  88. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/fail-task.js.map +1 -0
  89. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/gain-knowledge.d.ts +10 -0
  90. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/gain-knowledge.js +125 -0
  91. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/gain-knowledge.js.map +1 -0
  92. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/interrupt-controller.d.ts +19 -0
  93. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/interrupt-controller.js +33 -0
  94. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/interrupt-controller.js.map +1 -0
  95. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/query-knowledge.d.ts +8 -0
  96. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/query-knowledge.js +85 -0
  97. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/query-knowledge.js.map +1 -0
  98. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/request-secret.d.ts +6 -0
  99. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/request-secret.js +122 -0
  100. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/request-secret.js.map +1 -0
  101. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/run-command.d.ts +7 -0
  102. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/run-command.js +146 -0
  103. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/run-command.js.map +1 -0
  104. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/send-message.d.ts +4 -0
  105. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/send-message.js +56 -0
  106. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/send-message.js.map +1 -0
  107. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/set-execution-plan.d.ts +4 -0
  108. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/set-execution-plan.js +56 -0
  109. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/set-execution-plan.js.map +1 -0
  110. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/update-execution-plan.d.ts +4 -0
  111. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/update-execution-plan.js +39 -0
  112. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/update-execution-plan.js.map +1 -0
  113. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/view-file.d.ts +10 -0
  114. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/view-file.js +95 -0
  115. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/view-file.js.map +1 -0
  116. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/web-search.d.ts +2 -0
  117. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/web-search.js +96 -0
  118. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/web-search.js.map +1 -0
  119. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/wrap-context.d.ts +4 -0
  120. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/wrap-context.js +123 -0
  121. package/dist/prompt/steps/step-iterate/handlers/container-task/commands/wrap-context.js.map +1 -0
  122. package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-registry.d.ts +11 -0
  123. package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-registry.js +50 -0
  124. package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-registry.js.map +1 -0
  125. package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-types.d.ts +28 -0
  126. package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-types.js +2 -0
  127. package/dist/prompt/steps/step-iterate/handlers/container-task/container-commands-types.js.map +1 -0
  128. package/dist/prompt/steps/step-iterate/handlers/container-task/container-task-orchestrator.d.ts +2 -0
  129. package/dist/prompt/steps/step-iterate/handlers/container-task/container-task-orchestrator.js +202 -0
  130. package/dist/prompt/steps/step-iterate/handlers/container-task/container-task-orchestrator.js.map +1 -0
  131. package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-check.d.ts +4 -0
  132. package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-check.js +15 -0
  133. package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-check.js.map +1 -0
  134. package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-utils.d.ts +50 -0
  135. package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-utils.js +358 -0
  136. package/dist/prompt/steps/step-iterate/handlers/container-task/utils/docker-utils.js.map +1 -0
  137. package/dist/prompt/steps/step-iterate/handlers/file-request-utils.d.ts +47 -0
  138. package/dist/prompt/steps/step-iterate/handlers/file-request-utils.js +114 -0
  139. package/dist/prompt/steps/step-iterate/handlers/file-request-utils.js.map +1 -0
  140. package/dist/prompt/steps/step-iterate/handlers/handle-code-execution.d.ts +1 -0
  141. package/dist/prompt/steps/step-iterate/handlers/handle-code-execution.js +133 -0
  142. package/dist/prompt/steps/step-iterate/handlers/handle-code-execution.js.map +1 -0
  143. package/dist/prompt/steps/step-iterate/handlers/handle-code-generation.d.ts +4 -0
  144. package/dist/prompt/steps/step-iterate/handlers/handle-code-generation.js +177 -0
  145. package/dist/prompt/steps/step-iterate/handlers/handle-code-generation.js.map +1 -0
  146. package/dist/prompt/steps/step-iterate/handlers/handle-compound-action.d.ts +20 -0
  147. package/dist/prompt/steps/step-iterate/handlers/handle-compound-action.js +305 -0
  148. package/dist/prompt/steps/step-iterate/handlers/handle-compound-action.js.map +1 -0
  149. package/dist/prompt/steps/step-iterate/handlers/handle-confirm-code-generation.d.ts +2 -0
  150. package/dist/prompt/steps/step-iterate/handlers/handle-confirm-code-generation.js +40 -0
  151. package/dist/prompt/steps/step-iterate/handlers/handle-confirm-code-generation.js.map +1 -0
  152. package/dist/prompt/steps/step-iterate/handlers/handle-context-compression.d.ts +2 -0
  153. package/dist/prompt/steps/step-iterate/handlers/handle-context-compression.js +35 -0
  154. package/dist/prompt/steps/step-iterate/handlers/handle-context-compression.js.map +1 -0
  155. package/dist/prompt/steps/step-iterate/handlers/handle-context-optimization.d.ts +2 -0
  156. package/dist/prompt/steps/step-iterate/handlers/handle-context-optimization.js +34 -0
  157. package/dist/prompt/steps/step-iterate/handlers/handle-context-optimization.js.map +1 -0
  158. package/dist/prompt/steps/step-iterate/handlers/handle-conversation-graph.d.ts +11 -0
  159. package/dist/prompt/steps/step-iterate/handlers/handle-conversation-graph.js +503 -0
  160. package/dist/prompt/steps/step-iterate/handlers/handle-conversation-graph.js.map +1 -0
  161. package/dist/prompt/steps/step-iterate/handlers/handle-create-file.d.ts +2 -0
  162. package/dist/prompt/steps/step-iterate/handlers/handle-create-file.js +159 -0
  163. package/dist/prompt/steps/step-iterate/handlers/handle-create-file.js.map +1 -0
  164. package/dist/prompt/steps/step-iterate/handlers/handle-end-conversation.d.ts +2 -0
  165. package/dist/prompt/steps/step-iterate/handlers/handle-end-conversation.js +30 -0
  166. package/dist/prompt/steps/step-iterate/handlers/handle-end-conversation.js.map +1 -0
  167. package/dist/prompt/steps/step-iterate/handlers/handle-explore-external-directories.d.ts +2 -0
  168. package/dist/prompt/steps/step-iterate/handlers/handle-explore-external-directories.js +280 -0
  169. package/dist/prompt/steps/step-iterate/handlers/handle-explore-external-directories.js.map +1 -0
  170. package/dist/prompt/steps/step-iterate/handlers/handle-genaicode-help.d.ts +8 -0
  171. package/dist/prompt/steps/step-iterate/handlers/handle-genaicode-help.js +105 -0
  172. package/dist/prompt/steps/step-iterate/handlers/handle-genaicode-help.js.map +1 -0
  173. package/dist/prompt/steps/step-iterate/handlers/handle-generate-image.d.ts +2 -0
  174. package/dist/prompt/steps/step-iterate/handlers/handle-generate-image.js +110 -0
  175. package/dist/prompt/steps/step-iterate/handlers/handle-generate-image.js.map +1 -0
  176. package/dist/prompt/steps/step-iterate/handlers/handle-perform-analysis.d.ts +6 -0
  177. package/dist/prompt/steps/step-iterate/handlers/handle-perform-analysis.js +110 -0
  178. package/dist/prompt/steps/step-iterate/handlers/handle-perform-analysis.js.map +1 -0
  179. package/dist/prompt/steps/step-iterate/handlers/handle-project-command.d.ts +2 -0
  180. package/dist/prompt/steps/step-iterate/handlers/handle-project-command.js +280 -0
  181. package/dist/prompt/steps/step-iterate/handlers/handle-project-command.js.map +1 -0
  182. package/dist/prompt/steps/step-iterate/handlers/handle-pull-app-context.d.ts +9 -0
  183. package/dist/prompt/steps/step-iterate/handlers/handle-pull-app-context.js +94 -0
  184. package/dist/prompt/steps/step-iterate/handlers/handle-pull-app-context.js.map +1 -0
  185. package/dist/prompt/steps/step-iterate/handlers/handle-pull-console-logs.d.ts +2 -0
  186. package/dist/prompt/steps/step-iterate/handlers/handle-pull-console-logs.js +174 -0
  187. package/dist/prompt/steps/step-iterate/handlers/handle-pull-console-logs.js.map +1 -0
  188. package/dist/prompt/steps/step-iterate/handlers/handle-push-app-context.d.ts +9 -0
  189. package/dist/prompt/steps/step-iterate/handlers/handle-push-app-context.js +104 -0
  190. package/dist/prompt/steps/step-iterate/handlers/handle-push-app-context.js.map +1 -0
  191. package/dist/prompt/steps/step-iterate/handlers/handle-read-external-files.d.ts +2 -0
  192. package/dist/prompt/steps/step-iterate/handlers/handle-read-external-files.js +149 -0
  193. package/dist/prompt/steps/step-iterate/handlers/handle-read-external-files.js.map +1 -0
  194. package/dist/prompt/steps/step-iterate/handlers/handle-reasoning-inference.d.ts +7 -0
  195. package/dist/prompt/steps/step-iterate/handlers/handle-reasoning-inference.js +119 -0
  196. package/dist/prompt/steps/step-iterate/handlers/handle-reasoning-inference.js.map +1 -0
  197. package/dist/prompt/steps/step-iterate/handlers/handle-remove-files-from-context.d.ts +2 -0
  198. package/dist/prompt/steps/step-iterate/handlers/handle-remove-files-from-context.js +100 -0
  199. package/dist/prompt/steps/step-iterate/handlers/handle-remove-files-from-context.js.map +1 -0
  200. package/dist/prompt/steps/step-iterate/handlers/handle-request-files-content.d.ts +8 -0
  201. package/dist/prompt/steps/step-iterate/handlers/handle-request-files-content.js +146 -0
  202. package/dist/prompt/steps/step-iterate/handlers/handle-request-files-content.js.map +1 -0
  203. package/dist/prompt/steps/step-iterate/handlers/handle-request-files-fragments.d.ts +8 -0
  204. package/dist/prompt/steps/step-iterate/handlers/handle-request-files-fragments.js +197 -0
  205. package/dist/prompt/steps/step-iterate/handlers/handle-request-files-fragments.js.map +1 -0
  206. package/dist/prompt/steps/step-iterate/handlers/handle-request-git-context.d.ts +3 -0
  207. package/dist/prompt/steps/step-iterate/handlers/handle-request-git-context.js +251 -0
  208. package/dist/prompt/steps/step-iterate/handlers/handle-request-git-context.js.map +1 -0
  209. package/dist/prompt/steps/step-iterate/handlers/handle-request-permissions.d.ts +2 -0
  210. package/dist/prompt/steps/step-iterate/handlers/handle-request-permissions.js +83 -0
  211. package/dist/prompt/steps/step-iterate/handlers/handle-request-permissions.js.map +1 -0
  212. package/dist/prompt/steps/step-iterate/handlers/handle-run-bash-command.d.ts +2 -0
  213. package/dist/prompt/steps/step-iterate/handlers/handle-run-bash-command.js +185 -0
  214. package/dist/prompt/steps/step-iterate/handlers/handle-run-bash-command.js.map +1 -0
  215. package/dist/prompt/steps/step-iterate/handlers/handle-run-container-task.d.ts +2 -0
  216. package/dist/prompt/steps/step-iterate/handlers/handle-run-container-task.js +7 -0
  217. package/dist/prompt/steps/step-iterate/handlers/handle-run-container-task.js.map +1 -0
  218. package/dist/prompt/steps/step-iterate/handlers/handle-search-code.d.ts +2 -0
  219. package/dist/prompt/steps/step-iterate/handlers/handle-search-code.js +96 -0
  220. package/dist/prompt/steps/step-iterate/handlers/handle-search-code.js.map +1 -0
  221. package/dist/prompt/steps/step-iterate/handlers/handle-send-message.d.ts +2 -0
  222. package/dist/prompt/steps/step-iterate/handlers/handle-send-message.js +21 -0
  223. package/dist/prompt/steps/step-iterate/handlers/handle-send-message.js.map +1 -0
  224. package/dist/prompt/steps/step-iterate/handlers/handle-structured-question.d.ts +1 -0
  225. package/dist/prompt/steps/step-iterate/handlers/handle-structured-question.js +72 -0
  226. package/dist/prompt/steps/step-iterate/handlers/handle-structured-question.js.map +1 -0
  227. package/dist/prompt/steps/step-iterate/handlers/handle-update-file.d.ts +2 -0
  228. package/dist/prompt/steps/step-iterate/handlers/handle-update-file.js +161 -0
  229. package/dist/prompt/steps/step-iterate/handlers/handle-update-file.js.map +1 -0
  230. package/dist/prompt/steps/step-iterate/handlers/handle-web-search.d.ts +1 -0
  231. package/dist/prompt/steps/step-iterate/handlers/handle-web-search.js +85 -0
  232. package/dist/prompt/steps/step-iterate/handlers/handle-web-search.js.map +1 -0
  233. package/dist/prompt/steps/step-iterate/iterate-handler.d.ts +4 -0
  234. package/dist/prompt/steps/step-iterate/iterate-handler.js +14 -0
  235. package/dist/prompt/steps/step-iterate/iterate-handler.js.map +1 -0
  236. package/dist/prompt/steps/step-iterate/step-iterate-handlers.d.ts +3 -0
  237. package/dist/prompt/steps/step-iterate/step-iterate-handlers.js +5 -0
  238. package/dist/prompt/steps/step-iterate/step-iterate-handlers.js.map +1 -0
  239. package/dist/prompt/steps/step-iterate/step-iterate-types.d.ts +255 -0
  240. package/dist/prompt/steps/step-iterate/step-iterate-types.js +2 -0
  241. package/dist/prompt/steps/step-iterate/step-iterate-types.js.map +1 -0
  242. package/dist/prompt/steps/step-iterate/step-iterate.d.ts +37 -0
  243. package/dist/prompt/steps/step-iterate/step-iterate.js +132 -0
  244. package/dist/prompt/steps/step-iterate/step-iterate.js.map +1 -0
  245. package/dist/prompt/systemprompt.js +6 -6
  246. package/dist/prompt/systemprompt.js.map +1 -1
  247. package/dist/vite-genaicode/console-interceptor.d.ts +19 -6
  248. package/dist/vite-genaicode/console-interceptor.js +45 -13
  249. package/dist/vite-genaicode/console-interceptor.js.map +1 -1
  250. package/dist/vite-genaicode/vite-genaicode-frontend.js +1 -1
  251. package/dist/vite-genaicode/vite-genaicode-frontend.js.map +1 -1
  252. package/package.json +7 -6
  253. package/dist/main/ui/frontend/assets/index-We_MLSaC.js +0 -3405
@@ -0,0 +1,255 @@
1
+ import { GenerateImageFunction } from '../../../ai-service/common-types.js';
2
+ import { GenerateContentFunction } from '../../../ai-service/common-types.js';
3
+ import { PromptItem } from '../../../ai-service/common-types.js';
4
+ import { PromptItemImage } from '../../../ai-service/common-types.js';
5
+ import { FunctionCall } from '../../../ai-service/common-types.js';
6
+ import { CodegenOptions } from '../../../main/codegen-types.js';
7
+ import { PluginActionType } from '../../../ai-service/service-configurations-types.js';
8
+ import { ConsoleLogLevel, ConsoleLogMode } from '../../../vite-genaicode/vite-genaicode-types.js';
9
+ export type ActionType = 'codeGeneration' | 'sendMessage' | 'generateImage' | 'requestPermissions' | 'readExternalFiles' | 'requestFilesContent' | 'removeFilesFromContext' | 'exploreExternalDirectories' | 'confirmCodeGeneration' | 'endConversation' | 'contextOptimization' | 'contextCompression' | 'searchCode' | 'updateFile' | 'performAnalysis' | 'createFile' | 'pullAppContext' | 'pullConsoleLogs' | 'genaicodeHelp' | 'pushAppContext' | 'requestFilesFragments' | 'requestGitContext' | 'conversationGraph' | 'runContainerTask' | 'compoundAction' | 'runProjectCommand' | 'runBashCommand' | 'webSearch' | 'structuredQuestion' | 'codeExecution' | PluginActionType;
10
+ export type IterateArgs = {
11
+ actionType?: ActionType;
12
+ message?: string;
13
+ };
14
+ /**
15
+ * Arguments for sendMessage action
16
+ */
17
+ export type SendMessageArgs = {
18
+ message: string;
19
+ };
20
+ /**
21
+ * Arguments for help action
22
+ */
23
+ export type GenaicodeHelpArgs = {
24
+ reasoning: string;
25
+ message: string;
26
+ };
27
+ /**
28
+ * Arguments for pullAppContext action
29
+ */
30
+ export type PullAppContextArgs = {
31
+ reason: string;
32
+ key: string;
33
+ };
34
+ /**
35
+ * Arguments for pushAppContext action
36
+ */
37
+ export type PushAppContextArgs = {
38
+ reason: string;
39
+ key: string;
40
+ value: string;
41
+ };
42
+ /**
43
+ * Arguments for pullConsoleLogs action
44
+ */
45
+ export type PullConsoleLogsArgs = {
46
+ mode: ConsoleLogMode;
47
+ prompt?: string;
48
+ lines?: number;
49
+ level?: ConsoleLogLevel;
50
+ };
51
+ export type GenerateImageArgs = {
52
+ prompt: string;
53
+ filePath: string;
54
+ contextImagePath?: string;
55
+ width: number;
56
+ height: number;
57
+ cheap: boolean;
58
+ };
59
+ export type RequestPermissionsArgs = Record<'allowDirectoryCreate' | 'allowFileCreate' | 'allowFileDelete' | 'allowFileMove' | 'enableVision' | 'enableImagen', boolean>;
60
+ export type RequestFilesContentArgs = {
61
+ filePaths: string[];
62
+ };
63
+ export type RequestFilesFragmentsArgs = {
64
+ /** Array of file paths to extract fragments from */
65
+ filePaths: string[];
66
+ /** Prompt describing what information should be extracted from the extracted files */
67
+ fragmentPrompt: string;
68
+ };
69
+ export type ReadExternalFilesArgs = {
70
+ externalFilePaths: string[];
71
+ reason: string;
72
+ };
73
+ export type RemoveFilesFromContextArgs = {
74
+ filePaths: string[];
75
+ };
76
+ export type ContextOptimizationArgs = {
77
+ filePaths: string[];
78
+ };
79
+ /**
80
+ * Arguments for the performAnalysis action
81
+ */
82
+ export type PerformAnalysisArgs = {
83
+ /** The type of analysis to perform */
84
+ analysisType: 'code' | 'image' | 'security' | 'performance' | 'architecture' | 'general';
85
+ /** The analysis prompt describing what needs to be analyzed */
86
+ prompt: string;
87
+ };
88
+ /**
89
+ * Results of the analysis operation
90
+ */
91
+ export type AnalysisResultArgs = {
92
+ /** Reasoning behind the analysis results */
93
+ reasoning: string;
94
+ /** User-friendly message summarizing results */
95
+ message: string;
96
+ };
97
+ /**
98
+ * Arguments for the searchCode action
99
+ */
100
+ export type SearchCodeArgs = {
101
+ /** The search query string */
102
+ query: string;
103
+ /** Optional glob patterns to include files */
104
+ includePatterns?: string[];
105
+ /** Optional glob patterns to exclude files */
106
+ excludePatterns?: string[];
107
+ /** Whether to search in file contents (default: true) */
108
+ searchInContent?: boolean;
109
+ /** Whether to search in file names (default: true) */
110
+ searchInFilenames?: boolean;
111
+ /** Case sensitive search (default: false) */
112
+ caseSensitive?: boolean;
113
+ /** Maximum number of results to return */
114
+ maxResults?: number;
115
+ /** Number of context lines to include around content matches */
116
+ contextLines?: number;
117
+ };
118
+ export type RequestGitContextArgs = {
119
+ requestType: 'commits' | 'fileChanges' | 'blame' | 'fileDiff' | 'workingChanges' | 'workingDiff';
120
+ filePath?: string;
121
+ commitHash?: string;
122
+ count?: number;
123
+ includeUntracked?: boolean;
124
+ stagedOnly?: boolean;
125
+ unstagedOnly?: boolean;
126
+ staged?: boolean;
127
+ };
128
+ /**
129
+ * Represents a single action within a compound action batch.
130
+ */
131
+ export interface CompoundActionItem {
132
+ /** The name of the operation to execute (e.g., 'createFile', 'updateFile'). */
133
+ name: string;
134
+ /** The parameters required by the specified actionName. */
135
+ args: Record<string, unknown>;
136
+ }
137
+ /**
138
+ * Arguments for the internal `compoundActionList` function call.
139
+ */
140
+ export type CompoundActionListArgs = {
141
+ /** An array of actions to be executed as part of a compound operation. */
142
+ actions: CompoundActionItem[];
143
+ /** Summary of the actions to be performed. */
144
+ summary?: string;
145
+ };
146
+ export type RunProjectCommandArgs = {
147
+ name: string;
148
+ args?: string[];
149
+ env?: Record<string, string>;
150
+ workingDirOverride?: string;
151
+ truncMode?: 'first' | 'last' | 'summarize' | 'full';
152
+ };
153
+ export type RunBashCommandArgs = {
154
+ command: string;
155
+ env?: Record<string, string>;
156
+ workingDirOverride?: string;
157
+ truncMode?: 'first' | 'last' | 'summarize' | 'full';
158
+ };
159
+ export type ProjectCommandResult = {
160
+ success: boolean;
161
+ exitCode: number;
162
+ stdout: string;
163
+ stderr: string;
164
+ };
165
+ export type CodeExecutionArgs = {
166
+ message: string;
167
+ };
168
+ export type IterateCall = FunctionCall<IterateArgs>;
169
+ export type PerformAnalysisCall = FunctionCall<PerformAnalysisArgs>;
170
+ export type AnalysisResultCall = FunctionCall<AnalysisResultArgs>;
171
+ export interface AssistantItem {
172
+ type: 'assistant';
173
+ text: string;
174
+ functionCalls?: FunctionCall[];
175
+ executableCode?: {
176
+ language: string;
177
+ code: string;
178
+ };
179
+ codeExecutionResult?: {
180
+ outcome: 'OUTCOME_OK' | 'OUTCOME_FAILED' | 'OUTCOME_DEADLINE_EXCEEDED';
181
+ output: string;
182
+ outputFiles?: Array<{
183
+ fileId: string;
184
+ filename: string;
185
+ size: number;
186
+ mimeType?: string;
187
+ }>;
188
+ };
189
+ images?: PromptItemImage[];
190
+ cache?: true;
191
+ }
192
+ export interface UserItem {
193
+ type: 'user';
194
+ text?: string;
195
+ data?: Record<string, unknown>;
196
+ functionResponses?: Array<{
197
+ name: string;
198
+ call_id: string | undefined;
199
+ content: string | undefined;
200
+ isError?: boolean;
201
+ }>;
202
+ images?: PromptItemImage[];
203
+ cache?: true;
204
+ }
205
+ export interface ActionResult {
206
+ breakLoop: boolean;
207
+ forceActionType?: ActionType;
208
+ stepResult?: FunctionCall[];
209
+ items: Array<{
210
+ assistant: AssistantItem;
211
+ user: UserItem;
212
+ }>;
213
+ }
214
+ export type ActionHandlerProps = {
215
+ iterateCall: IterateCall;
216
+ prompt: PromptItem[];
217
+ options: CodegenOptions;
218
+ generateContentFn: GenerateContentFunction;
219
+ generateImageFn: GenerateImageFunction;
220
+ waitIfPaused: () => Promise<void>;
221
+ };
222
+ export type ActionHandler = (props: ActionHandlerProps) => Promise<ActionResult>;
223
+ export type StructuredQuestionFieldType = 'text' | 'checkbox' | 'radio' | 'select' | 'textarea' | 'number' | 'email';
224
+ export interface StructuredQuestionField {
225
+ id: string;
226
+ label: string;
227
+ type: StructuredQuestionFieldType;
228
+ required?: boolean;
229
+ placeholder?: string;
230
+ options?: {
231
+ value: string;
232
+ label: string;
233
+ }[];
234
+ defaultValue?: string | string[];
235
+ validation?: {
236
+ pattern?: string;
237
+ minLength?: number;
238
+ maxLength?: number;
239
+ };
240
+ }
241
+ export interface StructuredQuestionForm {
242
+ title: string;
243
+ description?: string;
244
+ fields: StructuredQuestionField[];
245
+ submitLabel?: string;
246
+ cancelLabel?: string;
247
+ }
248
+ export type StructuredQuestionArgs = {
249
+ message: string;
250
+ form: StructuredQuestionForm;
251
+ };
252
+ export type StructuredQuestionResponse = {
253
+ submitted: boolean;
254
+ values: Record<string, string | string[] | boolean>;
255
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=step-iterate-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-iterate-types.js","sourceRoot":"","sources":["../../../../src/prompt/steps/step-iterate/step-iterate-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ import { GenerateImageFunction } from '../../../ai-service/common-types.js';
2
+ import { GenerateContentFunction } from '../../../ai-service/common-types.js';
3
+ import { PromptItem } from '../../../ai-service/common-types.js';
4
+ import { FunctionCall } from '../../../ai-service/common-types.js';
5
+ import { FunctionDef } from '../../../ai-service/common-types.js';
6
+ import { CodegenOptions } from '../../../main/codegen-types.js';
7
+ import './handlers/handle-code-generation.js';
8
+ import './handlers/handle-confirm-code-generation.js';
9
+ import './handlers/handle-context-compression.js';
10
+ import './handlers/handle-context-optimization.js';
11
+ import './handlers/handle-conversation-graph.js';
12
+ import './handlers/handle-create-file.js';
13
+ import './handlers/handle-end-conversation.js';
14
+ import './handlers/handle-explore-external-directories.js';
15
+ import './handlers/handle-genaicode-help.js';
16
+ import './handlers/handle-generate-image.js';
17
+ import './handlers/handle-perform-analysis.js';
18
+ import './handlers/handle-project-command.js';
19
+ import './handlers/handle-pull-app-context.js';
20
+ import './handlers/handle-pull-console-logs.js';
21
+ import './handlers/handle-push-app-context.js';
22
+ import './handlers/handle-read-external-files.js';
23
+ import './handlers/handle-remove-files-from-context.js';
24
+ import './handlers/handle-request-files-content.js';
25
+ import './handlers/handle-request-files-fragments.js';
26
+ import './handlers/handle-request-git-context.js';
27
+ import './handlers/handle-request-permissions.js';
28
+ import './handlers/handle-run-bash-command.js';
29
+ import './handlers/handle-run-container-task.js';
30
+ import './handlers/handle-search-code.js';
31
+ import './handlers/handle-send-message.js';
32
+ import './handlers/handle-structured-question.js';
33
+ import './handlers/handle-update-file.js';
34
+ import './handlers/handle-web-search.js';
35
+ import './handlers/handle-compound-action.js';
36
+ import './handlers/handle-code-execution.js';
37
+ export declare function executeStepIterate(generateContentFn: GenerateContentFunction, generateImageFn: GenerateImageFunction, prompt: PromptItem[], functionDefs: FunctionDef[], waitIfPaused: () => Promise<void>, temperature: number, options: CodegenOptions): Promise<FunctionCall[]>;
@@ -0,0 +1,132 @@
1
+ import { ModelType } from '../../../ai-service/common-types.js';
2
+ import { putAssistantMessage, putSystemMessage, putUserMessage } from '../../../main/common/content-bus.js';
3
+ import { abortController } from '../../../main/common/abort-controller.js';
4
+ import { getUsageMetrics } from '../../../main/common/cost-collector.js';
5
+ import { getActionHandler } from './iterate-handler.js';
6
+ import { executeStepAutoContextRefresh, getFilesState } from '../step-auto-context-refresh.js';
7
+ import { getFilesContextSizeFromPrompt } from '../../context-utils.js';
8
+ import './handlers/handle-code-generation.js';
9
+ import './handlers/handle-confirm-code-generation.js';
10
+ import './handlers/handle-context-compression.js';
11
+ import './handlers/handle-context-optimization.js';
12
+ import './handlers/handle-conversation-graph.js';
13
+ import './handlers/handle-create-file.js';
14
+ import './handlers/handle-end-conversation.js';
15
+ import './handlers/handle-explore-external-directories.js';
16
+ import './handlers/handle-genaicode-help.js';
17
+ import './handlers/handle-generate-image.js';
18
+ import './handlers/handle-perform-analysis.js';
19
+ import './handlers/handle-project-command.js';
20
+ import './handlers/handle-pull-app-context.js';
21
+ import './handlers/handle-pull-console-logs.js';
22
+ import './handlers/handle-push-app-context.js';
23
+ import './handlers/handle-read-external-files.js';
24
+ import './handlers/handle-remove-files-from-context.js';
25
+ import './handlers/handle-request-files-content.js';
26
+ import './handlers/handle-request-files-fragments.js';
27
+ import './handlers/handle-request-git-context.js';
28
+ import './handlers/handle-request-permissions.js';
29
+ import './handlers/handle-run-bash-command.js';
30
+ import './handlers/handle-run-container-task.js';
31
+ import './handlers/handle-search-code.js';
32
+ import './handlers/handle-send-message.js';
33
+ import './handlers/handle-structured-question.js';
34
+ import './handlers/handle-update-file.js';
35
+ import './handlers/handle-web-search.js';
36
+ import './handlers/handle-compound-action.js';
37
+ import './handlers/handle-code-execution.js';
38
+ export async function executeStepIterate(generateContentFn, generateImageFn, prompt, functionDefs, waitIfPaused, temperature, options) {
39
+ putSystemMessage('Allowing the assistant to iterate...');
40
+ let filesState = getFilesState();
41
+ let aborted = false;
42
+ abortController?.signal.addEventListener('abort', () => {
43
+ aborted = true;
44
+ });
45
+ let forcedActionType = options.initialActionType;
46
+ while (!aborted) {
47
+ try {
48
+ // Calculate context size using the total tokens per day (this is not a perfect metric, but it's a good approximation)
49
+ const lastTokenCount = getUsageMetrics().total.tpd;
50
+ if (forcedActionType) {
51
+ putSystemMessage(`Forcing action type: ${forcedActionType}`);
52
+ }
53
+ const iterateCall = forcedActionType
54
+ ? {
55
+ name: 'iterate',
56
+ id: 'forced-action',
57
+ args: {
58
+ actionType: forcedActionType,
59
+ message: `I'm going to execute the action: ${forcedActionType}`,
60
+ },
61
+ }
62
+ : await getIterateCall(generateContentFn, prompt, functionDefs, temperature, options);
63
+ const totalTokens = getUsageMetrics().total.tpd - lastTokenCount;
64
+ if (!iterateCall) {
65
+ break;
66
+ }
67
+ if (iterateCall.args?.message && iterateCall.id !== 'forced-action') {
68
+ const filesContextSize = getFilesContextSizeFromPrompt(prompt);
69
+ putAssistantMessage(iterateCall.args.message, {
70
+ ...iterateCall.args,
71
+ contextSize: totalTokens,
72
+ filesContextSize,
73
+ });
74
+ }
75
+ const actionType = iterateCall.args?.actionType;
76
+ if (actionType) {
77
+ const actionHandler = getActionHandler(actionType);
78
+ const result = await actionHandler({
79
+ iterateCall,
80
+ prompt,
81
+ options,
82
+ generateContentFn,
83
+ generateImageFn,
84
+ waitIfPaused,
85
+ });
86
+ forcedActionType = result.forceActionType;
87
+ if (aborted) {
88
+ putSystemMessage('Iteration aborted.');
89
+ break;
90
+ }
91
+ // This is important to display the content to the user interface (ui or interactive cli)
92
+ const lastItem = result.items.slice(-1)[0];
93
+ if (lastItem?.user?.text || lastItem?.user?.images) {
94
+ putUserMessage(lastItem.user.text ?? '', lastItem.user.data, undefined, lastItem.user.images, lastItem.user);
95
+ }
96
+ prompt.push(...result.items.map(({ assistant, user }) => [assistant, user]).flat());
97
+ filesState = await executeStepAutoContextRefresh(filesState, generateContentFn, options, prompt);
98
+ if (result.breakLoop) {
99
+ return result.stepResult ?? [];
100
+ }
101
+ }
102
+ else {
103
+ putSystemMessage('Invalid action type received');
104
+ break;
105
+ }
106
+ }
107
+ catch (error) {
108
+ putSystemMessage(`An error occurred: ${error instanceof Error ? error.message : String(error)}`);
109
+ return [];
110
+ }
111
+ }
112
+ putSystemMessage('Assistant did not iterate. This unexpected, we need to abort.');
113
+ return [];
114
+ }
115
+ async function getIterateCall(generateContentFn, prompt, functionDefs, temperature, options) {
116
+ const iterateRequest = [
117
+ prompt,
118
+ {
119
+ functionDefs,
120
+ requiredFunctionName: 'iterate',
121
+ temperature,
122
+ modelType: ModelType.CHEAP,
123
+ expectedResponseType: { text: false, functionCall: true, media: false },
124
+ },
125
+ options,
126
+ ];
127
+ const iterateResult = (await generateContentFn(...iterateRequest))
128
+ .filter((item) => item.type === 'functionCall')
129
+ .map((item) => item.functionCall);
130
+ return iterateResult.find((call) => call.name === 'iterate');
131
+ }
132
+ //# sourceMappingURL=step-iterate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-iterate.js","sourceRoot":"","sources":["../../../../src/prompt/steps/step-iterate/step-iterate.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAC5G,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAC/F,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,sCAAsC,CAAC;AAC9C,OAAO,8CAA8C,CAAC;AACtD,OAAO,0CAA0C,CAAC;AAClD,OAAO,2CAA2C,CAAC;AACnD,OAAO,yCAAyC,CAAC;AACjD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,mDAAmD,CAAC;AAC3D,OAAO,qCAAqC,CAAC;AAC7C,OAAO,qCAAqC,CA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,OAAuB;IAEvB,MAAM,cAAc,GAAwB;QAC1C,MAAM;QACN;YACE,YAAY;YACZ,oBAAoB,EAAE,SAAS;YAC/B,WAAW;YACX,SAAS,EAAE,SAAS,CAAC,KAAK;YAC1B,oBAAoB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;SACxE;QACD,OAAO;KACR,CAAC;IACF,MAAM,aAAa,GAAG,CAAC,MAAM,iBAAiB,CAAC,GAAG,cAAc,CAAC,CAAC;SAC/D,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC;SAC9C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACpC,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAA4B,CAAC;AAC1F,CAAC"}
@@ -38,8 +38,8 @@ Use these within \`fileUpdates\` during code generation:
38
38
  `;
39
39
  if (askQuestion && (interactive || ui)) {
40
40
  systemPrompt += `
41
- ## INTERACTIVE MODE (askQuestion)
42
- All interactions occur via \`askQuestion\`.
41
+ ## INTERACTIVE MODE (iterate)
42
+ All interactions occur via \`iterate\`.
43
43
 
44
44
  **Communication Protocol**
45
45
  - Address the user directly using "you". Never address the assistant or the system.
@@ -50,7 +50,7 @@ All interactions occur via \`askQuestion\`.
50
50
  **Workflow**
51
51
  1. **Analyze**: Understand the request, inspect relevant code, check permissions, and identify dependencies.
52
52
  2. **Plan**: Summarize your approach and list affected files. Ask for confirmation when changes are significant or risky.
53
- 3. **Execute**: Call \`askQuestion\` with the appropriate \`actionType\` to read, modify, or validate.
53
+ 3. **Execute**: Call \`iterate\` with the appropriate \`actionType\` to read, modify, or validate.
54
54
 
55
55
  ### ACTION TYPES
56
56
 
@@ -59,6 +59,7 @@ All interactions occur via \`askQuestion\`.
59
59
  - \`conversationGraph\`: Define structured flows for complex, multi-step tasks or features.
60
60
  - \`endConversation\`: Explicitly end the session.
61
61
  - \`genaicodeHelp\`: When the user needs help with GenAIcode itself.
62
+ - \`structuredQuestion\`: Present a structured form (checkboxes, select, text) to collect specific user input.
62
63
 
63
64
  **Context Gathering**
64
65
  - \`requestFilesContent\`: Read project files whose content is currently null.
@@ -78,9 +79,6 @@ ${dockerTaskEnabled ? '- `runContainerTask`: Execute complex or potentially dest
78
79
 
79
80
  **Advanced Analysis**
80
81
  - \`performAnalysis\`: Internal computation or structured analysis returning specific findings.
81
- - \`reasoningInference\`: Use a reasoning-capable model.
82
- - Step 1: Tell the user you will run deeper reasoning.
83
- - Step 2: Call \`reasoningInference\` with a detailed, self-contained prompt (problem, context, constraints, assumptions, relevant code).
84
82
  - \`generateImage\`: Request image generation (only if allowed).
85
83
 
86
84
  **Context Management**
@@ -93,6 +91,8 @@ ${dockerTaskEnabled ? '- `runContainerTask`: Execute complex or potentially dest
93
91
  2. Before using \`createFile\`, check whether the file path is already known. If it exists, inform the user rather than overwriting.
94
92
  3. Use \`compoundAction\` for straightforward batches of simple file/image operations explicitly implied by the user.
95
93
  4. Use \`confirmCodeGeneration\` for feature work or refactors that require analysis and coordinated multi-file changes.
94
+ 5. When you need to collect specific information from the user that fits a form structure (like multiple options, checkboxes, or specific fields), prefer using the \`structuredQuestion\` tool over asking open-ended questions in text. This provides a better user experience.
95
+ 6. For complex, multi-step tasks that require planning and state management, or when the conversation might branch based on outcomes, use the \`conversationGraph\` tool. This allows for structured reasoning and execution flow.
96
96
  `;
97
97
  }
98
98
  if (importantContext?.systemPrompt && importantContext.systemPrompt.length > 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"systemprompt.js","sourceRoot":"","sources":["../../src/prompt/systemprompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAItD,+DAA+D;AAC/D,MAAM,UAAU,eAAe,CAC7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AAC;QACZ,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;IAC9C,CAAC;IAED,uBAAuB,CAAC,YAAY,CAAC,CAAC;IAEtC,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -1,20 +1,29 @@
1
1
  import { ConsoleLogEntry } from '../main/common/console-types.js';
2
2
  /**
3
3
  * Callback function type for handling console log updates
4
+ * NOTE: The callback receives ONLY NEW log entries since the previous callback.
4
5
  */
5
6
  export type ConsoleLogCallback = (logs: ConsoleLogEntry[]) => Promise<void>;
6
7
  /**
7
8
  * Intercepts console methods and maintains a buffer of console log entries.
8
9
  * Calls a provided callback whenever new logs are added.
10
+ *
11
+ * Changes:
12
+ * - Only NEW entries are sent to the callback (not the whole buffer)
13
+ * - Each entry's message is capped to a max length to avoid large payloads
14
+ * - Batch multiple console calls in the same tick into a single callback invocation
9
15
  */
10
16
  export declare class ConsoleInterceptor {
11
17
  private buffer;
12
18
  private readonly maxBufferSize;
13
19
  private readonly callback;
20
+ private pendingBatch;
21
+ private flushScheduled;
22
+ private static readonly MAX_ENTRY_MESSAGE_LENGTH;
14
23
  /**
15
24
  * Creates a new ConsoleInterceptor instance
16
- * @param maxBufferSize - Maximum number of log entries to keep in buffer (default: 1000)
17
- * @param callback - Function to call with updated logs buffer
25
+ * @param maxBufferSize - Maximum number of log entries to keep in buffer (default: 50)
26
+ * @param callback - Function to call with NEW logs (delta) when available
18
27
  */
19
28
  constructor(maxBufferSize: number | undefined, callback: ConsoleLogCallback);
20
29
  /**
@@ -22,15 +31,19 @@ export declare class ConsoleInterceptor {
22
31
  */
23
32
  private _wrapConsoleMethods;
24
33
  /**
25
- * Formats log arguments into a single message string
34
+ * Formats log arguments into a single message string and enforces max length
26
35
  */
27
36
  private _formatMessage;
28
37
  /**
29
- * Adds a log entry to the buffer and calls the callback
38
+ * Enqueue a new log entry and schedule a batched flush
30
39
  */
31
- private _addToBuffer;
40
+ private _enqueue;
32
41
  /**
33
- * Gets the current buffer of log entries
42
+ * Flush the pending batch to the callback (delta only)
43
+ */
44
+ private _flush;
45
+ /**
46
+ * Gets a copy of the current buffer of log entries
34
47
  */
35
48
  getBuffer(): ConsoleLogEntry[];
36
49
  /**