@autobe/agent 0.24.2 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/lib/AutoBeAgent.js +11 -1
  2. package/lib/AutoBeAgent.js.map +1 -1
  3. package/lib/AutoBeMockAgent.js +1 -0
  4. package/lib/AutoBeMockAgent.js.map +1 -1
  5. package/lib/constants/AutoBeSystemPromptConstant.d.ts +21 -21
  6. package/lib/context/IAutoBeApplication.d.ts +101 -6
  7. package/lib/context/IAutoBeApplicationProps.d.ts +6 -2
  8. package/lib/factory/createAgenticaHistory.js +1 -1
  9. package/lib/factory/createAgenticaHistory.js.map +1 -1
  10. package/lib/factory/createAutoBeApplication.js +80 -90
  11. package/lib/factory/createAutoBeApplication.js.map +1 -1
  12. package/lib/factory/createAutoBeContext.js +6 -5
  13. package/lib/factory/createAutoBeContext.js.map +1 -1
  14. package/lib/index.mjs +3914 -2594
  15. package/lib/index.mjs.map +1 -1
  16. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +5 -1
  17. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
  18. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.d.ts +1 -1
  19. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +18 -3
  20. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  21. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +5 -1
  22. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +19 -7
  23. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  24. package/lib/orchestrate/analyze/orchestrateAnalyze.js +3 -2
  25. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  26. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.d.ts +1 -1
  27. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +2 -2
  28. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  29. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +1 -0
  30. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -2
  31. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  32. package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +1 -1
  33. package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
  34. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +36 -23
  35. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
  36. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.d.ts +22 -42
  37. package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
  38. package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
  39. package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js +2 -1
  40. package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
  41. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +5 -1
  42. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +20 -7
  43. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  44. package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.d.ts +3 -0
  45. package/lib/orchestrate/interface/histories/{transformInterfacePrerequisiteHistories.js → transformInterfaceCommonPrerequisiteHistories.js} +4 -4
  46. package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.js.map +1 -0
  47. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.d.ts +6 -1
  48. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +31 -23
  49. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  50. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.d.ts +6 -1
  51. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +22 -6
  52. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  53. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +1 -1
  54. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
  55. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.d.ts +4 -1
  56. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +27 -6
  57. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  58. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.d.ts +5 -1
  59. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +21 -5
  60. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  61. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +1 -1
  62. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  63. package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.d.ts +3 -0
  64. package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js +102 -0
  65. package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js.map +1 -0
  66. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +5 -1
  67. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +20 -4
  68. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  69. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
  70. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  71. package/lib/orchestrate/interface/orchestrateInterface.js +45 -11
  72. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  73. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +1 -1
  74. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +277 -37
  75. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  76. package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +4 -1
  77. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +69 -70
  78. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  79. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.d.ts +6 -1
  80. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +28 -13
  81. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  82. package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +4 -1
  83. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +11 -8
  84. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  85. package/lib/orchestrate/interface/orchestrateInterfaceOperations.d.ts +5 -1
  86. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +36 -21
  87. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  88. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +260 -29
  89. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  90. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.d.ts +5 -0
  91. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +713 -0
  92. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -0
  93. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.d.ts +5 -1
  94. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +83 -53
  95. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  96. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js +41 -7
  97. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
  98. package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +0 -38
  99. package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +6 -10
  100. package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.d.ts +52 -0
  101. package/lib/orchestrate/{common/structures/IAutoBeCommonCorrectDateApplication.js → interface/structures/IAutoBeInterfacePrerequisitesApplication.js} +1 -1
  102. package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.js.map +1 -0
  103. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +0 -33
  104. package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +6 -2
  105. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +105 -5
  106. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
  107. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +20 -1
  108. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
  109. package/lib/orchestrate/interface/utils/OperationValidator.d.ts +3 -4
  110. package/lib/orchestrate/interface/utils/OperationValidator.js +1 -1
  111. package/lib/orchestrate/interface/utils/OperationValidator.js.map +1 -1
  112. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.d.ts +4 -1
  113. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +19 -8
  114. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  115. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
  116. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  117. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.d.ts +6 -1
  118. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +20 -6
  119. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  120. package/lib/orchestrate/prisma/orchestratePrisma.js +3 -3
  121. package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  122. package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -1
  123. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +6 -3
  124. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  125. package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +1 -1
  126. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +12 -6
  127. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  128. package/lib/orchestrate/{common/histories/transformCommonCorrectDateHistories.d.ts → realize/histories/transformRealizeCorrectCastingHistories.d.ts} +1 -2
  129. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +32 -0
  130. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -0
  131. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +14 -22
  132. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  133. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +6 -6
  134. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +8 -2
  135. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  136. package/lib/orchestrate/realize/internal/compileRealizeFiles.js +1 -2
  137. package/lib/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
  138. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.d.ts +2 -1
  139. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js +119 -42
  140. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +1 -1
  141. package/lib/orchestrate/realize/orchestrateRealize.js +82 -52
  142. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  143. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +128 -88
  144. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  145. package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -1
  146. package/lib/orchestrate/realize/orchestrateRealizeWrite.js +117 -54
  147. package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  148. package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +52 -26
  149. package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +44 -34
  150. package/lib/orchestrate/realize/utils/InternalFileSystem.js +1 -1
  151. package/lib/orchestrate/realize/utils/InternalFileSystem.js.map +1 -1
  152. package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -5
  153. package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
  154. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +8 -3
  155. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +44 -17
  156. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
  157. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +4 -1
  158. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js +24 -9
  159. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -1
  160. package/lib/orchestrate/realize/utils/printErrorHints.d.ts +8 -0
  161. package/lib/orchestrate/realize/utils/printErrorHints.js +48 -0
  162. package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -0
  163. package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +1 -0
  164. package/lib/orchestrate/realize/utils/replaceImportStatements.js +93 -53
  165. package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  166. package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +5 -1
  167. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +11 -7
  168. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  169. package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +1 -1
  170. package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
  171. package/lib/orchestrate/test/histories/transformTestScenarioHistories.d.ts +7 -1
  172. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +35 -96
  173. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  174. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.d.ts +6 -3
  175. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +33 -77
  176. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
  177. package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +5 -1
  178. package/lib/orchestrate/test/histories/transformTestWriteHistories.js +111 -94
  179. package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  180. package/lib/orchestrate/test/orchestrateTest.js +20 -14
  181. package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
  182. package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +4 -1
  183. package/lib/orchestrate/test/orchestrateTestCorrect.js +81 -50
  184. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  185. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +31 -13
  186. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
  187. package/lib/orchestrate/test/orchestrateTestScenario.d.ts +1 -1
  188. package/lib/orchestrate/test/orchestrateTestScenario.js +18 -7
  189. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  190. package/lib/orchestrate/test/orchestrateTestScenarioReview.d.ts +5 -1
  191. package/lib/orchestrate/test/orchestrateTestScenarioReview.js +20 -12
  192. package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
  193. package/lib/orchestrate/test/orchestrateTestWrite.d.ts +4 -1
  194. package/lib/orchestrate/test/orchestrateTestWrite.js +46 -25
  195. package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  196. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +9 -5
  197. package/lib/orchestrate/test/structures/IAutoBeTestCorrectInvalidRequestApplication.d.ts +8 -2
  198. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +11 -7
  199. package/lib/orchestrate/test/utils/getPrerequisites.d.ts +5 -0
  200. package/lib/orchestrate/test/utils/getPrerequisites.js +36 -0
  201. package/lib/orchestrate/test/utils/getPrerequisites.js.map +1 -0
  202. package/lib/orchestrate/test/utils/getReferenceIds.js +1 -1
  203. package/lib/orchestrate/test/utils/getReferenceIds.js.map +1 -1
  204. package/package.json +5 -5
  205. package/src/AutoBeAgent.ts +17 -1
  206. package/src/AutoBeMockAgent.ts +1 -0
  207. package/src/constants/AutoBeSystemPromptConstant.ts +21 -21
  208. package/src/context/IAutoBeApplication.ts +101 -6
  209. package/src/context/IAutoBeApplicationProps.ts +6 -2
  210. package/src/factory/createAgenticaHistory.ts +11 -5
  211. package/src/factory/createAutoBeContext.ts +6 -5
  212. package/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts +5 -1
  213. package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +16 -0
  214. package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +22 -7
  215. package/src/orchestrate/analyze/orchestrateAnalyze.ts +3 -2
  216. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +2 -1
  217. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +3 -2
  218. package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +2 -2
  219. package/src/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.ts +25 -45
  220. package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +2 -1
  221. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +23 -9
  222. package/src/orchestrate/interface/histories/{transformInterfacePrerequisiteHistories.ts → transformInterfaceCommonPrerequisiteHistories.ts} +1 -1
  223. package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +33 -24
  224. package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +26 -9
  225. package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +30 -6
  226. package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +24 -7
  227. package/src/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.ts +118 -0
  228. package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +23 -6
  229. package/src/orchestrate/interface/orchestrateInterface.ts +65 -20
  230. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +22 -12
  231. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +34 -47
  232. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +40 -28
  233. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +9 -3
  234. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +51 -35
  235. package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +274 -0
  236. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +52 -33
  237. package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +1 -1
  238. package/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.ts +0 -39
  239. package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +6 -10
  240. package/src/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.ts +58 -0
  241. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +0 -34
  242. package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +92 -4
  243. package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +19 -1
  244. package/src/orchestrate/interface/utils/OperationValidator.ts +9 -7
  245. package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +20 -6
  246. package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +24 -9
  247. package/src/orchestrate/prisma/orchestratePrisma.ts +7 -3
  248. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +5 -1
  249. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +15 -10
  250. package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +44 -0
  251. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -24
  252. package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +6 -6
  253. package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +6 -4
  254. package/src/orchestrate/realize/internal/compileRealizeFiles.ts +1 -5
  255. package/src/orchestrate/realize/orchestRateRealizeCorrectCasting.ts +102 -16
  256. package/src/orchestrate/realize/orchestrateRealize.ts +121 -81
  257. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +50 -7
  258. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +14 -4
  259. package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +54 -29
  260. package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +46 -35
  261. package/src/orchestrate/realize/utils/InternalFileSystem.ts +1 -1
  262. package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -5
  263. package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +54 -22
  264. package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +28 -16
  265. package/src/orchestrate/realize/utils/printErrorHints.ts +55 -0
  266. package/src/orchestrate/realize/utils/replaceImportStatements.ts +99 -97
  267. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +14 -7
  268. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +50 -115
  269. package/src/orchestrate/test/histories/transformTestScenarioReviewHistories.ts +41 -111
  270. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +35 -12
  271. package/src/orchestrate/test/orchestrateTest.ts +19 -13
  272. package/src/orchestrate/test/orchestrateTestCorrect.ts +71 -51
  273. package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +13 -1
  274. package/src/orchestrate/test/orchestrateTestScenario.ts +27 -17
  275. package/src/orchestrate/test/orchestrateTestScenarioReview.ts +32 -19
  276. package/src/orchestrate/test/orchestrateTestWrite.ts +20 -10
  277. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +9 -228
  278. package/src/orchestrate/test/structures/IAutoBeTestCorrectInvalidRequestApplication.ts +8 -2
  279. package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +11 -78
  280. package/src/orchestrate/test/utils/getPrerequisites.ts +51 -0
  281. package/src/orchestrate/test/utils/getReferenceIds.ts +2 -1
  282. package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js +0 -48
  283. package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js.map +0 -1
  284. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.d.ts +0 -35
  285. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.js.map +0 -1
  286. package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.d.ts +0 -3
  287. package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js.map +0 -1
  288. package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.d.ts +0 -6
  289. package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js +0 -22
  290. package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js.map +0 -1
  291. package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.d.ts +0 -4
  292. package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js +0 -540
  293. package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js.map +0 -1
  294. package/src/orchestrate/common/histories/transformCommonCorrectDateHistories.ts +0 -60
  295. package/src/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.ts +0 -40
  296. package/src/orchestrate/interface/utils/OpenApiEndpointComparator.ts +0 -23
  297. package/src/orchestrate/realize/orchestrateRealizeCorrectDate.ts +0 -372
