genaicode 0.6.0 → 0.7.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 (217) hide show
  1. package/README.md +1 -3
  2. package/dist/ai-service/ai-studio.js +7 -1
  3. package/dist/ai-service/ai-studio.js.map +1 -1
  4. package/dist/ai-service/anthropic.js +49 -19
  5. package/dist/ai-service/anthropic.js.map +1 -1
  6. package/dist/ai-service/chat-gpt.js +28 -11
  7. package/dist/ai-service/chat-gpt.js.map +1 -1
  8. package/dist/ai-service/common.d.ts +5 -4
  9. package/dist/ai-service/common.js +3 -4
  10. package/dist/ai-service/common.js.map +1 -1
  11. package/dist/ai-service/common.test.js +1 -1
  12. package/dist/ai-service/vertex-ai-claude.js +1 -1
  13. package/dist/ai-service/vertex-ai-claude.js.map +1 -1
  14. package/dist/ai-service/vertex-ai.js +7 -1
  15. package/dist/ai-service/vertex-ai.js.map +1 -1
  16. package/dist/cli/cli-options.js +0 -12
  17. package/dist/cli/cli-options.js.map +1 -1
  18. package/dist/cli/cli-params.d.ts +0 -3
  19. package/dist/cli/cli-params.js +0 -9
  20. package/dist/cli/cli-params.js.map +1 -1
  21. package/dist/cli/validate-cli-params.js +1 -7
  22. package/dist/cli/validate-cli-params.js.map +1 -1
  23. package/dist/cli/validate-cli-params.test.js +1 -1
  24. package/dist/cli/validate-cli-params.test.js.map +1 -1
  25. package/dist/eval/codegen-summary.test.d.ts +1 -0
  26. package/dist/eval/codegen-summary.test.js +91 -0
  27. package/dist/eval/codegen-summary.test.js.map +1 -0
  28. package/dist/eval/current-prompt-plugin.d.ts +3 -0
  29. package/dist/eval/current-prompt-plugin.js +10 -0
  30. package/dist/eval/current-prompt-plugin.js.map +1 -0
  31. package/dist/eval/data/current-prompt.d.ts +73 -0
  32. package/dist/eval/data/current-prompt.js +104 -0
  33. package/dist/eval/data/current-prompt.js.map +1 -0
  34. package/dist/eval/data/prompt-assistant-image.d.ts +49 -0
  35. package/dist/eval/data/prompt-assistant-image.js +67 -0
  36. package/dist/eval/data/prompt-assistant-image.js.map +1 -0
  37. package/dist/eval/data/prompt3.d.ts +34 -0
  38. package/dist/eval/data/prompt3.js +71 -0
  39. package/dist/eval/data/prompt3.js.map +1 -0
  40. package/dist/eval/prompt-debug.test.d.ts +1 -0
  41. package/dist/eval/prompt-debug.test.js +71 -0
  42. package/dist/eval/prompt-debug.test.js.map +1 -0
  43. package/dist/eval/prompt2.d.ts +34 -0
  44. package/dist/eval/prompt2.js +125 -0
  45. package/dist/eval/prompt2.js.map +1 -0
  46. package/dist/files/read-files.d.ts +2 -2
  47. package/dist/files/read-files.js +13 -7
  48. package/dist/files/read-files.js.map +1 -1
  49. package/dist/files/read-files.test.js +12 -6
  50. package/dist/files/read-files.test.js.map +1 -1
  51. package/dist/files/source-code-tree.d.ts +12 -0
  52. package/dist/files/source-code-tree.js +27 -0
  53. package/dist/files/source-code-tree.js.map +1 -0
  54. package/dist/main/codegen-types.d.ts +9 -4
  55. package/dist/main/codegen-utils.d.ts +1 -1
  56. package/dist/main/codegen-utils.js +1 -3
  57. package/dist/main/codegen-utils.js.map +1 -1
  58. package/dist/main/codegen.ai-services.test.d.ts +3 -0
  59. package/dist/main/codegen.ai-services.test.js +198 -0
  60. package/dist/main/codegen.ai-services.test.js.map +1 -0
  61. package/dist/main/codegen.cli-options.test.d.ts +3 -0
  62. package/dist/main/codegen.cli-options.test.js +171 -0
  63. package/dist/main/codegen.cli-options.test.js.map +1 -0
  64. package/dist/main/codegen.image-generation.test.d.ts +3 -0
  65. package/dist/main/codegen.image-generation.test.js +187 -0
  66. package/dist/main/codegen.image-generation.test.js.map +1 -0
  67. package/dist/main/codegen.js +4 -7
  68. package/dist/main/codegen.js.map +1 -1
  69. package/dist/main/codegen.test-utils.d.ts +81 -0
  70. package/dist/main/codegen.test-utils.js +88 -0
  71. package/dist/main/codegen.test-utils.js.map +1 -0
  72. package/dist/main/codegen.test.js +47 -28
  73. package/dist/main/codegen.test.js.map +1 -1
  74. package/dist/main/common/content-bus-types.d.ts +6 -0
  75. package/dist/main/common/content-bus.d.ts +2 -2
  76. package/dist/main/common/content-bus.js +3 -1
  77. package/dist/main/common/content-bus.js.map +1 -1
  78. package/dist/main/common/user-actions.d.ts +8 -2
  79. package/dist/main/common/user-actions.js.map +1 -1
  80. package/dist/main/interactive/codegen-interactive.js +0 -4
  81. package/dist/main/interactive/codegen-interactive.js.map +1 -1
  82. package/dist/main/interactive/codegen-interactive.test.js +0 -6
  83. package/dist/main/interactive/codegen-interactive.test.js.map +1 -1
  84. package/dist/main/interactive/common.d.ts +1 -1
  85. package/dist/main/interactive/common.js +0 -2
  86. package/dist/main/interactive/common.js.map +1 -1
  87. package/dist/main/interactive/configure.js +0 -2
  88. package/dist/main/interactive/configure.js.map +1 -1
  89. package/dist/main/interactive/help.js +0 -2
  90. package/dist/main/interactive/help.js.map +1 -1
  91. package/dist/main/interactive/task-file.js +1 -1
  92. package/dist/main/interactive/task-file.js.map +1 -1
  93. package/dist/main/interactive/text-prompt.js +1 -1
  94. package/dist/main/interactive/text-prompt.js.map +1 -1
  95. package/dist/main/interactive/user-action-handlers.js +4 -2
  96. package/dist/main/interactive/user-action-handlers.js.map +1 -1
  97. package/dist/main/plugin-loader.d.ts +2 -1
  98. package/dist/main/plugin-loader.js +8 -0
  99. package/dist/main/plugin-loader.js.map +1 -1
  100. package/dist/main/ui/backend/api.js +9 -3
  101. package/dist/main/ui/backend/api.js.map +1 -1
  102. package/dist/main/ui/backend/service.d.ts +2 -1
  103. package/dist/main/ui/backend/service.js +6 -3
  104. package/dist/main/ui/backend/service.js.map +1 -1
  105. package/dist/main/ui/frontend/assets/{index-Dk_qaEQg.js → index-5e3ykhy6.js} +129 -103
  106. package/dist/main/ui/frontend/index.html +1 -1
  107. package/dist/main/ui/user-action-handlers.js +1 -1
  108. package/dist/main/ui/user-action-handlers.js.map +1 -1
  109. package/dist/prompt/function-calling.js +8 -3
  110. package/dist/prompt/function-calling.js.map +1 -1
  111. package/dist/prompt/function-defs/ask-question.d.ts +5 -0
  112. package/dist/prompt/function-defs/ask-question.js +140 -60
  113. package/dist/prompt/function-defs/ask-question.js.map +1 -1
  114. package/dist/prompt/function-defs/codegen-planning.d.ts +8 -0
  115. package/dist/prompt/function-defs/codegen-planning.js +50 -0
  116. package/dist/prompt/function-defs/codegen-planning.js.map +1 -0
  117. package/dist/prompt/function-defs/codegen-summary.js +2 -2
  118. package/dist/prompt/function-defs/codegen-summary.js.map +1 -1
  119. package/dist/prompt/function-defs/get-source-code.js +32 -2
  120. package/dist/prompt/function-defs/get-source-code.js.map +1 -1
  121. package/dist/prompt/function-defs/optimize-context.js +35 -12
  122. package/dist/prompt/function-defs/optimize-context.js.map +1 -1
  123. package/dist/prompt/limits.js +2 -2
  124. package/dist/prompt/limits.js.map +1 -1
  125. package/dist/prompt/limits.test.js +3 -3
  126. package/dist/prompt/limits.test.js.map +1 -1
  127. package/dist/prompt/prompt-codegen.js +7 -79
  128. package/dist/prompt/prompt-codegen.js.map +1 -1
  129. package/dist/prompt/prompt-codegen.test.js +3 -10
  130. package/dist/prompt/prompt-codegen.test.js.map +1 -1
  131. package/dist/prompt/prompt-service-ask-question.test.js +26 -81
  132. package/dist/prompt/prompt-service-ask-question.test.js.map +1 -1
  133. package/dist/prompt/prompt-service.ai-services.test.d.ts +1 -0
  134. package/dist/prompt/prompt-service.ai-services.test.js +149 -0
  135. package/dist/prompt/prompt-service.ai-services.test.js.map +1 -0
  136. package/dist/prompt/prompt-service.context-optimization.test.d.ts +1 -0
  137. package/dist/prompt/prompt-service.context-optimization.test.js +212 -0
  138. package/dist/prompt/prompt-service.context-optimization.test.js.map +1 -0
  139. package/dist/prompt/prompt-service.image-handling.test.d.ts +1 -0
  140. package/dist/prompt/prompt-service.image-handling.test.js +212 -0
  141. package/dist/prompt/prompt-service.image-handling.test.js.map +1 -0
  142. package/dist/prompt/prompt-service.js +36 -29
  143. package/dist/prompt/prompt-service.js.map +1 -1
  144. package/dist/prompt/prompt-service.test-utils.d.ts +66 -0
  145. package/dist/prompt/prompt-service.test-utils.js +169 -0
  146. package/dist/prompt/prompt-service.test-utils.js.map +1 -0
  147. package/dist/prompt/prompt-service.test.js +96 -20
  148. package/dist/prompt/prompt-service.test.js.map +1 -1
  149. package/dist/prompt/prompt-service.validation-recovery.test.d.ts +1 -0
  150. package/dist/prompt/prompt-service.validation-recovery.test.js +263 -0
  151. package/dist/prompt/prompt-service.validation-recovery.test.js.map +1 -0
  152. package/dist/prompt/static-prompts.d.ts +16 -0
  153. package/dist/prompt/static-prompts.js +22 -0
  154. package/dist/prompt/static-prompts.js.map +1 -0
  155. package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.js +1 -1
  156. package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.js.map +1 -1
  157. package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.d.ts +1 -1
  158. package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js +7 -4
  159. package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js.map +1 -1
  160. package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js +6 -4
  161. package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js.map +1 -1
  162. package/dist/prompt/steps/step-ask-question/handlers/default-action.js +1 -2
  163. package/dist/prompt/steps/step-ask-question/handlers/default-action.js.map +1 -1
  164. package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer-with-image.d.ts +2 -0
  165. package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer-with-image.js +86 -0
  166. package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer-with-image.js.map +1 -0
  167. package/dist/prompt/steps/step-ask-question/handlers/handle-send-message-with-image.d.ts +2 -0
  168. package/dist/prompt/steps/step-ask-question/handlers/handle-send-message-with-image.js +103 -0
  169. package/dist/prompt/steps/step-ask-question/handlers/handle-send-message-with-image.js.map +1 -0
  170. package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.d.ts +2 -0
  171. package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.js +22 -0
  172. package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.js.map +1 -0
  173. package/dist/prompt/steps/step-ask-question/handlers/handler-utils.d.ts +0 -0
  174. package/dist/prompt/steps/step-ask-question/handlers/handler-utils.js +2 -0
  175. package/dist/prompt/steps/step-ask-question/handlers/handler-utils.js.map +1 -0
  176. package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.d.ts +1 -1
  177. package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js +58 -13
  178. package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js.map +1 -1
  179. package/dist/prompt/steps/step-ask-question/handlers/request-files-content.d.ts +1 -1
  180. package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js +110 -10
  181. package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js.map +1 -1
  182. package/dist/prompt/steps/step-ask-question/handlers/request-permissions.d.ts +1 -1
  183. package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js +49 -24
  184. package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js.map +1 -1
  185. package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.js +1 -1
  186. package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.js.map +1 -1
  187. package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.js +1 -0
  188. package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.js.map +1 -1
  189. package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts +22 -19
  190. package/dist/prompt/steps/step-ask-question/step-ask-question.d.ts +2 -4
  191. package/dist/prompt/steps/step-ask-question/step-ask-question.js +18 -29
  192. package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -1
  193. package/dist/prompt/steps/step-codegen-planning.d.ts +10 -0
  194. package/dist/prompt/steps/step-codegen-planning.js +69 -0
  195. package/dist/prompt/steps/step-codegen-planning.js.map +1 -0
  196. package/dist/prompt/steps/step-context-optimization.js +110 -80
  197. package/dist/prompt/steps/step-context-optimization.js.map +1 -1
  198. package/dist/prompt/steps/step-context-optimization.test.d.ts +2 -0
  199. package/dist/prompt/steps/step-context-optimization.test.js +456 -0
  200. package/dist/prompt/steps/step-context-optimization.test.js.map +1 -0
  201. package/dist/prompt/steps/step-generate-image.d.ts +8 -1
  202. package/dist/prompt/steps/step-generate-image.js +1 -0
  203. package/dist/prompt/steps/step-generate-image.js.map +1 -1
  204. package/dist/prompt/steps/step-summarization.d.ts +0 -1
  205. package/dist/prompt/steps/step-summarization.js +6 -3
  206. package/dist/prompt/steps/step-summarization.js.map +1 -1
  207. package/dist/prompt/steps/step-validate-recover.js +24 -15
  208. package/dist/prompt/steps/step-validate-recover.js.map +1 -1
  209. package/dist/prompt/systemprompt.d.ts +2 -2
  210. package/dist/prompt/systemprompt.js +74 -176
  211. package/dist/prompt/systemprompt.js.map +1 -1
  212. package/dist/prompt/systemprompt.test.js +2 -3
  213. package/dist/prompt/systemprompt.test.js.map +1 -1
  214. package/dist/vite-genaicode/vite-genaicode-plugin.d.ts +2 -1
  215. package/dist/vite-genaicode/vite-genaicode-plugin.js +15 -2
  216. package/dist/vite-genaicode/vite-genaicode-plugin.js.map +1 -1
  217. package/package.json +3 -2
