@autobe/agent 0.19.1 → 0.21.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 (259) hide show
  1. package/lib/agent/src/AutoBeAgent.js +3 -2
  2. package/lib/agent/src/AutoBeAgent.js.map +1 -1
  3. package/lib/agent/src/AutoBeMockAgent.js +4 -3
  4. package/lib/agent/src/AutoBeMockAgent.js.map +1 -1
  5. package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +12 -11
  6. package/lib/agent/src/constants/AutoBeSystemPromptConstant.js.map +1 -1
  7. package/lib/agent/src/context/AutoBeContext.d.ts +3 -2
  8. package/lib/agent/src/factory/consentFunctionCall.js +3 -2
  9. package/lib/agent/src/factory/consentFunctionCall.js.map +1 -1
  10. package/lib/agent/src/factory/createAutoBeContext.js +11 -6
  11. package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
  12. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.d.ts +6 -0
  13. package/lib/agent/src/orchestrate/analyze/histories/{transformAnalyzeReviewerHistories.js → transformAnalyzeReviewHistories.js} +24 -29
  14. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -0
  15. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +12 -9
  16. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  17. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +31 -29
  18. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  19. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js +19 -5
  20. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  21. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +7 -1
  22. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +9 -6
  23. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
  24. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +11 -9
  25. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  26. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +6 -4
  27. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +5 -1
  28. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  29. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js +45 -46
  30. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
  31. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +13 -13
  32. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  33. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +31 -30
  34. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  35. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +23 -22
  36. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  37. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
  38. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +33 -0
  39. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -0
  40. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
  41. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +27 -26
  42. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  43. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +13 -12
  44. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  45. package/lib/agent/src/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js +4 -4
  46. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +11 -10
  47. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  48. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +32 -31
  49. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  50. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +3 -1
  51. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
  52. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +28 -24
  53. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  54. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +2 -0
  55. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  56. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js +11 -5
  57. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  58. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
  59. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +365 -0
  60. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -0
  61. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js +2 -0
  62. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  63. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +80 -54
  64. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  65. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +1635 -1180
  66. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  67. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +30 -24
  68. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  69. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +2 -5
  70. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +178 -0
  71. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
  72. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
  73. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js +3 -0
  74. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js.map +1 -0
  75. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +38 -0
  76. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +78 -0
  77. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +54 -54
  78. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  79. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +18 -29
  80. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
  81. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +37 -34
  82. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  83. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +38 -25
  84. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  85. package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js +3 -1
  86. package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  87. package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js +2 -0
  88. package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  89. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +3 -0
  90. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  91. package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js +19 -9
  92. package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
  93. package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js +28 -21
  94. package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  95. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +24 -21
  96. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
  97. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +58 -56
  98. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  99. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +17 -13
  100. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  101. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +12 -3
  102. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
  103. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +35 -30
  104. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  105. package/lib/{orchestrate/realize/internal/compile.d.ts → agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts} +1 -1
  106. package/lib/agent/src/orchestrate/realize/internal/{compile.js → compileRealizeFiles.js} +6 -6
  107. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -0
  108. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +26 -12
  109. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
  110. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +9 -3
  111. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  112. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +3 -1
  113. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  114. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +2 -6
  115. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +12 -8
  116. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  117. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +0 -66
  118. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js +2 -2
  119. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
  120. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +3 -6
  121. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +25 -21
  122. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  123. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +2 -2
  124. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +7 -2
  125. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js +13 -10
  126. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
  127. package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js +1 -1
  128. package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
  129. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.d.ts +3 -1
  130. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +44 -27
  131. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  132. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +63 -60
  133. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  134. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
  135. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +118 -96
  136. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  137. package/lib/agent/src/orchestrate/test/orchestrateTest.js +6 -5
  138. package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
  139. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +17 -8
  140. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  141. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +30 -18
  142. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  143. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +18 -18
  144. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  145. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +2 -2
  146. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
  147. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +2 -2
  148. package/lib/agent/src/utils/executeCachedBatch.d.ts +1 -0
  149. package/lib/agent/src/utils/executeCachedBatch.js +23 -0
  150. package/lib/agent/src/utils/executeCachedBatch.js.map +1 -0
  151. package/lib/constants/AutoBeSystemPromptConstant.d.ts +12 -11
  152. package/lib/context/AutoBeContext.d.ts +3 -2
  153. package/lib/index.mjs +3265 -1702
  154. package/lib/index.mjs.map +1 -1
  155. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.d.ts +6 -0
  156. package/lib/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +7 -1
  157. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +6 -4
  158. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
  159. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
  160. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +2 -5
  161. package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
  162. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +38 -0
  163. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +78 -0
  164. package/lib/{agent/src/orchestrate/realize/internal/compile.d.ts → orchestrate/realize/internal/compileRealizeFiles.d.ts} +1 -1
  165. package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +2 -6
  166. package/lib/orchestrate/realize/orchestrateRealizeScenario.d.ts +0 -66
  167. package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +3 -6
  168. package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +2 -2
  169. package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +7 -2
  170. package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +3 -1
  171. package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
  172. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +2 -2
  173. package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
  174. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +2 -2
  175. package/lib/utils/executeCachedBatch.d.ts +1 -0
  176. package/package.json +7 -7
  177. package/src/AutoBeAgent.ts +4 -3
  178. package/src/AutoBeMockAgent.ts +5 -4
  179. package/src/constants/AutoBeSystemPromptConstant.ts +12 -11
  180. package/src/context/AutoBeContext.ts +3 -0
  181. package/src/factory/consentFunctionCall.ts +4 -3
  182. package/src/factory/createAutoBeContext.ts +11 -7
  183. package/src/orchestrate/analyze/histories/{transformAnalyzeReviewerHistories.ts → transformAnalyzeReviewHistories.ts} +23 -30
  184. package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +13 -10
  185. package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +60 -61
  186. package/src/orchestrate/analyze/orchestrateAnalyze.ts +20 -13
  187. package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +20 -9
  188. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +13 -11
  189. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +10 -5
  190. package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +47 -48
  191. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +14 -14
  192. package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +31 -30
  193. package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +20 -19
  194. package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +39 -0
  195. package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +3 -3
  196. package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +23 -22
  197. package/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.ts +12 -11
  198. package/src/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.ts +5 -5
  199. package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +11 -10
  200. package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +31 -30
  201. package/src/orchestrate/interface/orchestrateInterface.ts +4 -2
  202. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +36 -29
  203. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +2 -0
  204. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +18 -10
  205. package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +95 -0
  206. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +2 -0
  207. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +53 -50
  208. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +120 -10
  209. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +47 -23
  210. package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +85 -1
  211. package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.ts +65 -0
  212. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +39 -0
  213. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +82 -1
  214. package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +57 -55
  215. package/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.ts +19 -30
  216. package/src/orchestrate/prisma/histories/transformPrismaReviewHistories.ts +38 -35
  217. package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +36 -23
  218. package/src/orchestrate/prisma/orchestratePrisma.ts +4 -2
  219. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +2 -0
  220. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +3 -0
  221. package/src/orchestrate/prisma/orchestratePrismaReview.ts +26 -13
  222. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +25 -17
  223. package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +24 -21
  224. package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +42 -40
  225. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +17 -13
  226. package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +14 -5
  227. package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +35 -30
  228. package/src/orchestrate/realize/internal/{compile.ts → compileRealizeFiles.ts} +15 -11
  229. package/src/orchestrate/realize/orchestrateRealize.ts +59 -40
  230. package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +19 -10
  231. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +3 -0
  232. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +10 -10
  233. package/src/orchestrate/realize/orchestrateRealizeScenario.ts +7 -77
  234. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +24 -23
  235. package/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.ts +6 -2
  236. package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +10 -5
  237. package/src/orchestrate/test/compile/completeTestCode.ts +17 -13
  238. package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +2 -0
  239. package/src/orchestrate/test/experimental/transformTestCorrectHistories.ast +4 -4
  240. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +50 -37
  241. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +62 -57
  242. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +27 -7
  243. package/src/orchestrate/test/orchestrateTest.ts +7 -9
  244. package/src/orchestrate/test/orchestrateTestCorrect.ts +39 -25
  245. package/src/orchestrate/test/orchestrateTestScenario.ts +28 -21
  246. package/src/orchestrate/test/orchestrateTestWrite.ts +17 -18
  247. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +3 -3
  248. package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +28 -1
  249. package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +2 -2
  250. package/src/utils/executeCachedBatch.ts +15 -0
  251. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +0 -6
  252. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.js.map +0 -1
  253. package/lib/agent/src/orchestrate/realize/internal/compile.js.map +0 -1
  254. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
  255. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js +0 -74
  256. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js.map +0 -1
  257. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +0 -6
  258. package/lib/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
  259. package/src/orchestrate/test/histories/transformTestHistories.ts +0 -77