@@ -7,6 +7,7 @@ import {
7
7
  ILlmSchema,
8
8
  OpenApi,
9
9
  } from "@samchon/openapi";
10
+ import { Singleton } from "tstl";
10
11
  import typia from "typia";
11
12
  import { v7 } from "uuid";
12
13
 
@@ -19,8 +20,11 @@ export async function transformTestWriteHistories<
19
20
  Model extends ILlmSchema.Model,
20
21
  >(
21
22
  ctx: AutoBeContext<Model>,
22
- scenario: AutoBeTestScenario,
23
- artifacts: IAutoBeTestScenarioArtifacts,
23
+ props: {
24
+ instruction: string;
25
+ scenario: AutoBeTestScenario;
26
+ artifacts: IAutoBeTestScenarioArtifacts;
27
+ },
24
28
  ): Promise<
25
29
  Array<
26
30
  IAgenticaHistoryJson.ISystemMessage | IAgenticaHistoryJson.IAssistantMessage
@@ -31,10 +35,7 @@ export async function transformTestWriteHistories<
31
35
  id: v7(),
32
36
  created_at: new Date().toISOString(),
33
37
  type: "systemMessage",
34
- text: AutoBeSystemPromptConstant.TEST_WRITE.replace(
35
- "{{AutoBeTestScenario}}",
36
- JSON.stringify(typia.llm.parameters<AutoBeTestScenario, "llama">()),
37
- ),
38
+ text: systemPrompt.get(),
38
39
  },