@@ -7,7 +7,7 @@
7
7
  <meta name="keywords" content="GenAIcode, AI, code generation, programming" />
8
8
  <title>GenAIcode - AI-Powered Code Generation</title>
9
9
  <link rel="icon" href="/favicon.ico" type="image/x-icon" />
10
- <script type="module" crossorigin src="/assets/index-Dk_qaEQg.js"></script>
10
+ <script type="module" crossorigin src="/assets/index-5e3ykhy6.js"></script>
11
11
  <link rel="stylesheet" crossorigin href="/assets/index-S_ocA1xG.css">
12
12
  </head>
13
13
  <body data-security-token="__SECURITY_TOKEN__">
@@ -1,6 +1,6 @@
1
1
  import { registerConfirmHandler, registerInputHandler } from '../common/user-actions.js';
2
2
  export function registerUserActionHandlers(service) {
3
- registerInputHandler((_, message) => service.askQuestion(message, undefined).then((response) => response.answer));
3
+ registerInputHandler((_, message) => service.askQuestion(message, undefined));
4
4
  registerConfirmHandler(async (props) => {
5
5
  const response = await service.askQuestion(props.prompt, {
6
6
  defaultValue: props.defaultValue,
@@ -1 +1 @@
1
- {"version":3,"file":"user-action-handlers.js","sourceRoot":"","sources":["../../../src/main/ui/user-action-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGzF,MAAM,UAAU,0BAA0B,CAAC,OAAgB;IACzD,oBAAoB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAClH,sBAAsB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACrC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE;YACvD,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,aAAa,EAAE,KAAK,CAAC,aAAa;YAClC,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,YAAY,EAAE,KAAK,CAAC,YAAY;SACjC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"user-action-handlers.js","sourceRoot":"","sources":["../../../src/main/ui/user-action-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGzF,MAAM,UAAU,0BAA0B,CAAC,OAAgB;IACzD,oBAAoB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;IAC9E,sBAAsB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACrC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE;YACvD,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,aAAa,EAAE,KAAK,CAAC,aAAa;YAClC,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,YAAY,EAAE,KAAK,CAAC,YAAY;SACjC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -4,13 +4,13 @@ import { getImageAssets } from './function-defs/get-image-assets.js';
4
4
  import { getCodegenSummaryDef } from './function-defs/codegen-summary.js';
5
5
  import { explanation } from './function-defs/explanation.js';
6
6
  import { generateImage } from './function-defs/generate-image.js';
7
- import { getAskQuestionDef } from './function-defs/ask-question.js';
7
+ import { getAskQuestionDef, sendMessageWithImage, requestPermissions, requestFilesContent, removeFilesFromContext, contextOptimization, } from './function-defs/ask-question.js';
8
8
  import { optimizeContext } from './function-defs/optimize-context.js';
9
9
  import { setSummaries } from './function-defs/set-summaries.js';
10
10
  import { updateHistory } from './function-defs/update-history.js';
11
11
  import { readHistory } from './function-defs/read-history.js';
12
- import { askQuestionReflect } from './function-defs/ask-question-reflect.js';
13
12
  import { getOperationDefs } from '../operations/operations-index.js';
13
+ import { getCodegenPlanningDef } from './function-defs/codegen-planning.js';
14
14
  /**
15
15
  * Function definitions for function calling feature
16
16
  */
@@ -19,14 +19,19 @@ export function getFunctionDefs() {
19
19
  getSourceCode,
20
20
  getImageAssets,
21
21
  getCodegenSummaryDef(),
22
+ getCodegenPlanningDef(),
22
23
  explanation,
23
24
  generateImage,
24
25
  getAskQuestionDef(),
26
+ sendMessageWithImage,
27
+ requestPermissions,
28
+ requestFilesContent,
29
+ removeFilesFromContext,
30
+ contextOptimization,
25
31
  optimizeContext,
26
32
  setSummaries,
27
33
  updateHistory,
28
34
  readHistory,
29
- askQuestionReflect,
30
35
  ...getOperationDefs(),
31
36
  ].map((fd) => {
32
37
  if (!disableExplanations &&
@@ -1 +1 @@
1
- {"version":3,"file":"function-calling.js","sourceRoot":"","sources":["../../src/prompt/function-calling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO;QACL,aAAa;QACb,cAAc;QACd,oBAAoB,EAAE;QACtB,WAAW;QACX,aAAa;QACb,iBAAiB,EAAE;QACnB,eAAe;QACf,YAAY;QACZ,aAAa;QACb,WAAW;QACX,kBAAkB;QAClB,GAAG,gBAAgB,EAAE;KACtB,CAAC,GAAG,CAAC,CAAC,EAAe,EAAE,EAAE;QACxB,IACE,CAAC,mBAAmB;YACpB,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW;YACpC,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAC/C,CAAC;YACD,EAAE,CAAC,UAAU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QAClB,mBAAmB;QACnB,sBAAsB;QACtB,mBAAmB;QACnB,eAAe;QACf,YAAY;QACZ,aAAa;QACb,WAAW;QACX,GAAG,gBAAgB,EAAE;KACtB,CAAC,GAAG,CAAC,CAAC,EAAe,EAAE,EAAE;QACxB,IACE,CAAC,mBAAmB;YACpB,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW;YACpC,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAC/C,CAAC;YACD,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAChD,CAAC;aAAM,IAAI,mBAAmB,EAAE,CAAC;YAC/B,OAAO,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC;QAC9C,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -6,3 +6,8 @@ import { FunctionDef } from '../../ai-service/common';
6
6
  * Each actionType serves a specific purpose, ensuring clarity and proper task execution.
7
7
  */
8
8
  export declare const getAskQuestionDef: () => FunctionDef;
9
+ export declare const requestFilesContent: FunctionDef;
10
+ export declare const sendMessageWithImage: FunctionDef;
11
+ export declare const removeFilesFromContext: FunctionDef;
12
+ export declare const contextOptimization: FunctionDef;
13
+ export declare const requestPermissions: FunctionDef;
@@ -1,24 +1,18 @@
1
1
  import { getRegisteredActionHandlerDescriptions, getRegisteredActionHandlers } from '../../main/plugin-loader.js';
2
- /**
3
- * Function definition for askQuestion
4
- *
5
- * Use this function to ask questions, seek clarification, request file permissions, or manage the flow of the conversation.
6
- * Each actionType serves a specific purpose, ensuring clarity and proper task execution.
7
- */
8
2
  function getActionTypeDescription() {
9
3
  const pluginDescriptions = Array.from(getRegisteredActionHandlerDescriptions().entries())
10
4
  .map(([actionType, description]) => ` - ${actionType}: ${description}`)
11
5
  .join('\n');
12
- return `This value instructs the program on what should happen next. Use "requestAnswer" for analysis requests or clarifications.,
6
+ return `This value instructs the program on what should happen next.
13
7
 
14
8
  Detailed Explanation of actionTypes:
15
- - requestAnswer: Use for general information, clarifications, or when no specific code is needed.
16
- - requestPermissions: Use when additional permissions are required for actions like creating or deleting files.
17
- - requestFilesContent: Use specifically when needing to access or review the contents of files.
9
+ - sendMessage: Use for general information, clarifications, or when no specific code is needed.
10
+ - sendMessageWithImage: Use when an image is needed to provide context or additional information.
11
+ - requestPermissions: Use **only when you lack necessary permissions** for actions like creating, deleting, or moving files, and need to request them from the user.
12
+ - requestFilesContent: Use specifically when needing to access or review the contents of files, and it was not provided yet in any of preceeding \`getSourceCode\` function responses.
18
13
  - removeFilesFromContext: Use to remove unnecessary file contents from context, optimizing token usage.
19
14
  - confirmCodeGeneration: Use to confirm with the user before starting code generation tasks.
20
- - startCodeGeneration: Use only after receiving confirmation to begin code generation.
21
- - cancelCodeGeneration: Use if code generation should be stopped or canceled.
15
+ - cancelCodeGeneration: Use to stop the session, and the conversation.
22
16
  - contextOptimization: Use to manage and optimize context during code generation tasks, allowing the LLM to provide guidance on what parts of the context are most relevant to keep.
23
17
  ${pluginDescriptions}`;
24
18
  }
@@ -30,85 +24,171 @@ ${pluginDescriptions}`;
30
24
  */
31
25
  export const getAskQuestionDef = () => ({
32
26
  name: 'askQuestion',
33
- description: 'Use this function to ask a question, seek clarification, or manage the flow of the conversation. For analysis requests, use actionType "requestAnswer". Only proceed to code generation when explicitly instructed or after confirmation.',
27
+ description: `Use this function to interact with the user for various purposes.
28
+ The \`decisionMakingProcess\` must be provided as first parameter to ensure clarity in decision-making, and impact on selection of \`actionType\` and \`message\`.
29
+ The \`message\` property must align with the chosen \`actionType\`.
30
+
31
+ The desired format of parameters is as follows:
32
+ \`\`\`
33
+ {
34
+ "decisionMakingProcess": "...", // A detailed decision-making framework the assistant followed before selecting an action.",
35
+ "actionType": "...", // The type of action to perform.
36
+ "message": "..." // The message to display to the user.
37
+ }
38
+ \`\`\`
39
+
40
+ **IMPORTANT**: Mind the order of the parameters, as the decision-making process must be provided first to ensure clarity in decision-making.
41
+ `,
34
42
  parameters: {
35
43
  type: 'object',
36
44
  properties: {
45
+ decisionMakingProcess: {
46
+ type: 'string',
47
+ description: `A detailed decision-making framework the assistant followed before selecting an action. You must think step about step about this, this process should include the following steps:
48
+
49
+ 1. **Contextual Analysis**: Assess the current information, including available permissions, current context, and task requirements. Identify any missing elements that are critical to task completion.
50
+
51
+ 2. **Decision Justification**: State the reasoning for the proposed action, considering whether planning, clarification, or action is required. If there's any ambiguity, prefer a confirmatory action (\`confirmCodeGeneration\`).
52
+
53
+ 3. **Minimal Action Selection**: Determine the minimal action that can make progress toward the task goal. Avoid requesting unnecessary permissions or context that isn't strictly needed.
54
+
55
+ 4. **Evaluation of Action Choice**: Double-check if the selected action aligns with task requirements and user-provided constraints.
56
+
57
+ Output this in step-by-step format to ensure clarity in decision-making.`,
58
+ },
37
59
  actionType: {
38
60
  type: 'string',
39
61
  enum: [
40
- 'requestAnswer',
62
+ 'sendMessage',
63
+ 'sendMessageWithImage',
41
64
  'requestPermissions',
42
65
  'requestFilesContent',
43
66
  'removeFilesFromContext',
44
67
  'confirmCodeGeneration',
45
- 'startCodeGeneration',
46
68
  'cancelCodeGeneration',
47
69
  'contextOptimization',
48
70
  ...Array.from(getRegisteredActionHandlers().keys()),
49
71
  ],
50
72
  description: getActionTypeDescription(),
51
73
  },
52
- content: {
74
+ message: {
53
75
  type: 'string',
54
- description: 'The message you want to display to the user. It can be a question if you need more information, an analysis result, or a confirmation request before proceeding with code generation.',
76
+ description: 'The message to display to the user.',
55
77
  },
56
- promptNecessity: {
57
- type: 'number',
58
- minimum: 0,
59
- maximum: 100,
60
- description: 'Indicates how strongly you need a response from the user. A higher value means a stronger need for user input.',
61
- },
62
- requestFilesContent: {
78
+ },
79
+ required: ['decisionMakingProcess', 'actionType', 'message'],
80
+ },
81
+ });
82
+ // requestFilesContent
83
+ export const requestFilesContent = {
84
+ name: 'requestFilesContent',
85
+ description: 'Use this function to request the content of files that are missing from the context.',
86
+ parameters: {
87
+ type: 'object',
88
+ properties: {
89
+ filePaths: {
63
90
  type: 'array',
64
- description: 'An array of absolute file paths for which you need the content. Use this when specific files are missing and you need them to proceed with the task.',
65
91
  items: {
66
92
  type: 'string',
67
93
  },
94
+ description: 'An array of absolute file paths for which you need the content.',
68
95
  },
69
- removeFilesFromContext: {
96
+ },
97
+ required: ['filePaths'],
98
+ },
99
+ };
100
+ // sendMessageWithImage
101
+ export const sendMessageWithImage = {
102
+ name: 'sendMessageWithImage',
103
+ description: 'Use this function to send message to the user with accompanying image that will be generated using provided prompt, and optionally using other image as a context.',
104
+ parameters: {
105
+ type: 'object',
106
+ properties: {
107
+ prompt: {
108
+ type: 'string',
109
+ description: 'The prompt used to generate the image.',
110
+ },
111
+ contextImage: {
112
+ type: 'string',
113
+ description: 'Optional path to an image file used as context for image generation.',
114
+ },
115
+ },
116
+ required: ['prompt'],
117
+ },
118
+ };
119
+ // removeFilesFromContext
120
+ export const removeFilesFromContext = {
121
+ name: 'removeFilesFromContext',
122
+ description: 'Use this function to remove files from the context that are no longer needed for code generation.',
123
+ parameters: {
124
+ type: 'object',
125
+ properties: {
126
+ filePaths: {
70
127
  type: 'array',
71
- description: 'An array of absolute file paths that should be removed from the context. Use this to optimize token usage by removing unnecessary file contents.',
72
128
  items: {
73
129
  type: 'string',
74
130
  },
131
+ description: 'An array of absolute file paths to remove from the context.',
75
132
  },
76
- contextOptimization: {
133
+ },
134
+ required: ['filePaths'],
135
+ },
136
+ };
137
+ // contextOptimization
138
+ export const contextOptimization = {
139
+ name: 'contextOptimization',
140
+ description: 'Use this function to optimize the context for code generation by specifying which parts are most relevant to keep.',
141
+ parameters: {
142
+ type: 'object',
143
+ properties: {
144
+ prompt: {
77
145
  type: 'string',
78
- description: 'A prompt generated to guide the LLM in optimizing context by specifying which parts of the context are most relevant to keep. This helps in efficient management during code generation tasks.',
146
+ description: 'The prompt used to guide the user in optimizing the context.',
79
147
  },
80
- requestPermissions: {
81
- type: 'object',
82
- description: 'Use this to request additional permissions needed for code generation if they are not already granted.',
83
- properties: {
84
- allowDirectoryCreate: {
85
- description: 'Set to true to request permission for creating directories.',
86
- type: 'boolean',
87
- },
88
- allowFileCreate: {
89
- description: 'Set to true to request permission for creating files.',
90
- type: 'boolean',
91
- },
92
- allowFileDelete: {
93
- description: 'Set to true to request permission for deleting files.',
94
- type: 'boolean',
95
- },
96
- allowFileMove: {
97
- description: 'Set to true to request permission for moving files.',
98
- type: 'boolean',
99
- },
100
- enableVision: {
101
- description: 'Set to true to request permission for vision capabilities, using images as context for code generation.',
102
- type: 'boolean',
103
- },
104
- enableImagen: {
105
- description: 'Set to true to request permission for generating images.',
106
- type: 'boolean',
107
- },
108
- },
148
+ },
149
+ required: ['prompt'],
150
+ },
151
+ };
152
+ // requestPermissions
153
+ export const requestPermissions = {
154
+ name: 'requestPermissions',
155
+ description: 'Use this function to request additional permissions needed for code generation if not already granted.',
156
+ parameters: {
157
+ type: 'object',
158
+ properties: {
159
+ allowDirectoryCreate: {
160
+ description: 'Request permission to create directories.',
161
+ type: 'boolean',
162
+ },
163
+ allowFileCreate: {
164
+ description: 'Request permission to create files.',
165
+ type: 'boolean',
166
+ },
167
+ allowFileDelete: {
168
+ description: 'Request permission to delete files.',
169
+ type: 'boolean',
170
+ },
171
+ allowFileMove: {
172
+ description: 'Request permission to move files.',
173
+ type: 'boolean',
174
+ },
175
+ enableVision: {
176
+ description: 'Request permission for vision capabilities, using images as context for code generation.',
177
+ type: 'boolean',
178
+ },
179
+ enableImagen: {
180
+ description: 'Request permission to generate images.',
181
+ type: 'boolean',
109
182
  },
110
183
  },
111
- required: ['actionType', 'content', 'promptNecessity'],
184
+ required: [
185
+ 'allowDirectoryCreate',
186
+ 'allowFileCreate',
187
+ 'allowFileDelete',
188
+ 'allowFileMove',
189
+ 'enableVision',
190
+ 'enableImagen',
191
+ ],
112
192
  },
113
- });
193
+ };
114
194
  //# sourceMappingURL=ask-question.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ask-question.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/ask-question.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sCAAsC,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAElH;;;;;GAKG;AACH,SAAS,wBAAwB;IAC/B,MAAM,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAAC,sCAAsC,EAAE,CAAC,OAAO,EAAE,CAAC;SACtF,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,MAAM,UAAU,KAAK,WAAW,EAAE,CAAC;SACtE,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO;;;;;;;;;;;EAWP,kBAAkB,EAAE,CAAC;AACvB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAgB,EAAE,CAAC,CAAC;IACnD,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,2OAA2O;IAC7O,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE;oBACJ,eAAe;oBACf,oBAAoB;oBACpB,qBAAqB;oBACrB,wBAAwB;oBACxB,uBAAuB;oBACvB,qBAAqB;oBACrB,sBAAsB;oBACtB,qBAAqB;oBACrB,GAAG,KAAK,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC,IAAI,EAAE,CAAC;iBACpD;gBACD,WAAW,EAAE,wBAAwB,EAAE;aACxC;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,uLAAuL;aAC1L;YACD,eAAe,EAAE;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,GAAG;gBACZ,WAAW,EACT,gHAAgH;aACnH;YACD,mBAAmB,EAAE;gBACnB,IAAI,EAAE,OAAO;gBACb,WAAW,EACT,sJAAsJ;gBACxJ,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,sBAAsB,EAAE;gBACtB,IAAI,EAAE,OAAO;gBACb,WAAW,EACT,kJAAkJ;gBACpJ,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,mBAAmB,EAAE;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,gMAAgM;aACnM;YACD,kBAAkB,EAAE;gBAClB,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,wGAAwG;gBAC1G,UAAU,EAAE;oBACV,oBAAoB,EAAE;wBACpB,WAAW,EAAE,6DAA6D;wBAC1E,IAAI,EAAE,SAAS;qBAChB;oBACD,eAAe,EAAE;wBACf,WAAW,EAAE,uDAAuD;wBACpE,IAAI,EAAE,SAAS;qBAChB;oBACD,eAAe,EAAE;wBACf,WAAW,EAAE,uDAAuD;wBACpE,IAAI,EAAE,SAAS;qBAChB;oBACD,aAAa,EAAE;wBACb,WAAW,EAAE,qDAAqD;wBAClE,IAAI,EAAE,SAAS;qBAChB;oBACD,YAAY,EAAE;wBACZ,WAAW,EACT,yGAAyG;wBAC3G,IAAI,EAAE,SAAS;qBAChB;oBACD,YAAY,EAAE;wBACZ,WAAW,EAAE,0DAA0D;wBACvE,IAAI,EAAE,SAAS;qBAChB;iBACF;aACF;SACF;QACD,QAAQ,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,iBAAiB,CAAC;KACvD;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"ask-question.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/ask-question.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sCAAsC,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAElH,SAAS,wBAAwB;IAC/B,MAAM,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAAC,sCAAsC,EAAE,CAAC,OAAO,EAAE,CAAC;SACtF,GAAG,CAAC,CAAC,CAAC,UAA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d,UAAU,EAAE;YACV,oBAAoB,EAAE;gBACpB,WAAW,EAAE,2CAA2C;gBACxD,IAAI,EAAE,SAAS;aAChB;YACD,eAAe,EAAE;gBACf,WAAW,EAAE,qCAAqC;gBAClD,IAAI,EAAE,SAAS;aAChB;YACD,eAAe,EAAE;gBACf,WAAW,EAAE,qCAAqC;gBAClD,IAAI,EAAE,SAAS;aAChB;YACD,aAAa,EAAE;gBACb,WAAW,EAAE,mCAAmC;gBAChD,IAAI,EAAE,SAAS;aAChB;YACD,YAAY,EAAE;gBACZ,WAAW,EAAE,0FAA0F;gBACvG,IAAI,EAAE,SAAS;aAChB;YACD,YAAY,EAAE;gBACZ,WAAW,EAAE,wCAAwC;gBACrD,IAAI,EAAE,SAAS;aAChB;SACF;QACD,QAAQ,EAAE;YACR,sBAAsB;YACtB,iBAAiB;YACjB,iBAAiB;YACjB,eAAe;YACf,cAAc;YACd,cAAc;SACf;KACF;CACF,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { FunctionDef } from '../../ai-service/common.js';
2
+ /**
3
+ * Function definition for codegenPlanning
4
+ * This function analyzes the conversation and produces a detailed implementation plan
5
+ * before proceeding with actual code generation. This helps ensure all necessary files
6
+ * are identified and dependencies are properly handled.
7
+ */
8
+ export declare const getCodegenPlanningDef: () => FunctionDef;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Function definition for codegenPlanning
3
+ * This function analyzes the conversation and produces a detailed implementation plan
4
+ * before proceeding with actual code generation. This helps ensure all necessary files
5
+ * are identified and dependencies are properly handled.
6
+ */
7
+ export const getCodegenPlanningDef = () => ({
8
+ name: 'codegenPlanning',
9
+ description: 'Analyzes the conversation to produce an implementation plan, identifying all affected files and dependencies before code generation.',
10
+ parameters: {
11
+ type: 'object',
12
+ properties: {
13
+ problemAnalysis: {
14
+ type: 'string',
15
+ description: 'Detailed analysis of the problem.',
16
+ },
17
+ codeChanges: {
18
+ type: 'string',
19
+ description: 'A step by step plan of code changes neccessary to solve the problem.',
20
+ },
21
+ affectedFiles: {
22
+ type: 'array',
23
+ description: 'A list of all files that need to be modified. The reason must precede the file path.',
24
+ items: {
25
+ type: 'object',
26
+ properties: {
27
+ reason: {
28
+ type: 'string',
29
+ description: 'Reason for modifying this file.',
30
+ },
31
+ filePath: {
32
+ type: 'string',
33
+ description: 'Absolute path of the file.',
34
+ },
35
+ dependencies: {
36
+ type: 'array',
37
+ description: 'Related files that depend on or are depended upon by this file.',
38
+ items: {
39
+ type: 'string',
40
+ },
41
+ },
42
+ },
43
+ required: ['reason', 'filePath'],
44
+ },
45
+ },
46
+ },
47
+ required: ['problemAnalysis', 'codeChanges', 'affectedFiles'],
48
+ },
49
+ });
50
+ //# sourceMappingURL=codegen-planning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegen-planning.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/codegen-planning.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAgB,EAAE,CAAC,CAAC;IACvD,IAAI,EAAE,iBAAiB;IACvB,WAAW,EACT,sIAAsI;IACxI,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,eAAe,EAAE;gBACf,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mCAAmC;aACjD;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sEAAsE;aACpF;YACD,aAAa,EAAE;gBACb,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,sFAAsF;gBACnG,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,MAAM,EAAE;4BACN,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,iCAAiC;yBAC/C;wBACD,QAAQ,EAAE;4BACR,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,4BAA4B;yBAC1C;wBACD,YAAY,EAAE;4BACZ,IAAI,EAAE,OAAO;4BACb,WAAW,EAAE,iEAAiE;4BAC9E,KAAK,EAAE;gCACL,IAAI,EAAE,QAAQ;6BACf;yBACF;qBACF;oBACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;iBACjC;aACF;SACF;QACD,QAAQ,EAAE,CAAC,iBAAiB,EAAE,aAAa,EAAE,eAAe,CAAC;KAC9D;CACF,CAAC,CAAC"}
@@ -6,9 +6,9 @@ export const getCodegenSummaryDef = () => ({
6
6
  name: 'codegenSummary',
7
7
  description: 'This function is called with a summary of proposed updates.\n' +
8
8
  '- `explanation`: A general explanation of the planned code generation updates or reasoning for no code changes.\n' +
9
- '- `fileUpdates`: A list of proposed file updates that will be subject to subsequent code generation requests.\n' +
9
+ '- `fileUpdates`: A list of proposed file updates, including all affected files and dependencies.\n' +
10
10
  '- `contextPaths`: A list of file paths that make sense to use as context for code generation requests.\n' +
11
- 'It is critically important to adhere to the schema of parameters.',
11
+ 'It is critically important to adhere to the schema of parameters and include all relevant files.',
12
12
  parameters: {
13
13
  type: 'object',
14
14
  properties: {
@@ -1 +1 @@
1
- {"version":3,"file":"codegen-summary.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/codegen-summary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAgB,EAAE,CAAC,CAAC;IACtD,IAAI,EAAE,gBAAgB;IACtB,WAAW,EACT,+DAA+D;QAC/D,mHAAmH;QACnH,iHAAiH;QACjH,0GAA0G;QAC1G,mEAAmE;IACrE,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0FAA0F;aACxG;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,sFAAsF;gBACnG,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;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ACL,IAAI,EAAE,SAAS;4BACf,WAAW,EACT,4JAA4J;yBAC/J;wBACD,kBAAkB,EAAE;4BAClB,IAAI,EAAE,OAAO;4BACb,WAAW,EACT,8JAA8J;4BAChK,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;yBAC1B;qBACF;oBACD,QAAQ,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,gBAAgB,CAAC;iBACnD;aACF;YACD,YAAY,EAAE;gBACZ,IAAI,EAAE,OAAO;gBACb,WAAW,EACT,gLAAgL;gBAClL,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;QACD,QAAQ,EAAE,CAAC,aAAa,EAAE,aAAa,EAAE,cAAc,CAAC;KACzD;CACF,CAAC,CAAC"}
@@ -3,8 +3,38 @@
3
3
  */
4
4
  export const getSourceCode = {
5
5
  name: 'getSourceCode',
6
- description: 'This function returns source code of the application in Map format, where absolute file path is the key, and the value is an object, where one of the properties may be the content of the file.' +
7
- 'Some keys may not provide content. Some keys may provide a short summary of content. This function can be called only once during the conversation, and only if suggested by the user.',
6
+ description: `This function returns source code of the application in the following format:
7
+ \`\`\`
8
+ {
9
+ [directoryPath: string]: {
10
+ [filePath: string]: {content: string | null} | {summary: string};
11
+ };
12
+ }
13
+ \`\`\`
14
+
15
+ Some keys may not provide content. Some keys may provide a short summary of content.
16
+
17
+ Here is an example of the returned object:
18
+ \`\`\`
19
+ {
20
+ '/path/to/directory': {
21
+ 'file1.js': {content: 'console.log('Hello, World!');'},
22
+ },
23
+ '/path/to/directory/sub1/sub2': {
24
+ 'file2.js': {summary: 'This file contains a simple log statement.'},
25
+ }
26
+ }
27
+ \`\`\`
28
+
29
+ How to understand this object:
30
+ - there are 2 files
31
+ - the first file has content: 'console.log('Hello, World!');'
32
+ - the second file has no content, but a summary: 'This file contains a simple log statement.'
33
+ - path of first file: '/path/to/directory/file1.js'
34
+ - path of second file: '/path/to/directory/sub1/sub2/file2.js'
35
+
36
+ This function is used to provide context to the AI model.
37
+ `,
8
38
  parameters: {
9
39
  type: 'object',
10
40
  properties: {
@@ -1 +1 @@
1
- {"version":3,"file":"get-source-code.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/get-source-code.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAgB;IACxC,IAAI,EAAE,eAAe;IACrB,WAAW,EACT,kMAAkM;QAClM,wLAAwL;IAC1L,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,8EAA8E;gBAC3F,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;QACD,QAAQ,EAAE,EAAE;KACb;CACF,CAAC"}
1
+ {"version":3,"file":"get-source-code.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/get-source-code.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAgB;IACxC,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BV;IACH,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,8EAA8E;gBAC3F,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;QACD,QAAQ,EAAE,EAAE;KACb;CACF,CAAC"}
@@ -3,7 +3,39 @@
3
3
  */
4
4
  export const optimizeContext = {
5
5
  name: 'optimizeContext',
6
- description: 'This function narrows the context of code generation to a list of relevant files, including their estimated token counts and relevance scores. It helps prioritize files based on their importance to the user prompt and manages token usage.',
6
+ description: `This function helps prioritize files based on their importance to the user prompt.
7
+
8
+ Example:
9
+ 1. User prompt: "I want to add a new test to util unit tests."
10
+ 2. Assistant makes a function call for \`getSourceCode\` to get the source code.
11
+ 3. User provides the source code in \`getSourceCode\` function response:
12
+ \`\`\`
13
+ {
14
+ '/path/to/directory': {
15
+ 'something.js': ['console.log('Hello, World!');'],
16
+ },
17
+ '/path/to/directory/sub1/sub2': {
18
+ 'util-tests.js': [null, 'This file contains unit tests.'],
19
+ }
20
+ }
21
+ \`\`\`
22
+ 4. Assistant calls the \`optimizeContext\` function to narrow the context to relevant files:
23
+ \`\`\`
24
+ {
25
+ userPrompt: "I want to add a new test to util unit tests.",
26
+ optimizedContext: [
27
+ {
28
+ filePath: '/path/to/directory/sub1/sub2/util-tests.js',
29
+ relevance: 0.8,
30
+ },
31
+ {
32
+ filePath: '/path/to/directory/something.js',
33
+ relevance: 0.2,
34
+ }
35
+ ]
36
+ \`\`\`
37
+
38
+ This means that the file \`something.js\` file is less relevant to the user prompt, and \`util-tests.js\` is more relevant.`,
7
39
  parameters: {
8
40
  type: 'object',
9
41
  properties: {
@@ -27,21 +59,12 @@ export const optimizeContext = {
27
59
  minimum: 0,
28
60
  maximum: 1,
29
61
  },
30
- tokenCount: {
31
- type: 'integer',
32
- description: 'The estimated token count for the file content.',
33
- minimum: 0,
34
- },
35
62
  },
36
- required: ['filePath', 'relevance', 'tokenCount'],
63
+ required: ['filePath', 'relevance'],
37
64
  },
38
65
  },
39
- totalTokenCount: {
40
- type: 'number',
41
- description: 'The estimated token count for the entire context.',
42
- },
43
66
  },
44
- required: ['userPrompt', 'optimizedContext', 'totalTokenCount'],
67
+ required: ['userPrompt', 'optimizedContext'],
45
68
  },
46
69
  };
47
70
  //# sourceMappingURL=optimize-context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"optimize-context.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/optimize-context.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAgB;IAC1C,IAAI,EAAE,iBAAiB;IACvB,WAAW,EACT,gPAAgP;IAClP,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,6BAA6B;aAC3C;YACD,gBAAgB,EAAE;gBAChB,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,4FAA4F;gBACzG,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,QAAQ,EAAE;4BACR,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,4CAA4C;yBAC1D;wBACD,SAAS,EAAE;4BACT,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,8EAA8E;4BAC3F,OAAO,EAAE,CAAC;4BACV,OAAO,EAAE,CAAC;yBACX;wBACD,UAAU,EAAE;4BACV,IAAI,EAAE,SAAS;4BACf,WAAW,EAAE,iDAAiD;4BAC9D,OAAO,EAAE,CAAC;yBACX;qBACF;oBACD,QAAQ,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,YAAY,CAAC;iBAClD;aACF;YACD,eAAe,EAAE;gBACf,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mDAAmD;aACjE;SACF;QACD,QAAQ,EAAE,CAAC,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,CAAC;KAChE;CACF,CAAC"}
1
+ {"version":3,"file":"optimize-context.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/optimize-context.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAgB;IAC1C,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4HAgC6G;IAC1H,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,6BAA6B;aAC3C;YACD,gBAAgB,EAAE;gBAChB,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,4FAA4F;gBACzG,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,QAAQ,EAAE;4BACR,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,4CAA4C;yBAC1D;wBACD,SAAS,EAAE;4BACT,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,8EAA8E;4BAC3F,OAAO,EAAE,CAAC;4BACV,OAAO,EAAE,CAAC;yBACX;qBACF;oBACD,QAAQ,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;iBACpC;aACF;SACF;QACD,QAAQ,EAAE,CAAC,YAAY,EAAE,kBAAkB,CAAC;KAC7C;CACF,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import assert from 'node:assert';
2
2
  import { estimateTokenCount } from './token-estimator.js';
3
- const SYSTEM_PROMPT_LIMIT = 2800;
4
- const CODEGEN_PROMPT_LIMIT = 850;
3
+ const SYSTEM_PROMPT_LIMIT = 3500;
4
+ const CODEGEN_PROMPT_LIMIT = 1000;
5
5
  const SOURCE_CODE_LIMIT = 100000;
6
6
  function verifyPromptLimit(promptType, prompt, limit) {
7
7
  const tokenCount = estimateTokenCount(prompt);
@@ -1 +1 @@
1
- {"version":3,"file":"limits.js","sourceRoot":"","sources":["../../src/prompt/limits.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEjC,SAAS,iBAAiB,CAAC,UAAkB,EAAE,MAAc,EAAE,KAAa;IAC1E,MAAM,UAAU,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,GAAG,UAAU,kCAAkC,UAAU,EAAE,CAAC,CAAC;IACzE,MAAM,CAAC,UAAU,IAAI,KAAK,EAAE,yBAAyB,UAAU,MAAM,KAAK,EA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BAAoB,CAAC,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,UAAkB;IACtD,OAAO,iBAAiB,CAAC,YAAY,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAC;AACxE,CAAC"}
@@ -7,8 +7,8 @@ describe('Prompt Limits', () => {
7
7
  expect(() => verifySystemPromptLimit(validPrompt)).not.toThrow();
8
8
  });
9
9
  it('should throw for a prompt exceeding the limit', () => {
10
- const invalidPrompt = 'A '.repeat(5000);
11
- expect(() => verifySystemPromptLimit(invalidPrompt)).toThrow('Token limit exceeded: 3250 > 2800');
10
+ const invalidPrompt = 'A '.repeat(6000);
11
+ expect(() => verifySystemPromptLimit(invalidPrompt)).toThrow('Token limit exceeded: 3900 > 3500');
12
12
  });
13
13
  });
14
14
  describe('verifyCodegenPromptLimit', () => {
@@ -18,7 +18,7 @@ describe('Prompt Limits', () => {
18
18
  });
19
19
  it('should throw for a prompt exceeding the limit', () => {
20
20
  const invalidPrompt = 'B '.repeat(10000);
21
- expect(() => verifyCodegenPromptLimit(invalidPrompt)).toThrow('Token limit exceeded: 6500 > 850');
21
+ expect(() => verifyCodegenPromptLimit(invalidPrompt)).toThrow('Token limit exceeded: 6500 > 1000');
22
22
  });
23
23
  });
24
24
  describe('verifySourceCodeLimit', () => {
@@ -1 +1 @@
1
- {"version":3,"file":"limits.test.js","sourceRoot":"","sources":["../../src/prompt/limits.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEvG,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACvC,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;YACxD,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC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