@@ -1,46 +1,59 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { IAutoBeTypeScriptCompileResult } from "@autobe/interface";
3
- import { v4 } from "uuid";
3
+ import { StringUtil } from "@autobe/utils";
4
+ import { ILlmSchema } from "@samchon/openapi";
5
+ import { v7 } from "uuid";
4
6
 
5
7
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
8
+ import { AutoBeContext } from "../../../context/AutoBeContext";
6
9
  import { IAutoBeTestFunction } from "../structures/IAutoBeTestFunction";
7
10
  import { transformTestWriteHistories } from "./transformTestWriteHistories";
8
11
 
9
- export const transformTestCorrectHistories = (
12
+ export const transformTestCorrectHistories = async <
13
+ Model extends ILlmSchema.Model,
14
+ >(
15
+ ctx: AutoBeContext<Model>,
10
16
  func: IAutoBeTestFunction,
11
17
  failure: IAutoBeTypeScriptCompileResult.IFailure,
12
- ): Array<
13
- IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
14
- > => [
15
- ...transformTestWriteHistories(func.scenario, func.artifacts),
16
- {
17
- id: v4(),
18
- created_at: new Date().toISOString(),
19
- type: "assistantMessage",
20
- text: [
21
- "## Generated TypeScript Code",
22
- "```typescript",
23
- func.script,
24
- "```",
25
- "",
26
- "## Compile Errors",
27
- "Fix the compilation error in the provided code.",
28
- "",
29
- "```json",
30
- JSON.stringify(failure.diagnostics),
31
- "```",
32
- ].join("\n"),
33
- },
34
- {
35
- id: v4(),
36
- created_at: new Date().toISOString(),
37
- type: "systemMessage",
38
- text: AutoBeSystemPromptConstant.TEST_CORRECT.replace(
39
- "{{API_DTO_SCHEMAS}}",
40
- transformTestWriteHistories.structures(func.artifacts),
41
- ).replace(
42
- "{{API_SDK_FUNCTIONS}}",
43
- transformTestWriteHistories.functional(func.artifacts),
44
- ),
45
- },
46
- ];
18
+ ): Promise<
19
+ Array<
20
+ IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
21
+ >
22
+ > => {
23
+ const previous = await transformTestWriteHistories(
24
+ ctx,
25
+ func.scenario,
26
+ func.artifacts,
27
+ );
28
+ return [
29
+ ...previous.slice(0, -1),
30
+ {
31
+ id: v7(),
32
+ created_at: new Date().toISOString(),
33
+ type: "systemMessage",
34
+ text: AutoBeSystemPromptConstant.TEST_CORRECT,
35
+ },
36
+ {
37
+ id: v7(),
38
+ created_at: new Date().toISOString(),
39
+ type: "assistantMessage",
40
+ text: StringUtil.trim`
41
+ ${previous.at(-1)!.text}
42
+
43
+ ## Generated TypeScript Code
44
+
45
+ \`\`\`typescript
46
+ ${func.script}
47
+ \`\`\`
48
+
49
+ ## Compile Errors
50
+
51
+ Fix the compilation error in the provided code.
52
+
53
+ \`\`\`json
54
+ ${JSON.stringify(failure.diagnostics)}
55
+ \`\`\`
56
+ `,
57
+ },
58
+ ];
59
+ };
@@ -1,7 +1,7 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { AutoBeInterfaceAuthorization, AutoBeOpenApi } from "@autobe/interface";
3
- import { MapUtil } from "@autobe/utils";
4
- import { v4 } from "uuid";
3
+ import { MapUtil, StringUtil } from "@autobe/utils";
4
+ import { v7 } from "uuid";
5
5
 