39
40
  {
40
41
  id: v7(),
@@ -45,16 +46,31 @@ export async function transformTestWriteHistories<
45
46
 
46
47
  Make e2e test functions based on the following information.
47
48
 
49
+ ## Instructions
50
+
51
+ The following e2e-test-specific instructions were extracted by AI from
52
+ the user's requirements and conversations. These instructions focus
53
+ exclusively on test-related aspects such as test data generation strategies,
54
+ assertion patterns, error handling approaches, and specific validation logic
55
+ that should be implemented in the test code.
56
+
57
+ Apply these instructions when implementing the e2e test function to ensure
58
+ the test code aligns with the user's testing requirements and expectations.
59
+ If any instructions are not relevant to the target test scenario,
60
+ you may ignore them.
61
+
62
+ ${props.instruction}
63
+
48
64
  ## Function Name
49
65
 
50
- The e2e test function name must be ${JSON.stringify(scenario.functionName)}.
66
+ The e2e test function name must be ${JSON.stringify(props.scenario.functionName)}.
51
67
 
52
68
  ## Scenario Plan
53
69
 
54
70
  Here is the scenario plan what you have to implement.
55
71
 
56
72
  \`\`\`json
57
- ${JSON.stringify(scenario)}
73
+ ${JSON.stringify(props.scenario)}
58
74
  \`\`\`
59
75
 
60
76
  ## DTO Definitions
@@ -63,7 +79,7 @@ export async function transformTestWriteHistories<
63
79
 
64
80
  Never use the DTO definitions that are not listed here.
65
81
 
66
- ${transformTestWriteHistories.structures(artifacts)}
82
+ ${transformTestWriteHistories.structures(props.artifacts)}
67
83
 
68
84
  ## API (SDK) Functions
69
85
 
@@ -71,14 +87,14 @@ export async function transformTestWriteHistories<
71
87
 
72
88
  Never use the functions that are not listed here.
73
89
 
74
- ${transformTestWriteHistories.functional(artifacts)}
90
+ ${transformTestWriteHistories.functional(props.artifacts)}
75
91
 
76
92
  ## E2E Mockup Functions
77
93
 
78
94
  Just reference, and never follow this code as it is.
79
95
 
80
96
  \`\`\`json
81
- ${JSON.stringify(artifacts.e2e)}
97
+ ${JSON.stringify(props.artifacts.e2e)}
82
98
  \`\`\`
83
99
 
84
100
  ## External Definitions
@@ -103,7 +119,7 @@ export async function transformTestWriteHistories<
103
119
  make your implementation code in the import scope.
104
120
 
105
121
  \`\`\`typescript
106
- ${artifacts.template}
122
+ ${props.artifacts.template}
107
123
  \`\`\`
108
124
  `,
109
125
  },
