@autobe/agent 0.18.0 → 0.19.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 (281) hide show
  1. package/lib/AutoBeMockAgent.d.ts +2 -10
  2. package/lib/agent/src/AutoBeAgent.js +5 -0
  3. package/lib/agent/src/AutoBeAgent.js.map +1 -1
  4. package/lib/agent/src/AutoBeMockAgent.d.ts +2 -10
  5. package/lib/agent/src/AutoBeMockAgent.js +7 -2
  6. package/lib/agent/src/AutoBeMockAgent.js.map +1 -1
  7. package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +23 -29
  8. package/lib/agent/src/constants/AutoBeSystemPromptConstant.js.map +1 -1
  9. package/lib/agent/src/context/AutoBeTokenUsageComponent.d.ts +1 -0
  10. package/lib/agent/src/context/AutoBeTokenUsageComponent.js +14 -0
  11. package/lib/agent/src/context/AutoBeTokenUsageComponent.js.map +1 -1
  12. package/lib/agent/src/factory/consentFunctionCall.d.ts +10 -0
  13. package/lib/agent/src/factory/consentFunctionCall.js +212 -0
  14. package/lib/agent/src/factory/consentFunctionCall.js.map +1 -0
  15. package/lib/agent/src/factory/createAgenticaHistory.js +1 -0
  16. package/lib/agent/src/factory/createAgenticaHistory.js.map +1 -1
  17. package/lib/agent/src/factory/createAutoBeContext.js +71 -14
  18. package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
  19. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +3 -1
  20. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.js +4 -4
  21. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.js.map +1 -1
  22. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +1 -1
  23. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +3 -1
  24. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +16 -4
  25. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  26. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js +8 -3
  27. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  28. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +2 -3
  29. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +7 -7
  30. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
  31. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +24 -37
  32. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  33. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +5 -3
  34. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  35. package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +16 -16
  36. package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +5 -5
  37. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js +1 -0
  38. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
  39. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +1 -1
  40. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  41. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
  42. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  43. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +2 -10
  44. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  45. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
  46. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  47. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
  48. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  49. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +3 -3
  50. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  51. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
  52. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  53. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +9 -3
  54. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  55. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +29 -9
  56. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
  57. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +2 -2
  58. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +1565 -1142
  59. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  60. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +22 -4
  61. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  62. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
  63. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js +11 -15
  64. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  65. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +32 -26
  66. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  67. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.d.ts +2 -3
  68. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +135 -124
  69. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  70. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +371 -209
  71. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  72. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +185 -179
  73. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
  74. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +38 -0
  75. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +16 -16
  76. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +59 -14
  77. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +37 -1
  78. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +46 -14
  79. package/lib/agent/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +18 -24
  80. package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.d.ts +7 -0
  81. package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js +35 -0
  82. package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js.map +1 -0
  83. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +11 -17
  84. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  85. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +1 -1
  86. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
  87. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +2 -2
  88. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  89. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
  90. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  91. package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js +13 -4
  92. package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  93. package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -2
  94. package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js +6 -10
  95. package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  96. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +35 -2
  97. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  98. package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js +44 -3
  99. package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
  100. package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js +40 -3
  101. package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  102. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +2 -2
  103. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
  104. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +5 -5
  105. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  106. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +1 -0
  107. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +2 -2
  108. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  109. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +3 -0
  110. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +278 -0
  111. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -0
  112. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -2
  113. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +12 -20
  114. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  115. package/lib/agent/src/orchestrate/realize/internal/compile.d.ts +3 -3
  116. package/lib/agent/src/orchestrate/realize/internal/compile.js +9 -26
  117. package/lib/agent/src/orchestrate/realize/internal/compile.js.map +1 -1
  118. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +59 -42
  119. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
  120. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +6 -6
  121. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  122. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +6 -6
  123. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +8 -1
  124. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +17 -16
  125. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  126. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +6 -1
  127. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +24 -19
  128. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  129. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
  130. package/lib/agent/src/orchestrate/realize/structures/{IAutoBeRealizeCoderApplication.js → IAutoBeRealizeCorrectApplication.js} +1 -1
  131. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.js.map +1 -0
  132. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +19 -16
  133. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js +5 -1
  134. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  135. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +1 -1
  136. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  137. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.d.ts +2 -1
  138. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +95 -50
  139. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  140. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +1 -1
  141. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  142. package/lib/agent/src/orchestrate/test/orchestrateTest.js +12 -0
  143. package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
  144. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +4 -4
  145. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +119 -16
  146. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  147. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  148. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +6 -5
  149. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +1 -1
  150. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.d.ts +6 -0
  151. package/lib/agent/src/orchestrate/{internal/IProgress.js → test/structures/IAutoBeTestScenarioAuthorizationRole.js} +1 -1
  152. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.js.map +1 -0
  153. package/lib/agent/src/utils/predicateStateMessage.d.ts +4 -0
  154. package/lib/agent/src/utils/predicateStateMessage.js +87 -0
  155. package/lib/agent/src/utils/predicateStateMessage.js.map +1 -0
  156. package/lib/constants/AutoBeSystemPromptConstant.d.ts +23 -29
  157. package/lib/context/AutoBeTokenUsageComponent.d.ts +1 -0
  158. package/lib/factory/consentFunctionCall.d.ts +10 -0
  159. package/lib/index.mjs +3036 -1648
  160. package/lib/index.mjs.map +1 -1
  161. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +3 -1
  162. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +3 -1
  163. package/lib/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +2 -3
  164. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +16 -16
  165. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +5 -5
  166. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +2 -2
  167. package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
  168. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.d.ts +2 -3
  169. package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +38 -0
  170. package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +16 -16
  171. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +59 -14
  172. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +37 -1
  173. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +46 -14
  174. package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +18 -24
  175. package/lib/orchestrate/interface/utils/validateAuthorizationSchema.d.ts +7 -0
  176. package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -2
  177. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +1 -0
  178. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +3 -0
  179. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -2
  180. package/lib/orchestrate/realize/internal/compile.d.ts +3 -3
  181. package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +8 -1
  182. package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +6 -1
  183. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
  184. package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +19 -16
  185. package/lib/orchestrate/test/histories/transformTestScenarioHistories.d.ts +2 -1
  186. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +6 -5
  187. package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +1 -1
  188. package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.d.ts +6 -0
  189. package/lib/utils/predicateStateMessage.d.ts +4 -0
  190. package/package.json +6 -6
  191. package/src/AutoBeAgent.ts +14 -0
  192. package/src/AutoBeMockAgent.ts +9 -11
  193. package/src/constants/AutoBeSystemPromptConstant.ts +23 -29
  194. package/src/context/AutoBeTokenUsageComponent.ts +20 -0
  195. package/src/factory/consentFunctionCall.ts +128 -0
  196. package/src/factory/createAgenticaHistory.ts +1 -0
  197. package/src/factory/createAutoBeContext.ts +99 -14
  198. package/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.ts +11 -4
  199. package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +26 -4
  200. package/src/orchestrate/analyze/orchestrateAnalyze.ts +19 -14
  201. package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +3 -3
  202. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +8 -32
  203. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +5 -3
  204. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +16 -16
  205. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +5 -5
  206. package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +1 -0
  207. package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +0 -10
  208. package/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.ts +1 -1
  209. package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +9 -3
  210. package/src/orchestrate/interface/orchestrateInterface.ts +51 -12
  211. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +126 -23
  212. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +6 -19
  213. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +32 -27
  214. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +49 -32
  215. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +127 -33
  216. package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +67 -65
  217. package/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.ts +39 -0
  218. package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +16 -16
  219. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +62 -14
  220. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +38 -1
  221. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +47 -14
  222. package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +18 -24
  223. package/src/orchestrate/interface/utils/validateAuthorizationSchema.ts +41 -0
  224. package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +9 -16
  225. package/src/orchestrate/prisma/orchestratePrisma.ts +15 -6
  226. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +6 -19
  227. package/src/orchestrate/prisma/orchestratePrismaReview.ts +15 -9
  228. package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +1 -1
  229. package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +19 -23
  230. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +4 -2
  231. package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +285 -0
  232. package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +27 -27
  233. package/src/orchestrate/realize/internal/compile.ts +28 -45
  234. package/src/orchestrate/realize/orchestrateRealize.ts +71 -67
  235. package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +3 -3
  236. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +19 -15
  237. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +23 -15
  238. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +3 -3
  239. package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +19 -16
  240. package/src/orchestrate/realize/utils/replaceImportStatements.ts +7 -0
  241. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +110 -59
  242. package/src/orchestrate/test/orchestrateTest.ts +12 -0
  243. package/src/orchestrate/test/orchestrateTestScenario.ts +155 -19
  244. package/src/orchestrate/test/orchestrateTestWrite.ts +3 -3
  245. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +6 -5
  246. package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +1 -1
  247. package/src/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.ts +7 -0
  248. package/src/utils/predicateStateMessage.ts +107 -0
  249. package/lib/agent/src/orchestrate/internal/IProgress.d.ts +0 -4
  250. package/lib/agent/src/orchestrate/internal/IProgress.js.map +0 -1
  251. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCoderHistories.d.ts +0 -7
  252. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCoderHistories.js +0 -213
  253. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCoderHistories.js.map +0 -1
  254. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +0 -345
  255. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js.map +0 -1
  256. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +0 -56
  257. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCompile.js +0 -3
  258. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCompile.js.map +0 -1
  259. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.d.ts +0 -2
  260. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.js +0 -5
  261. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.js.map +0 -1
  262. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeReviewApplication.js +0 -3
  263. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeReviewApplication.js.map +0 -1
  264. package/lib/agent/src/utils/pipe.d.ts +0 -5
  265. package/lib/agent/src/utils/pipe.js +0 -14
  266. package/lib/agent/src/utils/pipe.js.map +0 -1
  267. package/lib/orchestrate/internal/IProgress.d.ts +0 -4
  268. package/lib/orchestrate/realize/histories/transformRealizeCoderHistories.d.ts +0 -7
  269. package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +0 -345
  270. package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +0 -56
  271. package/lib/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.d.ts +0 -2
  272. package/lib/utils/pipe.d.ts +0 -5
  273. package/src/orchestrate/internal/IProgress.ts +0 -4
  274. package/src/orchestrate/realize/histories/transformRealizeCoderHistories.ts +0 -248
  275. package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +0 -358
  276. package/src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts +0 -70
  277. package/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.ts +0 -2
  278. package/src/utils/pipe.ts +0 -39
  279. /package/lib/agent/src/orchestrate/realize/structures/{IAutoBeRealizeReviewApplication.d.ts → IAutoBeRealizeCorrectApplication.d.ts} +0 -0
  280. /package/lib/orchestrate/realize/structures/{IAutoBeRealizeReviewApplication.d.ts → IAutoBeRealizeCorrectApplication.d.ts} +0 -0
  281. /package/src/orchestrate/realize/structures/{IAutoBeRealizeReviewApplication.ts → IAutoBeRealizeCorrectApplication.ts} +0 -0