6
6
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
7
7
  import { AutoBeState } from "../../../context/AutoBeState";
@@ -40,82 +40,87 @@ export const transformTestScenarioHistories = (
40
40
 
41
41
  return [
42
42
  {
43
- id: v4(),
43
+ id: v7(),
44
44
  created_at: new Date().toISOString(),
45
45
  type: "systemMessage",
46
46
  text: AutoBeSystemPromptConstant.TEST_SCENARIO,
47
47
  } satisfies IAgenticaHistoryJson.ISystemMessage,
48
48
  {
49
- id: v4(),
49
+ id: v7(),
50
50
  created_at: new Date().toISOString(),
51
51
  type: "systemMessage",
52
- text: [
53
- "# Operations",
54
- "",
55
- "Below are the full operations. Please refer to this.",
56
- "Your role is to draft all test cases for each given Operation.",
57
- "It is also permissible to write multiple test codes on a single endpoint.",
58
- "However, rather than meaningless tests, business logic tests should be written and an E2E test situation should be assumed.",
59
- "",
60
- "Please carefully analyze each operation to identify all dependencies required for testing.",
61
- "For example, if you want to test liking and then deleting a post,",
62
- "you might think to test post creation, liking, and unlike operations.",
63
- "However, even if not explicitly mentioned, user registration or login are essential prerequisites.",
64
- "Pay close attention to IDs and related values in the API,",
65
- "and ensure you identify all dependencies between endpoints.",
66
- "",
67
- "```json",
68
- JSON.stringify(
52
+ text: StringUtil.trim`
53
+ # Operations
54
+
55
+ Below are the full operations. Please refer to this.
56
+ Your role is to draft all test cases for each given Operation.
57
+ It is also permissible to write multiple test codes on a single endpoint.
58
+ However, rather than meaningless tests, business logic tests should be written and an E2E test situation should be assumed.
59
+
60
+ Please carefully analyze each operation to identify all dependencies required for testing.
61
+ For example, if you want to test liking and then deleting a post,
62
+ you might think to test post creation, liking, and unlike operations.
63
+ However, even if not explicitly mentioned, user registration or login are essential prerequisites.
64
+ Pay close attention to IDs and related values in the API,
65
+ and ensure you identify all dependencies between endpoints.
66
+
67
+ \`\`\`json
68
+ ${JSON.stringify(
69
69
  entire.map((el) => ({
70
70
  ...el,
71
71
  specification: undefined,
72
72
  })),
73
- ),
74
- "```",
75
- ].join("\n"),
73
+ )}
74
+ \`\`\`
75
+ `,
76
76
  } satisfies IAgenticaHistoryJson.ISystemMessage,
77
77
  {
78
- id: v4(),
78
+ id: v7(),
79
79
  created_at: new Date().toISOString(),
80
80
  type: "systemMessage",
81
- text: [
82
- "# Included in Test Plan",
83
- "",
84
- "Below are the endpoints that have been included in the test plan.",
85
- "Each endpoint shows its authentication requirements and related authentication APIs.",
86
- "When testing endpoints that require authentication, ensure you include the corresponding join/login operations in your test scenario to establish proper authentication context.",
87
- "",
88
- include
81
+ text: StringUtil.trim`
82
+ # Included in Test Plan
83
+
84
+ Below are the endpoints that have been included in the test plan.
85
+ Each endpoint shows its authentication requirements and related authentication APIs.
86
+ When testing endpoints that require authentication, ensure you include the corresponding join/login operations in your test scenario to establish proper authentication context.
87
+
88
+ ${include
89
89
  .map((el, i) => {
90
90
  const roles = Array.from(authorizationRoles.values()).filter(
91
91
  (role) => role.name === el.authorizationRole,
92
92
  );
93
- return [
94
- `## ${i + 1}. ${el.method.toUpperCase()} ${el.path}`,
95
- "",
96
- "Related Authentication APIs:",
97
- "",
98
- roles.length > 0
99
- ? roles.map((role) => {
100
- return [
101
- `- ${role.join?.method.toUpperCase()}: ${role.join?.path}`,
102
- `- ${role.login?.method.toUpperCase()}: ${role.login?.path}`,
103
- ].join("\n");
104
- })
105
- : "- None",
106
- ];
93
+ return StringUtil.trim`
94
+ ## ${i + 1}. ${el.method.toUpperCase()} ${el.path}
95
+
96
+ Related Authentication APIs:
97
+
98
+ ${
99
+ roles.length > 0
100
+ ? roles
101
+ .map((role) => {
102
+ return StringUtil.trim`
103
+ - ${role.join?.method.toUpperCase()}: ${role.join?.path}
104
+ - ${role.login?.method.toUpperCase()}: ${role.login?.path}
105
+ `;
106
+ })
107
+ .join("\n")
108
+ : "- None"
109
+ }
110
+ `;
107
111
  })