@@ -144,3 +160,10 @@ export namespace transformTestWriteHistories {
144
160
  `;
145
161
  }
146
162
  }
163
+
164
+ const systemPrompt = new Singleton(() =>
165
+ AutoBeSystemPromptConstant.TEST_WRITE.replace(
166
+ "{{AutoBeTestScenario}}",
167
+ JSON.stringify(typia.llm.parameters<AutoBeTestScenario, "llama">()),
168
+ ),
169
+ );
@@ -38,7 +38,7 @@ export const orchestrateTest =
38
38
  type: "testStart",
39
39
  id: v7(),
40
40
  created_at: start.toISOString(),
41
- reason: props.reason,
41
+ reason: props.instruction,
42
42
  step: ctx.state().analyze?.step ?? 0,
43
43
  });
44
44
 
@@ -57,31 +57,37 @@ export const orchestrateTest =
57
57
  });
58
58
 
59
59
  // PLAN
60
- const scenarios: AutoBeTestScenario[] = await orchestrateTestScenario(ctx);
60
+ const scenarios: AutoBeTestScenario[] = await orchestrateTestScenario(
61
+ ctx,
62
+ props.instruction,
63
+ );
61
64
  if (scenarios.length === 0)
62
65
  throw new Error("No scenarios generated. Please check the logs.");
63
66
 
64
67
  // TEST CODE
65
- const written: IAutoBeTestWriteResult[] = await orchestrateTestWrite(
66
- ctx,
68
+ const written: IAutoBeTestWriteResult[] = await orchestrateTestWrite(ctx, {
69
+ instruction: props.instruction,
67
70
  scenarios,
68
- );
71
+ });
69
72
  if (written.length === 0)
70
73
  throw new Error("No test code written. Please check the logs.");
71
74
 
72
75
  const corrects: AutoBeTestValidateEvent[] = await orchestrateTestCorrect(
73
76
  ctx,
74
- written.map((w) => ({
75
- scenario: w.scenario,
76
- artifacts: w.artifacts,
77
- location: w.event.location,
78
- script: w.event.final ?? w.event.draft,
79
- })),
77
+ {
78
+ instruction: props.instruction,
79
+ functions: written.map((w) => ({
80
+ scenario: w.scenario,
81
+ artifacts: w.artifacts,
82
+ location: w.event.location,
83
+ script: w.event.final ?? w.event.draft,
84
+ })),
85
+ },
80
86
  );
81
87
 
82
88
  // DO COMPILE
83
89
  const compiler: IAutoBeCompiler = await ctx.compiler();
84
- const compiled: IAutoBeTypeScriptCompileResult =
90
+ const compileResult: IAutoBeTypeScriptCompileResult =
85
91
  await compiler.typescript.compile({
86
92
  files: Object.fromEntries([
87
93
  ...Object.entries(
@@ -97,7 +103,7 @@ export const orchestrateTest =
97
103
  id: v7(),
98
104
  created_at: new Date().toISOString(),
99
105
  files: corrects.map((s) => s.file),
100
- compiled,
106
+ compiled: compileResult,
101
107
  step: ctx.state().interface?.step ?? 0,
102
108
  elapsed: new Date().getTime() - start.getTime(),
103
109
  });
@@ -25,11 +25,14 @@ import { IAutoBeTestFunctionFailure } from "./structures/IAutoBeTestFunctionFail
25
25
 
26
26
  export const orchestrateTestCorrect = async <Model extends ILlmSchema.Model>(
27
27
  ctx: AutoBeContext<Model>,
28
- writeResults: IAutoBeTestFunction[],
28
+ props: {
29
+ instruction: string;
30
+ functions: IAutoBeTestFunction[];
31
+ },
29
32
  ): Promise<AutoBeTestValidateEvent[]> => {
30
33
  const result: Array<AutoBeTestValidateEvent | null> =
31
34
  await executeCachedBatch(
32
- writeResults.map((w) => async (promptCacheKey) => {
35
+ props.functions.map((w) => async (promptCacheKey) => {
33
36
  try {
34
37
  const compile = (script: string) =>
35
38
  compileTestFile(ctx, {
@@ -68,10 +71,13 @@ export const orchestrateTestCorrect = async <Model extends ILlmSchema.Model>(
68
71
  );
69
72
  return await predicate(
70
73
  ctx,
71
- transformTestValidateEvent(y, w.artifacts),
72
- [],
73
- y,
74
- promptCacheKey,
74
+ {
75
+ function: transformTestValidateEvent(y, w.artifacts),
76
+ failures: [],
77
+ validate: y,
78
+ promptCacheKey,
79
+ instruction: props.instruction,
80
+ },
75
81
  ctx.retry,
76
82
  );
77
83
  } catch {
@@ -110,44 +116,54 @@ const compileTestFile = async <Model extends ILlmSchema.Model>(
110
116
 
111
117
  const predicate = async <Model extends ILlmSchema.Model>(
112
118
  ctx: AutoBeContext<Model>,
113
- content: IAutoBeTestFunction,
114
- failures: IAutoBeTestFunctionFailure[],
115
- event: AutoBeTestValidateEvent,
116
- promptCacheKey: string,
119
+ props: {
120
+ function: IAutoBeTestFunction;
121
+ failures: IAutoBeTestFunctionFailure[];
122
+ validate: AutoBeTestValidateEvent;
123
+ promptCacheKey: string;
124
+ instruction: string;
125
+ },
117
126
  life: number,
118
127
  ): Promise<AutoBeTestValidateEvent> => {
119
- if (event.result.type === "failure") ctx.dispatch(event);
120
- return event.result.type === "failure"
121
- ? await correct(ctx, content, failures, event, promptCacheKey, life - 1)
122
- : event;
128
+ if (props.validate.result.type === "failure") ctx.dispatch(props.validate);
129
+ return props.validate.result.type === "failure"
130
+ ? await correct(ctx, props, life - 1)
131
+ : props.validate;
123
132
  };
124
133
 
125
134
  const correct = async <Model extends ILlmSchema.Model>(
126
135
  ctx: AutoBeContext<Model>,
127
- content: IAutoBeTestFunction,
128
- failures: IAutoBeTestFunctionFailure[],
129
- validate: AutoBeTestValidateEvent,
130
- promptCacheKey: string,
136
+ props: {
137
+ function: IAutoBeTestFunction;
138
+ failures: IAutoBeTestFunctionFailure[];
139
+ validate: AutoBeTestValidateEvent;
140
+ promptCacheKey: string;
141
+ instruction: string;
142
+ },
131
143
  life: number,
132
144
  ): Promise<AutoBeTestValidateEvent> => {
133
- if (validate.result.type !== "failure") return validate;
134
- else if (life < 0) return validate;
145
+ if (props.validate.result.type !== "failure") return props.validate;
146
+ else if (life < 0) return props.validate;
135
147
 
136
148
  const pointer: IPointer<IAutoBeTestCorrectApplication.IProps | null> = {
137
149
  value: null,
138
150
  };
139
151
  const { tokenUsage } = await ctx.conversate({
140
152
  source: "testCorrect",
141
- histories: await transformTestCorrectHistories(ctx, content, [
142
- ...failures,
143
- {
144
- function: content,
145
- failure: validate.result,
146
- },
147
- ]),
153
+ histories: await transformTestCorrectHistories(ctx, {
154
+ instruction: props.instruction,
155
+ function: props.function,
156
+ failures: [
157
+ ...props.failures,
158
+ {
159
+ function: props.function,
160
+ failure: props.validate.result,
161
+ },
162
+ ],
163
+ }),
148
164
  controller: createController({
149
165
  model: ctx.model,
150
- failure: validate.result,
166
+ failure: props.validate.result,
151
167
  build: (next) => {
152
168
  pointer.value = next;
153
169
  },
@@ -159,18 +175,19 @@ const correct = async <Model extends ILlmSchema.Model>(
159
175
  You don't need to explain me anything, but just fix it immediately
160
176
  without any hesitation, explanation, and questions.
161
177
  `,
162
- promptCacheKey,
178
+ promptCacheKey: props.promptCacheKey,
163
179
  });