@@ -1,70 +1,121 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
- import { AutoBeOpenApi } from "@autobe/interface";
2
+ import { AutoBeInterfaceAuthorization, AutoBeOpenApi } from "@autobe/interface";
3
+ import { MapUtil } from "@autobe/utils";
3
4
  import { v4 } from "uuid";
4
5
 
5
6
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
7
+ import { AutoBeState } from "../../../context/AutoBeState";
8
+ import { IAutoBeTestScenarioAuthorizationRole } from "../structures/IAutoBeTestScenarioAuthorizationRole";
6
9
 
7
10
  export const transformTestScenarioHistories = (
11
+ state: AutoBeState,
8
12
  entire: AutoBeOpenApi.IOperation[],
9
13
  include: AutoBeOpenApi.IOperation[],
10
14
  exclude: Pick<AutoBeOpenApi.IOperation, "method" | "path">[],
11
15
  ): Array<
12
16
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
13
- > => [
14
- {
15
- id: v4(),
16
- created_at: new Date().toISOString(),
17
- type: "systemMessage",
18
- text: AutoBeSystemPromptConstant.TEST_SCENARIO,
19
- } satisfies IAgenticaHistoryJson.ISystemMessage,
20
- {
21
- id: v4(),
22
- created_at: new Date().toISOString(),
23
- type: "systemMessage",
24
- text: [
25
- "# Operations",
26
- "Below are the full operations. Please refer to this.",
27
- "Your role is to draft all test cases for each given Operation.",
28
- "It is also permissible to write multiple test codes on a single endpoint.",
29
- "However, rather than meaningless tests, business logic tests should be written and an E2E test situation should be assumed.",
30
- "",
31
- "Please carefully analyze each operation to identify all dependencies required for testing.",
32
- "For example, if you want to test liking and then deleting a post,",
33
- "you might think to test post creation, liking, and unlike operations.",
34
- "However, even if not explicitly mentioned, user registration and login are essential prerequisites.",
35
- "Pay close attention to IDs and related values in the API,",
36
- "and ensure you identify all dependencies between endpoints.",
37
- "",
38
- "```json",
39
- JSON.stringify(
40
- entire.map((el) => ({
41
- ...el,
42
- specification: undefined,
43
- })),
44
- ),
45
- "```",
46
- ].join("\n"),
47
- } satisfies IAgenticaHistoryJson.ISystemMessage,
48
- {
49
- id: v4(),
50
- created_at: new Date().toISOString(),
51
- type: "systemMessage",
52
- text: [
53
- "# Included in Test Plan",
54
- include
55
- .map(
56
- (el) =>
57
- `- ${el.method.toUpperCase()}: ${el.path} ${el.authorizationRole ? `(Role: ${el.authorizationRole})` : ""}`,
58
- )
59
- .join("\n"),
60
- "",
61
- "# Excluded from Test Plan",
62
- "These are the endpoints that have already been used in test codes generated as part of a plan group.",
63
- "These endpoints do not need to be tested again.",
64
- "However, it is allowed to reference or depend on these endpoints when writing test codes for other purposes.",
65
- exclude
66
- .map((el) => `- ${el.method.toUpperCase()}: ${el.path}`)
67
- .join("\n"),
68
- ].join("\n"),
69
- } satisfies IAgenticaHistoryJson.ISystemMessage,
70
- ];
17
+ > => {
18
+ const authorizations: AutoBeInterfaceAuthorization[] =
19
+ state.interface?.authorizations ?? [];
20
+
21
+ const authorizationRoles: Map<string, IAutoBeTestScenarioAuthorizationRole> =
22
+ new Map();
23
+
24
+ for (const authorization of authorizations) {
25
+ for (const op of authorization.operations) {
26
+ if (op.authorizationType === null) continue;
27
+ const value: IAutoBeTestScenarioAuthorizationRole = MapUtil.take(
28
+ authorizationRoles,
29
+ authorization.role,
30
+ () => ({
31
+ name: authorization.role,
32
+ join: null,
33
+ login: null,
34
+ }),
35
+ );
36
+ if (op.authorizationType === "join") value.join = op;
37
+ else if (op.authorizationType === "login") value.login = op;
38
+ }
39
+ }
40
+
41
+ return [
42
+ {
43
+ id: v4(),
44
+ created_at: new Date().toISOString(),
45
+ type: "systemMessage",
46
+ text: AutoBeSystemPromptConstant.TEST_SCENARIO,
47
+ } satisfies IAgenticaHistoryJson.ISystemMessage,
48
+ {
49
+ id: v4(),
50
+ created_at: new Date().toISOString(),
51
+ type: "systemMessage",
52
+ text: [
53
+ "# Operations",
54
+ "",
55
+ "Below are the full operations. Please refer to this.",
56
+ "Your role is to draft all test cases for each given Operation.",
57
+ "It is also permissible to write multiple test codes on a single endpoint.",
58
+ "However, rather than meaningless tests, business logic tests should be written and an E2E test situation should be assumed.",
59
+ "",
60
+ "Please carefully analyze each operation to identify all dependencies required for testing.",
61
+ "For example, if you want to test liking and then deleting a post,",
62
+ "you might think to test post creation, liking, and unlike operations.",
63
+ "However, even if not explicitly mentioned, user registration or login are essential prerequisites.",
64
+ "Pay close attention to IDs and related values in the API,",
65
+ "and ensure you identify all dependencies between endpoints.",
66
+ "",
67
+ "```json",
68
+ JSON.stringify(
69
+ entire.map((el) => ({
70
+ ...el,
71
+ specification: undefined,
72
+ })),
73
+ ),
74
+ "```",
75
+ ].join("\n"),
76
+ } satisfies IAgenticaHistoryJson.ISystemMessage,
77
+ {
78
+ id: v4(),
79
+ created_at: new Date().toISOString(),
80
+ type: "systemMessage",
81
+ text: [
82
+ "# Included in Test Plan",
83
+ "",
84
+ "Below are the endpoints that have been included in the test plan.",
85
+ "Each endpoint shows its authentication requirements and related authentication APIs.",
86
+ "When testing endpoints that require authentication, ensure you include the corresponding join/login operations in your test scenario to establish proper authentication context.",
87
+ "",
88
+ include
89
+ .map((el, i) => {
90
+ const roles = Array.from(authorizationRoles.values()).filter(
91
+ (role) => role.name === el.authorizationRole,
92
+ );
93
+ return [
94
+ `## ${i + 1}. ${el.method.toUpperCase()} ${el.path}`,
95
+ "",
96
+ "Related Authentication APIs:",
97
+ "",
98
+ roles.length > 0
99
+ ? roles.map((role) => {
100
+ return [
101
+ `- ${role.join?.method.toUpperCase()}: ${role.join?.path}`,
102
+ `- ${role.login?.method.toUpperCase()}: ${role.login?.path}`,
103
+ ].join("\n");
104
+ })
105
+ : "- None",
106
+ ];
107
+ })
108
+ .join("\n"),
109
+ "",
110
+ "# Excluded from Test Plan",
111
+ "",
112
+ "These are the endpoints that have already been used in test codes generated as part of a plan group.",
113
+ "These endpoints do not need to be tested again.",
114
+ "However, it is allowed to reference or depend on these endpoints when writing test codes for other purposes.",
115
+ exclude
116
+ .map((el) => `- ${el.method.toUpperCase()}: ${el.path}`)
117
+ .join("\n"),
118
+ ].join("\n"),
119
+ } satisfies IAgenticaHistoryJson.ISystemMessage,
120
+ ];
121
+ };
@@ -12,6 +12,7 @@ import { v4 } from "uuid";
12
12
 