108
- .join("\n"),
109
- "",
110
- "# Excluded from Test Plan",
111
- "",
112
- "These are the endpoints that have already been used in test codes generated as part of a plan group.",
113
- "These endpoints do not need to be tested again.",
114
- "However, it is allowed to reference or depend on these endpoints when writing test codes for other purposes.",
115
- exclude
112
+ .join("\n")}
113
+
114
+ # Excluded from Test Plan
115
+
116
+ These are the endpoints that have already been used in test codes generated as part of a plan group.
117
+ These endpoints do not need to be tested again.
118
+ However, it is allowed to reference or depend on these endpoints when writing test codes for other purposes.
119
+
120
+ ${exclude
116
121
  .map((el) => `- ${el.method.toUpperCase()}: ${el.path}`)
117
- .join("\n"),
118
- ].join("\n"),
122
+ .join("\n")}
123
+ `,
119
124
  } satisfies IAgenticaHistoryJson.ISystemMessage,
120
125
  ];
121
126
  };
@@ -4,37 +4,51 @@ import { StringUtil, transformOpenApiDocument } from "@autobe/utils";
4
4
  import {
5
5
  HttpMigration,
6
6
  IHttpMigrateApplication,
7
+ ILlmSchema,
7
8
  OpenApi,
8
9
  } from "@samchon/openapi";
9
10
  import typia from "typia";
10
- import { v4 } from "uuid";
11
+ import { v7 } from "uuid";
11
12
 
12
13
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
14
+ import { AutoBeContext } from "../../../context/AutoBeContext";
15
+ import { getTestExternalDeclarations } from "../compile/getTestExternalDeclarations";
13
16
  import { IAutoBeTestScenarioArtifacts } from "../structures/IAutoBeTestScenarioArtifacts";
14
17
 
15
- export function transformTestWriteHistories(
18
+ export async function transformTestWriteHistories<
19
+ Model extends ILlmSchema.Model,
20
+ >(
21
+ ctx: AutoBeContext<Model>,
16
22
  scenario: AutoBeTestScenario,
17
23
  artifacts: IAutoBeTestScenarioArtifacts,
18
- ): Array<IAgenticaHistoryJson.ISystemMessage> {
24
+ ): Promise<
25
+ Array<
26
+ IAgenticaHistoryJson.ISystemMessage | IAgenticaHistoryJson.IAssistantMessage
27
+ >
28
+ > {
19
29
  return [
20
30
  {
21
- id: v4(),
31
+ id: v7(),
22
32
  created_at: new Date().toISOString(),
23
33
  type: "systemMessage",
24
34
  text: AutoBeSystemPromptConstant.TEST_WRITE.replace(
25
35
  "{{AutoBeTestScenario}}",
26
36
  JSON.stringify(typia.llm.parameters<AutoBeTestScenario, "llama">()),
27
- ).replaceAll("{{FUNCTION_NAME}}", scenario.functionName),
37
+ ),
28
38
  },
29
39
  {
30
- id: v4(),
40
+ id: v7(),
31
41
  created_at: new Date().toISOString(),
32
- type: "systemMessage",
42
+ type: "assistantMessage",
33
43
  text: StringUtil.trim`