164
180
  if (pointer.value === null) throw new Error("Failed to correct test code.");
165
181
 
166
- pointer.value.revise.final = await completeTestCode(
167
- ctx,
168
- content.artifacts,
169
- pointer.value.revise.final,
170
- );
182
+ if (pointer.value.revise.final)
183
+ pointer.value.revise.final = await completeTestCode(
184
+ ctx,
185
+ props.function.artifacts,
186
+ pointer.value.revise.final,
187
+ );
171
188
  pointer.value.draft = await completeTestCode(
172
189
  ctx,
173
- content.artifacts,
190
+ props.function.artifacts,
174
191
  pointer.value.draft,
175
192
  );
176
193
 
@@ -178,35 +195,38 @@ const correct = async <Model extends ILlmSchema.Model>(
178
195
  type: "testCorrect",
179
196
  id: v7(),
180
197
  created_at: new Date().toISOString(),
181
- file: validate.file,
182
- result: validate.result,
198
+ file: props.validate.file,
199
+ result: props.validate.result,
183
200
  tokenUsage,
184
201
  step: ctx.state().analyze?.step ?? 0,
185
202
  think: pointer.value.think,
186
203
  draft: pointer.value.draft,
187
204
  review: pointer.value.revise?.review,
188
- final: pointer.value.revise?.final,
205
+ final: pointer.value.revise?.final ?? undefined,
189
206
  } satisfies AutoBeTestCorrectEvent);