13
13
  import { AutoBeContext } from "../../context/AutoBeContext";
14
14
  import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
15
+ import { predicateStateMessage } from "../../utils/predicateStateMessage";
15
16
  import { orchestrateTestCorrect } from "./orchestrateTestCorrect";
16
17
  import { orchestrateTestScenario } from "./orchestrateTestScenario";
17
18
  import { orchestrateTestWrite } from "./orchestrateTestWrite";
@@ -22,7 +23,17 @@ export const orchestrateTest =
22
23
  async (
23
24
  props: IAutoBeApplicationProps,
24
25
  ): Promise<AutoBeAssistantMessageHistory | AutoBeTestHistory> => {
26
+ // PREDICATION
25
27
  const start: Date = new Date();
28
+ const predicate: string | null = predicateStateMessage(ctx.state(), "test");
29
+ if (predicate !== null)
30
+ return ctx.assistantMessage({
31
+ type: "assistantMessage",
32
+ id: v4(),
33
+ created_at: start.toISOString(),
34
+ text: predicate,
35
+ completed_at: new Date().toISOString(),
36
+ });
26
37
  ctx.dispatch({
27
38
  type: "testStart",
28
39
  created_at: start.toISOString(),
@@ -30,6 +41,7 @@ export const orchestrateTest =
30
41
  step: ctx.state().analyze?.step ?? 0,
31
42
  });
32
43
 
44
+ // CHECK OPERATIONS
33
45
  const operations: AutoBeOpenApi.IOperation[] =
34
46
  ctx.state().interface?.document.operations ?? [];
35
47
  if (operations.length === 0)
@@ -1,6 +1,11 @@
1
1
  import { IAgenticaController } from "@agentica/core";
2
- import { AutoBeOpenApi, AutoBeTestScenario } from "@autobe/interface";
3
- import { AutoBeEndpointComparator } from "@autobe/utils";
2
+ import {
3
+ AutoBeInterfaceAuthorization,
4
+ AutoBeOpenApi,
5
+ AutoBeProgressEventBase,
6
+ AutoBeTestScenario,
7
+ } from "@autobe/interface";
8
+ import { AutoBeEndpointComparator, MapUtil, StringUtil } from "@autobe/utils";
4
9
  import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
5
10
  import { HashMap, IPointer, Pair } from "tstl";
6
11
  import typia from "typia";
@@ -8,9 +13,9 @@ import typia from "typia";
8
13
  import { AutoBeContext } from "../../context/AutoBeContext";
9
14
  import { assertSchemaModel } from "../../context/assertSchemaModel";
10
15
  import { divideArray } from "../../utils/divideArray";
11
- import { IProgress } from "../internal/IProgress";
12
16
  import { transformTestScenarioHistories } from "./histories/transformTestScenarioHistories";
13
17
  import { IAutoBeTestScenarioApplication } from "./structures/IAutoBeTestScenarioApplication";
18
+ import { IAutoBeTestScenarioAuthorizationRole } from "./structures/IAutoBeTestScenarioAuthorizationRole";
14
19
 
15
20
  export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
16
21
  ctx: AutoBeContext<Model>,
@@ -38,6 +43,7 @@ export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
38
43
  AutoBeEndpointComparator.hashCode,
39
44
  AutoBeEndpointComparator.equals,
40
45
  );