34
44
  Here is the list of input material composition.
35
45
 
36
46
  Make e2e test functions based on the following information.
37
47
 
48
+ ## Function Name
49
+
50
+ The e2e test function name must be ${JSON.stringify(scenario.functionName)}.
51
+
38
52
  ## Scenario Plan
39
53
 
40
54
  Here is the scenario plan what you have to implement.
@@ -66,6 +80,12 @@ export function transformTestWriteHistories(
66
80
  \`\`\`json
67
81
  ${JSON.stringify(artifacts.e2e)}
68
82
  \`\`\`
83
+
84
+ ## External Definitions
85
+
86
+ \`\`\`json
87
+ ${JSON.stringify(await getTestExternalDeclarations(ctx))}
88
+ \`\`\`
69
89
  `,
70
90
  },
71
91
  ];
@@ -8,7 +8,7 @@ import {
8
8
  IAutoBeTypeScriptCompileResult,
9
9
  } from "@autobe/interface";
10
10
  import { ILlmSchema } from "@samchon/openapi";
11
- import { v4 } from "uuid";
11
+ import { v7 } from "uuid";
12
12
 
13
13
  import { AutoBeContext } from "../../context/AutoBeContext";
14
14
  import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
@@ -29,13 +29,14 @@ export const orchestrateTest =
29
29
  if (predicate !== null)