190
- const newContent: IAutoBeTestFunction = {
191
- ...content,
207
+ const newFunction: IAutoBeTestFunction = {
208
+ ...props.function,
192
209
  script: pointer.value.revise?.final ?? pointer.value.draft,
193
210
  };
194
211
  const newValidate: AutoBeTestValidateEvent = await compileTestFile(
195
212
  ctx,
196
- newContent,
213
+ newFunction,
197
214
  );
198
215
  return predicate(
199
216
  ctx,
200
- newContent,
201
- [
202
- ...failures,
203
- {
204
- function: content,
205
- failure: validate.result,
206
- },
207
- ],
208
- newValidate,
209
- promptCacheKey,
217
+ {
218
+ function: newFunction,
219
+ failures: [
220
+ ...props.failures,
221
+ {
222
+ function: props.function,
223
+ failure: props.validate.result,
224
+ },
225
+ ],
226
+ validate: newValidate,
227
+ promptCacheKey: props.promptCacheKey,
228
+ instruction: props.instruction,
229
+ },
210
230
  life,
211
231
  );
212
232
  };
@@ -10,6 +10,7 @@ import { v7 } from "uuid";
10
10
 
11
11
  import { AutoBeContext } from "../../context/AutoBeContext";
12
12
  import { assertSchemaModel } from "../../context/assertSchemaModel";
13
+ import { completeTestCode } from "./compile/completeTestCode";
13
14
  import { transformTestCorrectInvalidRequestHistories } from "./histories/transformTestCorrectInvalidRequestHistories";
14
15
  import { IAutoBeTestCorrectInvalidRequestApplication } from "./structures/IAutoBeTestCorrectInvalidRequestApplication";
15
16
  import { IAutoBeTestFunction } from "./structures/IAutoBeTestFunction";