46
+
41
47
  const endpointNotFound: string = [
42
48
  `You have to select one of the endpoints below`,
43
49
  "",
@@ -46,7 +52,7 @@ export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
46
52
  ...operations.map((op) => `\`${op.method}\` | \`${op.path}\``).join("\n"),
47
53
  ].join("\n");
48
54
 
49
- const progress: IProgress = {
55
+ const progress: AutoBeProgressEventBase = {
50
56
  total: operations.length,
51
57
  completed: 0,
52
58
  };
@@ -105,18 +111,28 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
105
111
  entire: AutoBeOpenApi.IOperation[],
106
112
  include: AutoBeOpenApi.IOperation[],
107
113
  exclude: AutoBeOpenApi.IEndpoint[],
108
- progress: IProgress,
114
+ progress: AutoBeProgressEventBase,
109
115
  ) => {
110
116
  const pointer: IPointer<IAutoBeTestScenarioApplication.IScenarioGroup[]> = {
111
117
  value: [],
112
118
  };
119
+
120
+ const authorizations: AutoBeInterfaceAuthorization[] =
121
+ ctx.state().interface?.authorizations ?? [];
122
+
113
123
  const { tokenUsage } = await ctx.conversate({
114
124
  source: "testScenarios",
115
- histories: transformTestScenarioHistories(entire, include, exclude),
125
+ histories: transformTestScenarioHistories(
126
+ ctx.state(),
127
+ entire,
128
+ include,
129
+ exclude,
130
+ ),
116
131
  controller: createController({
117
132
  model: ctx.model,
118
133
  endpointNotFound,
119
134
  dict,
135
+ authorizations,
120
136
  build: (next) => {
121
137
  pointer.value ??= [];
122
138
  pointer.value.push(...next.scenarioGroups);
@@ -154,6 +170,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
154
170
  model: Model;
155
171
  endpointNotFound: string;
156
172
  dict: HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IOperation>;
173
+ authorizations: AutoBeInterfaceAuthorization[];
157
174
  build: (next: IAutoBeTestScenarioApplication.IProps) => void;
158
175
  }): IAgenticaController.IClass<Model> {
159
176
  assertSchemaModel(props.model);
@@ -166,19 +183,8 @@ function createController<Model extends ILlmSchema.Model>(props: {
166
183
  if (result.success === false) return result;
167
184
 
168
185
  // merge to unique scenario groups
169
- const scenarioGroups: IAutoBeTestScenarioApplication.IScenarioGroup[] = [];
170
- result.data.scenarioGroups.forEach((sg) => {
171
- const created = scenarioGroups.find(
172
- (el) =>
173
- el.endpoint.method === sg.endpoint.method &&
174
- el.endpoint.path === sg.endpoint.path,
175
- );
176
- if (created) {
177
- created.scenarios.push(...sg.scenarios);
178
- } else {
179
- scenarioGroups.push(sg);
180
- }
181
- });
186
+ const scenarioGroups: IAutoBeTestScenarioApplication.IScenarioGroup[] =
187
+ uniqueScenarioGroups(result.data.scenarioGroups);
182
188
 
183
189
  // validate endpoints
184
190
  const errors: IValidation.IError[] = [];
@@ -202,6 +208,125 @@ function createController<Model extends ILlmSchema.Model>(props: {
202
208
  });
203
209
  });
204
210
  });
211
+
212
+ // Authentication Correction
213
+ const entireRoles: Map<string, IAutoBeTestScenarioAuthorizationRole> =
214
+ new Map();
215
+ for (const authorization of props.authorizations) {
216
+ for (const op of authorization.operations) {
217
+ if (op.authorizationType === null) continue;
218
+ const value: IAutoBeTestScenarioAuthorizationRole = MapUtil.take(
219
+ entireRoles,
220
+ authorization.role,
221
+ () => ({
222
+ name: authorization.role,
223
+ join: null,
224
+ login: null,
225
+ }),
226
+ );
227
+ if (op.authorizationType === "join") value.join = op;
228
+ else if (op.authorizationType === "login") value.login = op;
229
+ }
230
+ }
231
+
232
+ scenarioGroups.forEach((group) => {
233
+ if (props.dict.has(group.endpoint) === false) return;
234
+
235
+ const operation: AutoBeOpenApi.IOperation = props.dict.get(
236
+ group.endpoint,
237
+ );
238
+ group.scenarios.forEach((scenario) => {
239
+ // gathere authorization roles
240
+ const localRoles: Map<string, IAutoBeTestScenarioAuthorizationRole> =
241
+ new Map();
242
+ const add = (operation: AutoBeOpenApi.IOperation) => {
243
+ const role: string | null = operation.authorizationRole;
244
+ if (role === null) return;
245
+ MapUtil.take(localRoles, role, () => ({
246
+ name: role,
247
+ join: null,
248
+ login: null,
249
+ }));
250
+ };
251
+ add(operation);
252
+ scenario.dependencies.forEach((d) => {
253
+ if (props.dict.has(d.endpoint) === false) return;
254
+ const depOperation: AutoBeOpenApi.IOperation = props.dict.get(
255
+ d.endpoint,
256
+ );
257
+ add(depOperation);
258
+ });
259
+
260
+ // Single role case - add join operation
261
+ if (localRoles.size === 1) {
262
+ const role: IAutoBeTestScenarioAuthorizationRole = localRoles
263
+ .values()
264
+ .next().value!;
265
+ if (role.join === null) {
266
+ const joinOperation: AutoBeOpenApi.IOperation | null =
267
+ entireRoles.get(role.name)?.join ?? null;
268
+ if (joinOperation === null) throw new Error("Unreachable code");
269
+
270
+ scenario.dependencies.push({
271
+ endpoint: {
272
+ method: joinOperation.method,
273
+ path: joinOperation.path,
274
+ },
275
+ purpose: StringUtil.trim`
276
+ Essential authentication prerequisite:
277
+ This join operation (${joinOperation.method} ${joinOperation.path}) must be executed before any operations requiring '${role.name}' role authorization.
278
+ It establishes the necessary user account and authentication context for the '${role.name}' role, enabling subsequent API calls that depend on this specific authorization level.
279
+ Without this join operation, the main scenario endpoint and its dependencies will fail due to insufficient authentication credentials.
280
+ `,
281
+ });
282
+ }
283
+ }
284
+
285
+ // Multiple roles case - add both join and login operations
286
+ if (localRoles.size > 1) {
287
+ for (const role of localRoles.values()) {
288
+ if (role.join === null) {
289
+ const joinOperation: AutoBeOpenApi.IOperation | null =
290
+ entireRoles.get(role.name)?.join ?? null;
291
+ if (joinOperation === null) throw new Error("Unreachable code");
292
+
293
+ scenario.dependencies.push({
294
+ endpoint: {
295
+ path: joinOperation.path,
296
+ method: joinOperation.method,
297
+ },
298
+ purpose: StringUtil.trim`
299
+ Multi-actor authentication setup:
300
+ This join operation (${joinOperation.method} ${joinOperation.path}) is required to establish a '${role.name}' role user account in the system.
301
+ This scenario involves multiple authorization roles, requiring separate user accounts for each role to properly test cross-role interactions and authorization boundaries.
302
+ The join operation creates the foundational user identity that will be used throughout the test scenario for '${role.name}' specific operations.
303
+ This join operation is required for the '${role.name}' role authentication.
304
+ `,
305
+ });
306
+ }
307
+ if (role.login === null) {
308
+ const loginOperation: AutoBeOpenApi.IOperation | null =
309
+ entireRoles.get(role.name)?.login ?? null;
310
+ if (loginOperation === null) throw new Error("Unreachable code");
311
+
312
+ scenario.dependencies.push({
313
+ endpoint: {
314
+ path: loginOperation.path,
315
+ method: loginOperation.method,
316
+ },
317
+ purpose: StringUtil.trim`
318
+ Role switching authentication:
319
+ This login operation (${loginOperation.method} ${loginOperation.path}) enables dynamic user role switching during test execution for the '${role.name}' role.
320
+ In scenarios with multiple actors, the test agent needs to authenticate as different users to simulate real-world multi-user interactions.
321
+ This login operation ensures proper session management and authorization context switching, allowing the test to validate permissions, access controls, and business logic that span across different user roles within a single test scenario.
322
+ This login operation may be required for user role swapping between multiple actors.
323
+ `,
324
+ });
325
+ }
326
+ }
327
+ }
328
+ });
329
+ });
205
330
  return errors.length === 0
206
331
  ? {
207
332
  success: true,
@@ -234,6 +359,17 @@ function createController<Model extends ILlmSchema.Model>(props: {
234
359
  };
235
360
  }
236
361
 
362
+ const uniqueScenarioGroups = (
363
+ groups: IAutoBeTestScenarioApplication.IScenarioGroup[],
364
+ ): IAutoBeTestScenarioApplication.IScenarioGroup[] =>
365
+ new HashMap(
366
+ groups.map((g) => new Pair(g.endpoint, g)),
367
+ AutoBeEndpointComparator.hashCode,
368
+ AutoBeEndpointComparator.equals,
369
+ )
370
+ .toJSON()
371
+ .map((it) => it.second);
372
+
237
373
  const collection = {
238
374
  chatgpt: (validate: Validator) =>
239
375
  typia.llm.application<IAutoBeTestScenarioApplication, "chatgpt">({
@@ -1,5 +1,6 @@
1
1
  import { IAgenticaController } from "@agentica/core";
2
2
  import {
3
+ AutoBeProgressEventBase,
3
4
  AutoBeTestScenario,
4
5
  AutoBeTestWriteEvent,
5
6
  IAutoBeCompiler,
@@ -10,7 +11,6 @@ import typia from "typia";
10
11
 
11
12
  import { AutoBeContext } from "../../context/AutoBeContext";
12
13
  import { assertSchemaModel } from "../../context/assertSchemaModel";
13
- import { IProgress } from "../internal/IProgress";
14
14
  import { completeTestCode } from "./compile/completeTestCode";
15
15
  import { getTestScenarioArtifacts } from "./compile/getTestScenarioArtifacts";
16
16
  import { transformTestWriteHistories } from "./histories/transformTestWriteHistories";
@@ -22,7 +22,7 @@ export async function orchestrateTestWrite<Model extends ILlmSchema.Model>(
22
22
  ctx: AutoBeContext<Model>,
23
23
  scenarios: AutoBeTestScenario[],
24
24
  ): Promise<IAutoBeTestWriteResult[]> {
25
- const progress: IProgress = {
25
+ const progress: AutoBeProgressEventBase = {
26
26
  total: scenarios.length,
27
27
  completed: 0,
28
28
  };
@@ -69,7 +69,7 @@ async function process<Model extends ILlmSchema.Model>(
69
69
  ctx: AutoBeContext<Model>,
70
70
  scenario: AutoBeTestScenario,
71
71
  artifacts: IAutoBeTestScenarioArtifacts,
72
- progress: IProgress,
72
+ progress: AutoBeProgressEventBase,
73
73
  ): Promise<AutoBeTestWriteEvent> {
74
74
  const pointer: IPointer<IAutoBeTestWriteApplication.IProps | null> = {
75
75
  value: null,
@@ -31,7 +31,7 @@ export namespace IAutoBeTestCorrectApplication {
31
31
  * AI analyzes the original test scenario, business requirements, and
32
32
  * intended functionality without being influenced by compilation errors.
33
33
  * This clean analysis establishes a clear understanding of what the test
34
- * should accomplish, the expected business workflow, and the correct API
34
+ * accomplishes, the expected business workflow, and the correct API
35
35
  * integration patterns.
36
36
  *
37
37
  * This step ensures that error correction doesn't lose sight of the
@@ -70,17 +70,18 @@ export namespace IAutoBeTestCorrectApplication {
70
70
  * AI generates the first corrected version of the test code based on error
71
71
  * analysis and correction strategies. This draft addresses all identified
72
72
  * compilation errors while preserving the original business logic and test
73
- * workflow. The code must be compilation-error-free and follow all
73
+ * workflow. The code is compilation-error-free and follows all
74
74
  * established conventions.
75
75
  *
76
76
  * The implementation incorporates lessons learned from error analysis to
77
77
  * produce properly typed, syntactically correct code that maintains the
78
78
  * intended test functionality. All type safety requirements and framework
79
- * conventions must be followed in this corrected implementation.
79
+ * conventions are followed in this corrected implementation.
80
80
  *
81
81
  * Workflow: Error correction → TypeScript implementation → Functional
82
- * preservation Critical: Must resolve all compilation errors while
83
- * maintaining original test intent
82
+ * preservation
83
+ *
84
+ * DO: Resolve all compilation errors while maintaining original test intent
84
85
  */
85
86
  draft: string;
86
87
 
@@ -63,7 +63,7 @@ export namespace IAutoBeTestScenarioApplication {
63
63
  *
64
64
  * ## Naming Convention
65
65
  *
66
- * MUST use snake_case naming convention.
66
+ * DO: Use snake_case naming convention.
67
67
  *
68
68
  * - Must start with `test_api_` prefix (mandatory requirement)
69
69
  * - ALWAYS start with business feature, NOT action verbs
@@ -0,0 +1,7 @@
1
+ import { AutoBeOpenApi } from "@autobe/interface";
2
+
3
+ export interface IAutoBeTestScenarioAuthorizationRole {
4
+ name: string;
5
+ join: AutoBeOpenApi.IOperation | null;
6
+ login: AutoBeOpenApi.IOperation | null;
7
+ }
@@ -0,0 +1,107 @@
1
+ import { StringUtil } from "@autobe/utils";
2
+
3
+ import { AutoBeState } from "../context/AutoBeState";
4
+
5
+ type StepName = "analyze" | "prisma" | "interface" | "test" | "realize";
6
+
7
+ export const predicateStateMessage = (
8
+ state: AutoBeState,
9
+ future: StepName,
10
+ ): string | null => {
11
+ if (future === "analyze") return null;
12
+ if (future === "prisma") return predicatePrisma(state);
13
+
14
+ const futureIndex: number = STEP_ORDER.indexOf(future);
15
+ for (const key of STEP_ORDER.slice(0, futureIndex))
16
+ if (state[key] === null) return buildMissingStepsMessage(future, key);
17
+
18
+ const prevStepName: StepName = STEP_ORDER[futureIndex - 1];
19
+ if (state.analyze!.step !== state[prevStepName]!.step)
20
+ return buildOutdatedMessage(prevStepName, "analyze", state);
21
+ return null;
22
+ };
23
+
24
+ const buildMissingStepsMessage = (
25
+ current: StepName,
26
+ missing: StepName,
27
+ ): string => {
28
+ const currentIndex: number = STEP_ORDER.indexOf(current);
29
+ const missingIndex: number = STEP_ORDER.indexOf(missing);
30
+ const remainingSteps: string = STEP_ORDER.slice(
31
+ missingIndex,
32
+ currentIndex + 1,
33
+ )
34
+ .map((step, index) => `${index + 1}. ${STEP_DESCRIPTIONS[step]}`)
35
+ .join("\n ");
36
+
37
+ const currentAction = ACTION_NAMES[current];
38
+
39
+ return StringUtil.trim`
40
+ ${STEP_DESCRIPTIONS[missing]} not completed yet.
41
+
42
+ To ${currentAction}, complete these steps:
43
+
44
+ ${remainingSteps}
45
+
46
+ Start with step ${missingIndex + 1}.
47
+ `;
48
+ };
49
+
50
+ const buildOutdatedMessage = (
51
+ outdatedStep: StepName,
52
+ currentStep: StepName,
53
+ state: AutoBeState,
54
+ ): string => {
55
+ const outdatedVersion = state[outdatedStep]?.step;
56
+ const currentVersion = state[currentStep]?.step;
57
+
58
+ return StringUtil.trim`
59
+ ${STEP_NAMES[outdatedStep]} is outdated (step ${outdatedVersion}).
60
+
61
+ Requirements are now at step ${currentVersion}.
62
+
63
+ Please update ${outdatedStep} to match current requirements.
64
+ `;
65
+ };
66
+
67
+ const predicatePrisma = (state: AutoBeState): string | null => {
68
+ if (state.analyze !== null) return null;
69
+ return StringUtil.trim`
70
+ Requirements analysis not started.
71
+
72
+ Discuss your project with AI to generate requirements analysis.
73
+ Database design will follow after requirements are ready.
74
+ `;
75
+ };
76
+
77
+ const STEP_DESCRIPTIONS: Record<StepName, string> = {
78
+ analyze: "Requirements analysis",
79
+ prisma: "Database design",
80
+ interface: "API interface design",
81
+ test: "E2E test creation",
82
+ realize: "Implementation",
83
+ };
84
+
85
+ const STEP_NAMES: Record<StepName, string> = {
86
+ analyze: "Requirements analysis",
87
+ prisma: "Database schema",
88
+ interface: "API interface",
89
+ test: "Test functions",
90
+ realize: "Implementation",
91
+ };
92
+
93
+ const ACTION_NAMES: Record<StepName, string> = {
94
+ analyze: "analyze requirements",
95
+ prisma: "design database",
96
+ interface: "design API interface",
97
+ test: "create tests",
98
+ realize: "implement the program",
99
+ };
100
+
101
+ const STEP_ORDER: StepName[] = [
102
+ "analyze",
103
+ "prisma",
104
+ "interface",
105
+ "test",
106
+ "realize",
107
+ ];
@@ -1,4 +0,0 @@
1
- export interface IProgress {
2
- total: number;
3
- completed: number;
4
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"IProgress.js","sourceRoot":"","sources":["../../../../../src/orchestrate/internal/IProgress.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- import { IAgenticaHistoryJson } from "@agentica/core";
2
- import { AutoBeRealizeAuthorization, IAutoBeTypeScriptCompileResult } from "@autobe/interface";
3
- import { AutoBeState } from "../../../context/AutoBeState";
4
- import { IAutoBeTestScenarioArtifacts } from "../../test/structures/IAutoBeTestScenarioArtifacts";
5
- import { IAutoBeRealizeScenario } from "../orchestrateRealizeScenario";
6
- import { IAutoBeRealizeCompile } from "../structures/IAutoBeRealizeCompile";
7
- export declare const transformRealizeCoderHistories: (state: AutoBeState, previousCodes: IAutoBeRealizeCompile.Success[], props: IAutoBeRealizeScenario, artifacts: IAutoBeTestScenarioArtifacts, previous: string | null, diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[], authorization?: AutoBeRealizeAuthorization) => Array<IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage>;