30
30
  return ctx.assistantMessage({
31
31
  type: "assistantMessage",
32
- id: v4(),
32
+ id: v7(),
33
33
  created_at: start.toISOString(),
34
34
  text: predicate,
35
35
  completed_at: new Date().toISOString(),
36
36
  });
37
37
  ctx.dispatch({
38
38
  type: "testStart",
39
+ id: v7(),
39
40
  created_at: start.toISOString(),
40
41
  reason: props.reason,
41
42
  step: ctx.state().analyze?.step ?? 0,
@@ -46,7 +47,7 @@ export const orchestrateTest =
46
47
  ctx.state().interface?.document.operations ?? [];
47
48
  if (operations.length === 0)
48
49
  return ctx.assistantMessage({
49
- id: v4(),
50
+ id: v7(),
50
51
  type: "assistantMessage",
51
52
  created_at: start.toISOString(),
52
53
  completed_at: new Date().toISOString(),
@@ -63,14 +64,10 @@ export const orchestrateTest =
63
64
  ctx,
64
65
  scenarios,
65
66
  );
66
-
67
67
  const corrects: AutoBeTestValidateEvent[] = await orchestrateTestCorrect(
68
68
  ctx,
69
69
  written,
70
70
  );
71
- const success: AutoBeTestValidateEvent[] = corrects.filter(
72
- (c) => c.result.type === "success",
73
- );
74
71
 
75
72
  // DO COMPILE
76
73
  const compiler: IAutoBeCompiler = await ctx.compiler();
@@ -82,13 +79,14 @@ export const orchestrateTest =
82
79
  dbms: "sqlite",
83
80
  }),
84
81
  ).filter(([key]) => key.endsWith(".ts")),
85
- ...success.map((s) => [s.file.location, s.file.content]),
82
+ ...corrects.map((s) => [s.file.location, s.file.content]),
86
83
  ]),
87
84
  });