@@ -82,6 +83,17 @@ const correct = async <Model extends ILlmSchema.Model>(
82
83
  if (pointer.value === null) throw new Error("Failed to correct test code.");
83
84
  else if (pointer.value === false) return event; // other's responsibility
84
85
 
86
+ if (pointer.value.revise.final)
87
+ pointer.value.revise.final = await completeTestCode(
88
+ ctx,
89
+ write.artifacts,
90
+ pointer.value.revise.final,
91
+ );
92
+ pointer.value.draft = await completeTestCode(
93
+ ctx,
94
+ write.artifacts,
95
+ pointer.value.draft,
96
+ );
85
97
  ctx.dispatch({
86
98
  type: "testCorrect",
87
99
  id: v7(),
@@ -97,7 +109,7 @@ const correct = async <Model extends ILlmSchema.Model>(
97
109
  think: pointer.value.think,
98
110
  draft: pointer.value.draft,
99
111
  review: pointer.value.revise?.review,
100
- final: pointer.value.revise?.final,
112
+ final: pointer.value.revise?.final ?? undefined,
101
113
  } satisfies AutoBeTestCorrectEvent);
102
114
  const newWrite: IAutoBeTestFunction = {
103
115
  artifacts: write.artifacts,
@@ -5,13 +5,18 @@ import {
5
5
  AutoBeProgressEventBase,
6
6
  AutoBeTestScenario,
7
7
  } from "@autobe/interface";
8
- import { AutoBeEndpointComparator, MapUtil, StringUtil } from "@autobe/utils";
8
+ import {
9
+ AutoBeOpenApiEndpointComparator,
10
+ MapUtil,
11
+ StringUtil,
12
+ } from "@autobe/utils";
9
13
  import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
10
14
  import { HashMap, IPointer, Pair } from "tstl";
11
15
  import typia from "typia";
12
16
  import { NamingConvention } from "typia/lib/utils/NamingConvention";
13
17
  import { v7 } from "uuid";
14
18
 
19
+ import { AutoBeConfigConstant } from "../../constants/AutoBeConfigConstant";
15
20
  import { AutoBeContext } from "../../context/AutoBeContext";
16
21
  import { assertSchemaModel } from "../../context/assertSchemaModel";
17
22
  import { divideArray } from "../../utils/divideArray";
@@ -23,6 +28,8 @@ import { IAutoBeTestScenarioAuthorizationRole } from "./structures/IAutoBeTestSc
23
28
 
24
29
  export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
25
30
  ctx: AutoBeContext<Model>,
31
+ instruction: string,
32
+ capacity: number = AutoBeConfigConstant.INTERFACE_CAPACITY,
26
33
  ): Promise<AutoBeTestScenario[]> {
27
34
  const document: AutoBeOpenApi.IDocument | undefined =
28
35
  ctx.state().interface?.document;
@@ -44,8 +51,8 @@ export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
44
51
  op,
45
52
  ),
46
53
  ),
47
- AutoBeEndpointComparator.hashCode,
48
- AutoBeEndpointComparator.equals,
54
+ AutoBeOpenApiEndpointComparator.hashCode,
55
+ AutoBeOpenApiEndpointComparator.equals,
49
56
  );
50
57
 
51
58
  const endpointNotFound: string = [
@@ -73,7 +80,7 @@ export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
73
80
  do {
74
81
  const matrix: AutoBeOpenApi.IOperation[][] = divideArray({
75
82
  array: include,
76
- capacity: 4,
83
+ capacity: capacity ?? AutoBeConfigConstant.INTERFACE_CAPACITY,
77
84
  });
78
85
  await executeCachedBatch(
79
86
  matrix.map((include) => async (promptCacheKey) => {
@@ -87,6 +94,7 @@ export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
87
94
  progress,
88
95
  reviewProgress,
89
96
  promptCacheKey,
97
+ instruction,
90
98
  })),
91
99
  );
92
100
  }),
@@ -129,6 +137,7 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
129
137
  progress: AutoBeProgressEventBase;
130
138
  reviewProgress: AutoBeProgressEventBase;
131
139
  promptCacheKey: string;
140
+ instruction: string;
132
141
  },
