@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
@@ -4,119 +4,121 @@ import { ILlmSchema } from "@samchon/openapi";
4
4
  import { AutoBeContext } from "../../../context/AutoBeContext";
5
5
  import { getRealizeWriteImportStatements } from "./getRealizeWriteImportStatements";
6
6
 
7
- /**
8
- * Removes all import statements that LLM might have incorrectly added. This
9
- * includes standard library imports, auto-injected imports, and any API
10
- * structure imports with wrong paths.
11
- *
12
- * @param code - The code containing imports to remove
13
- * @param typeReferences - List of type names to specifically remove
14
- * @param decoratorType - Optional decorator type to remove
15
- * @returns Code with all imports removed
16
- */
17
- function removeAllImports(
18
- code: string,
19
- typeReferences: string[],
20
- decoratorType?: string,
21
- ): string {
22
- // Remove standard library and auto-injected imports
23
- let cleanedCode = code
24
- // MyGlobal - often with wrong path
25
- .replace(
26
- /import\s*{\s*MyGlobal\s*}\s*from\s*["']\.\.\/MyGlobal["']\s*;?\s*/gm,
27
- "",
28
- )
29
- // typia - various import patterns
30
- .replace(
31
- /import\s+typia\s*,\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm,
32
- "",
33
- )
34
- .replace(/import\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm, "")
35
- .replace(
36
- /import\s*{\s*tags\s*,\s*typia\s*}\s*from\s*["']typia["']\s*;?\s*/gm,
37
- "",
38
- )
39
- .replace(/import\s+typia\s*from\s*["']typia["']\s*;?\s*/gm, "")
40
- // Prisma client
41
- .replace(
42
- /import\s*{\s*Prisma\s*}\s*from\s*["']@prisma\/client["']\s*;?\s*/gm,
43
- "",
44
- )
45
- // uuid
46
- .replace(/import\s*{\s*v4\s*}\s*from\s*["']uuid["']\s*;?\s*/gm, "")
47
- // toISOStringSafe utility
48
- .replace(
49
- /import\s*{\s*toISOStringSafe\s*}\s*from\s*["']\.\.\/util\/toISOStringSafe["']\s*;?\s*/gm,
50
- "",
51
- )
52
- // JWT imports (if LLM adds them)
53
- .replace(/import\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm, "")
54
- .replace(
55
- /import\s*\*\s*as\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm,
56
- "",
57
- );
58
-
59
- // Remove API structure imports with wrong paths
60
- // Pattern 1: ../api/structures path (LLM often uses this wrong path)
61
- cleanedCode = cleanedCode.replace(
62
- /import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']\.\.\/api\/structures\/[^"']+["']\s*;?\s*/gm,
63
- "",
64
- );
65
- // Pattern 2: @ORGANIZATION/PROJECT-api path (correct path but LLM shouldn't write it)
66
- cleanedCode = cleanedCode.replace(
67
- /import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']@ORGANIZATION\/PROJECT-api\/lib\/structures\/[^"']+["']\s*;?\s*/gm,
68
- "",
69
- );
70
-
71
- // Remove specific type imports that match our typeReferences
72
- for (const ref of typeReferences) {
73
- const typeImportRegex = new RegExp(
74
- `import\\s*(?:type\\s*)?{\\s*${ref}\\s*}\\s*from\\s*["'][^"']+["']\\s*;?\\s*`,
75
- "gm",
76
- );
77
- cleanedCode = cleanedCode.replace(typeImportRegex, "");
78
- }
79
-
80
- // Remove decorator type imports if LLM mistakenly added them
81
- if (decoratorType) {
82
- const decoratorTypeRegex = new RegExp(
83
- `import\\s*(?:type\\s*)?{\\s*${decoratorType}\\s*}\\s*from\\s*["']\\.\\.\/decorators\/payload\/${decoratorType}["']\\s*;?\\s*`,
84
- "gm",
85
- );
86
- cleanedCode = cleanedCode.replace(decoratorTypeRegex, "");
87
- }
88
-
89
- return cleanedCode;
90
- }
7
+ // /**
8
+ // * Removes all import statements that LLM might have incorrectly added. This
9
+ // * includes standard library imports, auto-injected imports, and any API
10
+ // * structure imports with wrong paths.
11
+ // *
12
+ // * @param code - The code containing imports to remove
13
+ // * @param typeReferences - List of type names to specifically remove
14
+ // * @param decoratorType - Optional decorator type to remove
15
+ // * @returns Code with all imports removed
16
+ // */
17
+ // function removeAllImports(
18
+ // code: string,
19
+ // typeReferences: string[],
20
+ // decoratorType?: string,
21
+ // ): string {
22
+ // // Remove standard library and auto-injected imports
23
+ // let cleanedCode = code
24
+ // // MyGlobal - often with wrong path
25
+ // .replace(
26
+ // /import\s*{\s*MyGlobal\s*}\s*from\s*["']\.\.\/MyGlobal["']\s*;?\s*/gm,
27
+ // "",
28
+ // )
29
+ // // typia - various import patterns
30
+ // .replace(
31
+ // /import\s+typia\s*,\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm,
32
+ // "",
33
+ // )
34
+ // .replace(/import\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm, "")
35
+ // .replace(
36
+ // /import\s*{\s*tags\s*,\s*typia\s*}\s*from\s*["']typia["']\s*;?\s*/gm,
37
+ // "",
38
+ // )
39
+ // .replace(/import\s+typia\s*from\s*["']typia["']\s*;?\s*/gm, "")
40
+ // // Prisma client
41
+ // .replace(
42
+ // /import\s*{\s*Prisma\s*}\s*from\s*["']@prisma\/client["']\s*;?\s*/gm,
43
+ // "",
44
+ // )
45
+ // // uuid
46
+ // .replace(/import\s*{\s*v4\s*}\s*from\s*["']uuid["']\s*;?\s*/gm, "")
47
+ // // toISOStringSafe utility
48
+ // .replace(
49
+ // /import\s*{\s*toISOStringSafe\s*}\s*from\s*["']\.\.\/utils\/toISOStringSafe["']\s*;?\s*/gm,
50
+ // "",
51
+ // )
52
+ // // JWT imports (if LLM adds them)
53
+ // .replace(/import\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm, "")
54
+ // .replace(
55
+ // /import\s*\*\s*as\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm,
56
+ // "",
57
+ // )
58
+ // // NestJS HttpException
59
+ // .replace(
60
+ // /import\s*{\s*HttpException\s*}\s*from\s*["']@nestjs\/common["']\s*;?\s*/gm,
61
+ // "",
62
+ // );
63
+
64
+ // // Remove API structure imports with wrong paths
65
+ // // Pattern 1: ../api/structures path (LLM often uses this wrong path)
66
+ // cleanedCode = cleanedCode.replace(
67
+ // /import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']\.\.\/api\/structures\/[^"']+["']\s*;?\s*/gm,
68
+ // "",
69
+ // );
70
+ // // Pattern 2: @ORGANIZATION/PROJECT-api path (correct path but LLM shouldn't write it)
71
+ // cleanedCode = cleanedCode.replace(
72
+ // /import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']@ORGANIZATION\/PROJECT-api\/lib\/structures\/[^"']+["']\s*;?\s*/gm,
73
+ // "",
74
+ // );
75
+
76
+ // // Remove specific type imports that match our typeReferences
77
+ // for (const ref of typeReferences) {
78
+ // const typeImportRegex = new RegExp(
79
+ // `import\\s*(?:type\\s*)?{\\s*${ref}\\s*}\\s*from\\s*["'][^"']+["']\\s*;?\\s*`,
80
+ // "gm",
81
+ // );
82
+ // cleanedCode = cleanedCode.replace(typeImportRegex, "");
83
+ // }
84
+
85
+ // // Remove decorator type imports if LLM mistakenly added them
86
+ // if (decoratorType) {
87
+ // const decoratorTypeRegex = new RegExp(
88
+ // `import\\s*(?:type\\s*)?{\\s*${decoratorType}\\s*}\\s*from\\s*["']\\.\\.\/decorators\/payload\/${decoratorType}["']\\s*;?\\s*`,
89
+ // "gm",
90
+ // );
91
+ // cleanedCode = cleanedCode.replace(decoratorTypeRegex, "");
92
+ // }
93
+
94
+ // return cleanedCode;
95
+ // }
91
96
 
92
97
  export async function replaceImportStatements<Model extends ILlmSchema.Model>(
93
98
  ctx: AutoBeContext<Model>,
94
99
  props: {
95
100
  operation: AutoBeOpenApi.IOperation;
101
+ schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
96
102
  code: string;
97
103
  decoratorType?: string;
98
104
  },
99
- ) {
100
- let { operation, code, decoratorType } = props;
101
-
102
- // Extract type references from operation
103
- const typeReferences: string[] = Array.from(
104
- new Set(
105
- [operation.requestBody, operation.responseBody]
106
- .filter((el) => el !== null)
107
- .map((el) => el.typeName.split(".")[0]!),
108
- ),
109
- );
105
+ ): Promise<string> {
106
+ let { code, decoratorType } = props;
110
107
 
111
108
  // Beautify code first for consistent formatting
112
109
  const compiler: IAutoBeCompiler = await ctx.compiler();
113
110
  code = await compiler.typescript.beautify(code);
114
111
 
115
112
  // Remove all LLM-generated imports
116
- code = removeAllImports(code, typeReferences, decoratorType);
113
+ code = code
114
+ .split("\r\n")
115
+ .join("\n")
116
+ .split("\n")
117
+ .filter((str) => str.trim().startsWith("import") === false)
118
+ .join("\n");
117
119
 
118
120
  // Build the standard imports
119
- const imports = getRealizeWriteImportStatements(operation);
121
+ const imports = getRealizeWriteImportStatements(props);
120
122
 
121
123
  // Only add decoratorType import if it exists
122
124
  if (decoratorType) {
@@ -13,8 +13,11 @@ export const transformTestCorrectHistories = async <
13
13
  Model extends ILlmSchema.Model,
14
14
  >(
15
15
  ctx: AutoBeContext<Model>,
16
- func: IAutoBeTestFunction,
17
- failures: IAutoBeTestFunctionFailure[],
16
+ props: {
17
+ instruction: string;
18
+ function: IAutoBeTestFunction;
19
+ failures: IAutoBeTestFunctionFailure[];
20
+ },
18
21
  ): Promise<
19
22
  Array<
20
23
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
@@ -22,7 +25,11 @@ export const transformTestCorrectHistories = async <
22
25
  > => {
23
26
  const previous: Array<
24
27
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
25
- > = await transformTestWriteHistories(ctx, func.scenario, func.artifacts);
28
+ > = await transformTestWriteHistories(ctx, {
29
+ instruction: props.instruction,
30
+ scenario: props.function.scenario,
31
+ artifacts: props.function.artifacts,
32
+ });
26
33
  return [
27
34
  ...previous.slice(0, -1),
28
35
  {
@@ -32,21 +39,21 @@ export const transformTestCorrectHistories = async <
32
39
  text: AutoBeSystemPromptConstant.TEST_CORRECT,
33
40
  },
34
41
  previous.at(-1)!,
35
- ...failures.map(
42
+ ...props.failures.map(
36
43
  (f, i, array) =>
37
44
  ({
38
45
  id: v7(),
39
46
  created_at: new Date().toISOString(),
40
47
  type: "assistantMessage",
41
48
  text: StringUtil.trim`
42
- # ${i === array.length - 1 ? "Latest Failure" : "Previous Failure"}
43
- ## Generated TypeScript Code
49
+ ## ${i === array.length - 1 ? "Latest Failure" : "Previous Failure"}
50
+ ### Generated TypeScript Code
44
51
 
45
52
  \`\`\`typescript
46
53
  ${f.function.script}
47
54
  \`\`\`
48
55
 
49
- ## Compile Errors
56
+ ### Compile Errors
50
57
 
51
58
  Fix the compilation error in the provided code.
52
59
 
@@ -6,36 +6,21 @@ import { v7 } from "uuid";
6
6
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
7
7
  import { AutoBeState } from "../../../context/AutoBeState";
8
8
  import { IAutoBeTestScenarioAuthorizationRole } from "../structures/IAutoBeTestScenarioAuthorizationRole";
9
- import { getReferenceIds } from "../utils/getReferenceIds";
10
-
11
- export const transformTestScenarioHistories = (
12
- state: AutoBeState,
13
- document: AutoBeOpenApi.IDocument,
14
- include: AutoBeOpenApi.IOperation[],
15
- exclude: Pick<AutoBeOpenApi.IOperation, "method" | "path">[],
16
- ): Array<
9
+ import { getPrerequisites } from "../utils/getPrerequisites";
10
+
11
+ export const transformTestScenarioHistories = (props: {
12
+ state: AutoBeState;
13
+ document: AutoBeOpenApi.IDocument;
14
+ include: AutoBeOpenApi.IOperation[];
15
+ exclude: Pick<AutoBeOpenApi.IOperation, "method" | "path">[];
16
+ instruction: string;
17
+ }): Array<
17
18
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
18
19
  > => {
19
- interface IRelationship {
20
- endpoint: AutoBeOpenApi.IEndpoint;
21
- ids: string[];
22
- }
23
20
  const authorizations: AutoBeInterfaceAuthorization[] =
24
- state.interface?.authorizations ?? [];
21
+ props.state.interface?.authorizations ?? [];
25
22
  const authorizationRoles: Map<string, IAutoBeTestScenarioAuthorizationRole> =
26
23
  new Map();
27
- const relationships: IRelationship[] = document.operations
28
- .map((o) => ({
29
- endpoint: {
30
- method: o.method,
31
- path: o.path,
32
- },
33
- ids: getReferenceIds({
34
- document,
35
- operation: o,
36
- }),
37
- }))
38
- .filter((v) => v.ids.length !== 0);
39
24
 
40
25
  for (const authorization of authorizations) {
41
26
  for (const op of authorization.operations) {
@@ -66,7 +51,22 @@ export const transformTestScenarioHistories = (
66
51
  created_at: new Date().toISOString(),
67
52
  type: "assistantMessage",
68
53
  text: StringUtil.trim`
69
- # API Operations
54
+ ## Instructions
55
+
56
+ The following e2e-test-specific instructions were extracted by AI from
57
+ the user's requirements and conversations. These instructions focus
58
+ exclusively on test-related aspects such as test coverage priorities,
59
+ specific edge cases to validate, business logic verification strategies,
60
+ and critical user workflows that must be tested.
61
+
62
+ Apply these instructions when generating test scenarios to ensure the
63
+ tests align with the user's testing requirements and expectations.
64
+ If any instructions are not relevant to the target API operations,
65
+ you may ignore them.
66
+
67
+ ${props.instruction}
68
+
69
+ ## API Operations
70
70
 
71
71
  Below are the complete API operations.
72
72
  Use this information to understand capabilities and dependency relationships.
@@ -76,109 +76,44 @@ export const transformTestScenarioHistories = (
76
76
  You may write multiple scenarios for a single included endpoint.
77
77
  Focus on business-logic-oriented E2E flows rather than trivial CRUD.
78
78
 
79
- Please analyze the operations to identify all dependencies required for testing.
80
- Pay close attention to IDs and related values in the API,
81
- and ensure you identify all dependencies between endpoints.
82
-
83
79
  \`\`\`json
84
- ${JSON.stringify({ operations: document.operations })}
80
+ ${JSON.stringify({
81
+ operations: props.document.operations,
82
+ })}
85
83
  \`\`\`
86
- `,
87
- } satisfies IAgenticaHistoryJson.IAssistantMessage,
88
- {
89
- id: v7(),
90
- created_at: new Date().toISOString(),
91
- type: "assistantMessage",
92
- text: StringUtil.trim`
93
- # Included in Test Plan
84
+
85
+ ## Included in Test Plan
94
86
 
95
87
  Below are the endpoints that have been included in the test plan.
96
88
  Each endpoint shows its authentication requirements and related authentication APIs.
97
89
  When testing endpoints that require authentication, ensure you include the corresponding
98
90
  join/login operations in your test scenario to establish proper authentication context.
99
91
 
100
- Generate test scenarios only for these included endpoints. Do not create scenarios for excluded endpoints. Operations not listed here may be used only as dependencies.
101
-
102
- ${include
103
- .map((el, i) => {
104
- const roles = Array.from(authorizationRoles.values()).filter(
92
+ \`\`\`json
93
+ ${JSON.stringify(
94
+ props.include.map((el) => ({
95
+ ...el,
96
+ prerequisites: getPrerequisites({
97
+ document: props.document,
98
+ endpoint: el,
99
+ }),
100
+ authorizationRoles: Array.from(authorizationRoles.values()).filter(
105
101
  (role) => role.name === el.authorizationRole,
106
- );
107
-
108
- const requiredIds = getReferenceIds({ document, operation: el });
109
-
110
- return StringUtil.trim`
111
- ## ${i + 1}. ${el.method.toUpperCase()} ${el.path}
112
-
113
- Related Authentication APIs:
114
-
115
- ${
116
- roles.length > 0
117
- ? roles
118
- .map((role) => {
119
- return StringUtil.trim`
120
- - ${role.join?.method.toUpperCase()}: ${role.join?.path}
121
- - ${role.login?.method.toUpperCase()}: ${role.login?.path}
122
- `;
123
- })
124
- .join("\n")
125
- : "- None"
126
- }
127
-
128
- Required IDs:
129
-
130
- - ${
131
- requiredIds.length > 0
132
- ? requiredIds.map((id) => `\`${id}\``).join(", ")
133
- : "None"
134
- }
135
- `;
136
- })
137
- .join("\n")}
138
-
139
- # Excluded from Test Plan
102
+ ),
103
+ })),
104
+ )}
105
+ \`\`\`
106
+
107
+ ## Excluded from Test Plan
140
108
 
141
109
  These are the endpoints that have already been used in test codes generated as part of a plan group.
142
110
  These endpoints do not need to be tested again.
143
111
  However, it is allowed to reference or depend on these endpoints when writing test codes for other purposes.
144
112
 
145
- ${exclude
146
- .map((el) => `- ${el.method.toUpperCase()}: ${el.path}`)
147
- .join("\n")}
148
- `,
149
- } satisfies IAgenticaHistoryJson.IAssistantMessage,
150
- {
151
- id: v7(),
152
- created_at: new Date().toISOString(),
153
- type: "assistantMessage",
154
- text: StringUtil.trim`
155
- # Candidate Dependencies
156
-
157
- List of candidate dependencies extracted from path parameters and request bodies.
158
-
159
- Apply dependency resolution to the target endpoint from "Included in Test Plan" and to dependencies found recursively from it.
160
- For each required ID, locate the operation that creates the resource. Include the creator only if that operation exists in the provided operations list. Do not assume or invent operations. If no creator exists, treat the ID as an external or pre-existing input.
161
-
162
- Dependency resolution steps:
163
- 1. Starting from the target endpoint, collect required IDs.
164
- 2. For each ID, search for a creator operation (typically POST).
165
- 3. If found, add it to the dependency chain in execution order and repeat for its own required IDs.
166
- 4. Stop when no further creators exist or are needed.
167
-
168
- For each some_entity_id pattern, use the same approach: include a creator only when it is present in the operations list.
169
-
170
- Endpoint | Required IDs (MUST be created by other APIs)
171
- ---------|---------------------------------------------------
172
- ${relationships
173
- .map((r) =>
174
- [
175
- `\`${r.endpoint.method} ${r.endpoint.path}\``,
176
- r.ids.map((id) => `\`${id}\``).join(", "),
177
- ].join(" | "),
178
- )
179
- .join("\n")}
180
-
181
- Example: If an endpoint requires \`articleId\` and \`POST /articles\` exists, include it in dependencies
113
+ \`\`\`json
114
+ ${JSON.stringify(props.exclude)}
115
+ \`\`\`
116
+
182
117
  `,
183
118
  } satisfies IAgenticaHistoryJson.IAssistantMessage,
184
119
  ];
@@ -1,50 +1,35 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { AutoBeOpenApi } from "@autobe/interface";
3
3
  import { StringUtil } from "@autobe/utils";
4
- import { ILlmSchema } from "@samchon/openapi";
5
4
  import { v7 } from "uuid";
6
5
 
7
6
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
8
- import { AutoBeContext } from "../../../context/AutoBeContext";
7
+ import { AutoBeState } from "../../../context/AutoBeState";
9
8
  import { IAutoBeTestScenarioApplication } from "../structures/IAutoBeTestScenarioApplication";
10
- import { getReferenceIds } from "../utils/getReferenceIds";
9
+ import { getPrerequisites } from "../utils/getPrerequisites";
11
10
 
12
- export function transformTestScenarioReviewHistories<
13
- Model extends ILlmSchema.Model,
14
- >(
15
- ctx: AutoBeContext<Model>,
16
- groups: IAutoBeTestScenarioApplication.IScenarioGroup[],
17
- ): Array<
11
+ export function transformTestScenarioReviewHistories(props: {
12
+ state: AutoBeState;
13
+ instruction: string;
14
+ groups: IAutoBeTestScenarioApplication.IScenarioGroup[];
15
+ }): Array<
18
16
  IAgenticaHistoryJson.ISystemMessage | IAgenticaHistoryJson.IAssistantMessage
19
17
  > {
20
- interface IRelationship {
21
- endpoint: AutoBeOpenApi.IEndpoint;
22
- ids: string[];
23
- }
24
-
25
18
  const document: AutoBeOpenApi.IDocument | undefined =
26
- ctx.state().interface?.document;
27
-
19
+ props.state.interface?.document;
28
20
  if (document === undefined) {
29
21
  throw new Error(
30
22
  "Cannot review test scenarios because there are no operations.",
31
23
  );
32
24
  }
33
25
 
34
- const relationships: IRelationship[] = document.operations
35
- .map((o) => ({
36
- endpoint: {
37
- method: o.method,
38
- path: o.path,
39
- },
40
- ids: getReferenceIds({
41
- document,
42
- operation: o,
43
- }),
44
- }))
45
- .filter((v) => v.ids.length !== 0);
46
-
47
26
  return [
27
+ {
28
+ id: v7(),
29
+ created_at: new Date().toISOString(),
30
+ type: "systemMessage",
31
+ text: AutoBeSystemPromptConstant.TEST_SCENARIO,
32
+ },
48
33
  {
49
34
  id: v7(),
50
35
  created_at: new Date().toISOString(),
@@ -56,7 +41,22 @@ export function transformTestScenarioReviewHistories<
56
41
  created_at: new Date().toISOString(),
57
42
  type: "assistantMessage",
58
43
  text: StringUtil.trim`
59
- # Available API Operations for Reference
44
+ ## Instructions
45
+
46
+ The following e2e-test-specific instructions were extracted by AI from
47
+ the user's requirements and conversations. These instructions focus
48
+ exclusively on test-related aspects such as test coverage priorities,
49
+ specific edge cases to validate, business logic verification strategies,
50
+ and critical user workflows that must be tested.
51
+
52
+ Apply these instructions when reviewing test scenarios to ensure the
53
+ tests align with the user's testing requirements and expectations.
54
+ If any instructions are not relevant to the target API operations,
55
+ you may ignore them.
56
+
57
+ ${props.instruction}
58
+
59
+ ## Available API Operations for Reference
60
60
 
61
61
  Below are all available API operations and interface schemas for validation purposes.
62
62
  Match each operation with its corresponding schema.
@@ -64,93 +64,23 @@ export function transformTestScenarioReviewHistories<
64
64
  \`\`\`json
65
65
  ${JSON.stringify({ operations: document.operations })}
66
66
  \`\`\`
67
- `,
68
- },
69
- {
70
- id: v7(),
71
- created_at: new Date().toISOString(),
72
- type: "assistantMessage",
73
- text: StringUtil.trim`
74
67
 
75
- # Test Scenario Groups
68
+ ## Test Scenario Groups to Review
76
69
 
77
- Please review the following test scenario groups:
70
+ Each scenario group includes the target endpoint and its prerequisite endpoints.
78
71
 
79
- \`\`\`json
80
- ${JSON.stringify(
81
- groups.map((g) => {
82
- return {
72
+ \`\`\`json
73
+ ${JSON.stringify(
74
+ props.groups.map((g) => ({
83
75
  ...g,
84
- scenarios: g.scenarios.map((s) => {
85
- const requiredId: string[] = [];
86
-
87
- s.dependencies.forEach((dep) => {
88
- document.operations.forEach((op) => {
89
- if (
90
- g.endpoint.method === op.method &&
91
- g.endpoint.path === op.path
92
- ) {
93
- requiredId.push(
94
- ...getReferenceIds({ document, operation: op }),
95
- );
96
- }
97
-
98
- if (
99
- op.method === dep.endpoint.method &&
100
- op.path === dep.endpoint.path
101
- ) {
102
- requiredId.push(
103
- ...getReferenceIds({ document, operation: op }),
104
- );
105
- }
106
- });
107
- });
108
-
109
- return {
110
- ...s,
111
- requiredIds:
112
- requiredId.length > 0 ? Array.from(new Set(requiredId)) : [],
113
- };
76
+ prerequisites: getPrerequisites({
77
+ document,
78
+ endpoint: g.endpoint,
114
79
  }),
115
- };
116
- }),
117
- )}
118
- \`\`\`
80
+ })),
81
+ )}
82
+ \`\`\`
119
83
  `,
120
84
  },
121
- {
122
- id: v7(),
123
- created_at: new Date().toISOString(),
124
- type: "assistantMessage",
125
- text: StringUtil.trim`
126
- # Candidate Dependencies
127
-
128
- List of candidate dependencies extracted from path parameters and request bodies.
129
-
130
- Apply dependency resolution to the target endpoint from "Included in Test Plan" and to dependencies found recursively from it.
131
- For each required ID, locate the operation that creates the resource. Include the creator only if that operation exists in the provided operations list. Do not assume or invent operations. If no creator exists, treat the ID as an external or pre-existing input.
132
-
133
- Dependency resolution steps:
134
- 1. Starting from the target endpoint, collect required IDs.
135
- 2. For each ID, search for a creator operation (typically POST).
136
- 3. If found, add it to the dependency chain in execution order and repeat for its own required IDs.
137
- 4. Stop when no further creators exist or are needed.
138
-
139
- For each some_entity_id pattern, use the same approach: include a creator only when it is present in the operations list.
140
-
141
- Endpoint | Required IDs (MUST be created by other APIs)
142
- ---------|---------------------------------------------------
143
- ${relationships
144
- .map((r) =>
145
- [
146
- `\`${r.endpoint.method} ${r.endpoint.path}\``,
147
- r.ids.map((id) => `\`${id}\``).join(", "),
148
- ].join(" | "),
149
- )
150
- .join("\n")}
151
-
152
- Example: If an endpoint requires \`articleId\` and \`POST /articles\` exists, include it in dependencies
153
- `,
154
- } satisfies IAgenticaHistoryJson.IAssistantMessage,
155
85
  ];
156
86
  }