88
85
  return ctx.dispatch({
89
86
  type: "testComplete",
87
+ id: v7(),
90
88
  created_at: new Date().toISOString(),
91
- files: success.map((s) => s.file),
89
+ files: corrects.map((s) => s.file),
92
90
  compiled,
93
91
  step: ctx.state().interface?.step ?? 0,
94
92
  elapsed: new Date().getTime() - start.getTime(),
@@ -4,12 +4,15 @@ import {
4
4
  IAutoBeCompiler,
5
5
  IAutoBeTypeScriptCompileResult,
6
6
  } from "@autobe/interface";
7
+ import { StringUtil } from "@autobe/utils";
7
8
  import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
8
9
  import { IPointer } from "tstl";
9
10
  import typia from "typia";
11
+ import { v7 } from "uuid";
10
12
 
11
13
  import { AutoBeContext } from "../../context/AutoBeContext";
12
14
  import { assertSchemaModel } from "../../context/assertSchemaModel";
15
+ import { executeCachedBatch } from "../../utils/executeCachedBatch";
13
16
  import { completeTestCode } from "./compile/completeTestCode";
14
17
  import { transformTestCorrectHistories } from "./histories/transformTestCorrectHistories";
15
18
  import { IAutoBeTestCorrectApplication } from "./structures/IAutoBeTestCorrectApplication";
@@ -22,31 +25,32 @@ export const orchestrateTestCorrect = async <Model extends ILlmSchema.Model>(
22
25
  writeResult: IAutoBeTestWriteResult[],
23
26
  life: number = 4,
24
27
  ): Promise<AutoBeTestValidateEvent[]> => {
25
- const result: Array<AutoBeTestValidateEvent | null> = await Promise.all(
26
- writeResult.map(async (w) => {
27
- try {
28
- const event: AutoBeTestValidateEvent = await compile(ctx, {
29
- artifacts: w.artifacts,
30
- scenario: w.scenario,
31
- location: w.event.location,
32
- script: w.event.final,
33
- });
34
- return predicate(
35
- ctx,
36
- {
28
+ const result: Array<AutoBeTestValidateEvent | null> =
29
+ await executeCachedBatch(
30
+ writeResult.map((w) => async () => {
31
+ try {
32
+ const event: AutoBeTestValidateEvent = await compile(ctx, {
37
33
  artifacts: w.artifacts,
38
34
  scenario: w.scenario,
39
35
  location: w.event.location,
40
36
  script: w.event.final,
41
- },
42
- event,
43
- life,
44
- );
45
- } catch {
46
- return null;
47
- }
48
- }),
49
- );
37
+ });
38
+ return await predicate(
39
+ ctx,
40
+ {
41
+ artifacts: w.artifacts,
42
+ scenario: w.scenario,
43
+ location: w.event.location,
44
+ script: w.event.final,
45
+ },
46
+ event,
47
+ life,
48
+ );
49
+ } catch {
50
+ return null;
51
+ }
52
+ }),
53
+ );
50
54
  return result.filter((r) => r !== null);
51
55
  };
52
56
 
@@ -64,6 +68,7 @@ const compile = async <Model extends ILlmSchema.Model>(
64
68
  });
65
69
  return {
66
70
  type: "testValidate",
71
+ id: v7(),
67
72
  file: {
68
73
  scenario: func.scenario,
69
74
  location: func.location,
@@ -83,7 +88,7 @@ const predicate = async <Model extends ILlmSchema.Model>(
83
88
  ): Promise<AutoBeTestValidateEvent> => {
84
89
  if (event.result.type === "failure") ctx.dispatch(event);
85
90
  return event.result.type === "failure"
86
- ? correct(ctx, content, event, life - 1)
91
+ ? await correct(ctx, content, event, life - 1)
87
92
  : event;
88
93
  };
89
94
 
@@ -101,7 +106,11 @@ const correct = async <Model extends ILlmSchema.Model>(
101
106
  };
102
107
  const { tokenUsage } = await ctx.conversate({
103
108
  source: "testCorrect",
104
- histories: transformTestCorrectHistories(content, validate.result),
109
+ histories: await transformTestCorrectHistories(
110
+ ctx,
111
+ content,
112
+ validate.result,
113
+ ),
105
114
  controller: createController({
106
115
  model: ctx.model,
107
116
  artifacts: content.artifacts,
@@ -110,8 +119,12 @@ const correct = async <Model extends ILlmSchema.Model>(
110
119
  },
111
120
  }),
112
121
  enforceFunctionCall: true,
113
- message:
114
- "Fix the `AutoBeTest.IFunction` data to resolve the compilation error.",
122
+ message: StringUtil.trim`
123
+ Fix the AutoBeTest.IFunction data to resolve the compilation error.
124
+
125
+ You don't need to explain me anything, but just fix it immediately
126
+ without any hesitation, explanation, and questions.
127
+ `,
115
128
  });
116
129
  if (pointer.value === null) throw new Error("Failed to modify test code.");
117
130
 
@@ -120,6 +133,7 @@ const correct = async <Model extends ILlmSchema.Model>(
120
133
 
121
134
  ctx.dispatch({
122
135
  type: "testCorrect",
136
+ id: v7(),
123
137
  created_at: new Date().toISOString(),
124
138
  file: validate.file,
125
139
  result: validate.result,
@@ -9,10 +9,12 @@ import { AutoBeEndpointComparator, MapUtil, StringUtil } from "@autobe/utils";
9
9
  import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
10
10
  import { HashMap, IPointer, Pair } from "tstl";
11
11
  import typia from "typia";
12
+ import { v7 } from "uuid";
12
13
 
13
14
  import { AutoBeContext } from "../../context/AutoBeContext";
14
15
  import { assertSchemaModel } from "../../context/assertSchemaModel";
15
16
  import { divideArray } from "../../utils/divideArray";
17
+ import { executeCachedBatch } from "../../utils/executeCachedBatch";
16
18
  import { transformTestScenarioHistories } from "./histories/transformTestScenarioHistories";
17
19
  import { IAutoBeTestScenarioApplication } from "./structures/IAutoBeTestScenarioApplication";
18
20
  import { IAutoBeTestScenarioAuthorizationRole } from "./structures/IAutoBeTestScenarioAuthorizationRole";
@@ -64,18 +66,18 @@ export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
64
66
  array: include,
65
67
  capacity: 5,
66
68
  });
67
- await Promise.all(
68
- matrix.map(async (include) => {
69
+ await executeCachedBatch(
70
+ matrix.map((include) => async (promptCacheKey) => {
69
71
  exclude.push(
70
- ...(await divideAndConquer(
71
- ctx,
72
+ ...(await divideAndConquer(ctx, {
72
73
  dict,
73
74
  endpointNotFound,
74
- operations,
75
+ entire: operations,
75
76
  include,
76
- exclude.map((x) => x.endpoint),
77
+ exclude: exclude.map((x) => x.endpoint),
77
78
  progress,
78
- )),
79
+ promptCacheKey,
80
+ })),
79
81
  );
80
82
  }),
81
83
  );
@@ -106,13 +108,16 @@ export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
106
108
 
107
109
  const divideAndConquer = async <Model extends ILlmSchema.Model>(
108
110
  ctx: AutoBeContext<Model>,
109
- dict: HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IOperation>,
110
- endpointNotFound: string,
111
- entire: AutoBeOpenApi.IOperation[],
112
- include: AutoBeOpenApi.IOperation[],
113
- exclude: AutoBeOpenApi.IEndpoint[],
114
- progress: AutoBeProgressEventBase,
115
- ) => {
111
+ props: {
112
+ dict: HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IOperation>;
113
+ endpointNotFound: string;
114
+ entire: AutoBeOpenApi.IOperation[];
115
+ include: AutoBeOpenApi.IOperation[];
116
+ exclude: AutoBeOpenApi.IEndpoint[];
117
+ progress: AutoBeProgressEventBase;
118
+ promptCacheKey: string;
119
+ },
120
+ ): Promise<IAutoBeTestScenarioApplication.IScenarioGroup[]> => {
116
121
  const pointer: IPointer<IAutoBeTestScenarioApplication.IScenarioGroup[]> = {
117
122
  value: [],
118
123
  };
@@ -124,14 +129,14 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
124
129
  source: "testScenarios",
125
130
  histories: transformTestScenarioHistories(
126
131
  ctx.state(),
127
- entire,
128
- include,
129
- exclude,
132
+ props.entire,
133
+ props.include,
134
+ props.exclude,
130
135
  ),
131
136
  controller: createController({
132
137
  model: ctx.model,
133
- endpointNotFound,
134
- dict,
138
+ endpointNotFound: props.endpointNotFound,
139
+ dict: props.dict,
135
140
  authorizations,
136
141
  build: (next) => {
137
142
  pointer.value ??= [];
@@ -139,11 +144,13 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
139
144
  },
140
145
  }),
141
146
  enforceFunctionCall: true,
147
+ promptCacheKey: props.promptCacheKey,
142
148
  message: `Create e2e test scenarios.`,
143
149
  });
144
150
  if (pointer.value.length === 0) return [];
145
151
  ctx.dispatch({
146
152
  type: "testScenarios",
153
+ id: v7(),
147
154
  tokenUsage,
148
155
  scenarios: pointer.value
149
156
  .map((v) =>
@@ -158,8 +165,8 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
158
165
  ),
159
166
  )
160
167
  .flat(),
161
- completed: ++progress.completed,
162
- total: progress.total,
168
+ completed: ++props.progress.completed,
169
+ total: props.progress.total,
163
170
  step: ctx.state().interface?.step ?? 0,
164
171
  created_at: new Date().toISOString(),
165
172
  });