133
142
  ): Promise<IAutoBeTestScenarioApplication.IScenarioGroup[]> => {
134
143
  const pointer: IPointer<IAutoBeTestScenarioApplication.IScenarioGroup[]> = {
@@ -140,12 +149,13 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
140
149
  try {
141
150
  const { tokenUsage } = await ctx.conversate({
142
151
  source: "testScenarios",
143
- histories: transformTestScenarioHistories(
144
- ctx.state(),
145
- props.document,
146
- props.include,
147
- props.exclude,
148
- ),
152
+ histories: transformTestScenarioHistories({
153
+ state: ctx.state(),
154
+ document: props.document,
155
+ include: props.include,
156
+ exclude: props.exclude,
157
+ instruction: props.instruction,
158
+ }),
149
159
  controller: createController({
150
160
  model: ctx.model,
151
161
  endpointNotFound: props.endpointNotFound,
@@ -193,11 +203,11 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
193
203
  step: ctx.state().interface?.step ?? 0,
194
204
  created_at: new Date().toISOString(),
195
205
  });
196
- return await orchestrateTestScenarioReview(
197
- ctx,
198
- pointer.value,
199
- props.reviewProgress,
200
- );
206
+ return await orchestrateTestScenarioReview(ctx, {
207
+ instruction: props.instruction,
208
+ groups: pointer.value,
209
+ progress: props.reviewProgress,
210
+ });
201
211
  } catch {
202
212
  return [];
203
213
  }
@@ -401,8 +411,8 @@ const uniqueScenarioGroups = (
401
411
  ): IAutoBeTestScenarioApplication.IScenarioGroup[] =>
402
412
  new HashMap(
403
413
  groups.map((g) => new Pair(g.endpoint, g)),
404
- AutoBeEndpointComparator.hashCode,
405
- AutoBeEndpointComparator.equals,
414
+ AutoBeOpenApiEndpointComparator.hashCode,
415
+ AutoBeOpenApiEndpointComparator.equals,
406
416
  )
407
417
  .toJSON()
408
418
  .map((it) => it.second);
@@ -1,6 +1,6 @@
1
1
  import { IAgenticaController } from "@agentica/core";
2
2
  import { AutoBeProgressEventBase, AutoBeTestScenario } from "@autobe/interface";
3
- import { AutoBeEndpointComparator } from "@autobe/utils";
3
+ import { AutoBeOpenApiEndpointComparator } from "@autobe/utils";
4
4
  import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
5
5
  import { HashMap, IPointer, Pair } from "tstl";
6
6
  import typia from "typia";
@@ -16,21 +16,26 @@ export async function orchestrateTestScenarioReview<
16
16
  Model extends ILlmSchema.Model,
17
17
  >(
18
18
  ctx: AutoBeContext<Model>,
19
- groups: IAutoBeTestScenarioApplication.IScenarioGroup[],
20
- progress: AutoBeProgressEventBase,
19
+ props: {
20
+ instruction: string;
21
+ groups: IAutoBeTestScenarioApplication.IScenarioGroup[];
22
+ progress: AutoBeProgressEventBase;
23
+ },
21
24
  ): Promise<IAutoBeTestScenarioApplication.IScenarioGroup[]> {
22
25
  const res: IAutoBeTestScenarioApplication.IScenarioGroup[] = await review(
23
26
  ctx,
24
- groups,
25
- progress,
27
+ props,
26
28
  );
27
29
  return res;
28
30
  }
29
31
 
30
32
  async function review<Model extends ILlmSchema.Model>(
31
33
  ctx: AutoBeContext<Model>,
32
- groups: IAutoBeTestScenarioApplication.IScenarioGroup[],
33
- progress: AutoBeProgressEventBase,
34
+ props: {
35
+ instruction: string;
36
+ groups: IAutoBeTestScenarioApplication.IScenarioGroup[];
37
+ progress: AutoBeProgressEventBase;
38
+ },
34
39
  ): Promise<IAutoBeTestScenarioApplication.IScenarioGroup[]> {
35
40
  try {
36
41
  const pointer: IPointer<IAutoBeTestScenarioReviewApplication.IProps | null> =
@@ -42,9 +47,13 @@ async function review<Model extends ILlmSchema.Model>(
42
47
  controller: createController({
43
48
  model: ctx.model,
44
49
  pointer,
45
- originalGroups: groups,
50
+ originalGroups: props.groups,
51
+ }),
52
+ histories: transformTestScenarioReviewHistories({
53
+ state: ctx.state(),
54
+ groups: props.groups,
55
+ instruction: props.instruction,
46
56
  }),
47
- histories: transformTestScenarioReviewHistories(ctx, groups),
48
57
  enforceFunctionCall: true,
49
58
  message: "Review the Test Scenario.",
50
59
  });
@@ -53,17 +62,17 @@ async function review<Model extends ILlmSchema.Model>(
53
62
  throw new Error("Failed to get review result.");
54
63
  }
55
64
 
56
- progress.total = Math.max(
57
- progress.total,
58
- (progress.completed += pointer.value.scenarioGroups.length),
65
+ props.progress.total = Math.max(
66
+ props.progress.total,
67
+ (props.progress.completed += pointer.value.scenarioGroups.length),
59
68
  );
60
69
 
61
70
  ctx.dispatch({
62
71
  type: "testScenariosReview",
63
72
  id: v7(),
64
73
  tokenUsage,
65
- total: progress.total,
66
- completed: progress.completed,
74
+ total: props.progress.total,
75
+ completed: props.progress.completed,
67
76
  scenarios: pointer.value.scenarioGroups
68
77
  .map((group) => {
69
78
  return group.scenarios.map((s) => {
@@ -77,10 +86,14 @@ async function review<Model extends ILlmSchema.Model>(
77
86
  step: ctx.state().interface?.step ?? 0,
78
87
  created_at: new Date().toISOString(),
79
88
  });
80
- return pointer.value.scenarioGroups;
89
+ // @todo michael: need to investigate scenario removal more gracefully
90
+ return pointer.value.pass
91
+ ? // || pointer.value.scenarioGroups.length < props.groups.length
92
+ props.groups
93
+ : pointer.value.scenarioGroups;
81
94
  } catch {
82
- progress.completed += groups.length;
83
- return groups;
95
+ props.progress.completed += props.groups.length;
96
+ return props.groups;
84
97
  }
85
98
  }
86
99
 
@@ -159,8 +172,8 @@ const uniqueScenarioGroups = (
159
172
  ): IAutoBeTestScenarioApplication.IScenarioGroup[] =>
160
173
  new HashMap(
161
174
  groups.map((g) => new Pair(g.endpoint, g)),
162
- AutoBeEndpointComparator.hashCode,
163
- AutoBeEndpointComparator.equals,
175
+ AutoBeOpenApiEndpointComparator.hashCode,
176
+ AutoBeOpenApiEndpointComparator.equals,
164
177
  )
165
178
  .toJSON()
166
179
  .map((it) => it.second);