@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
@@ -23,7 +23,7 @@ export namespace IAutoBeInterfaceOperationApplication {
23
23
  /**
24
24
  * Array of API operations to generate.
25
25
  *
26
- * Each operation in this array must include:
26
+ * Each operation in this array includes:
27
27
  *
28
28
  * - Specification: Detailed API specification with clear purpose and
29
29
  * functionality
@@ -38,7 +38,7 @@ export namespace IAutoBeInterfaceOperationApplication {
38
38
  * components.schemas
39
39
  * - ResponseBody: With typeName referencing appropriate response type
40
40
  *
41
- * All operations must follow strict quality standards:
41
+ * All operations follow strict quality standards:
42
42
  *
43
43
  * 1. Detailed descriptions referencing Prisma schema comments
44
44
  * 2. Accurate parameter definitions matching path parameters
@@ -66,11 +66,10 @@ export namespace IAutoBeInterfaceOperationApplication {
66
66
  * reason and description fields, making it clear why the API was designed and
67
67
  * how it should be used.
68
68
  *
69
- * All request bodies and responses for this operation must be object types
70
- * and must reference named types defined in the components section. The
71
- * content-type is always `application/json`. For file upload/download
72
- * operations, use `string & tags.Format<"uri">` in the appropriate schema
73
- * instead of binary data formats.
69
+ * DO: Use object types for all request bodies and responses. DO: Reference
70
+ * named types defined in the components section. DO: Use `application/json`
71
+ * as the content-type. DO: Use `string & tags.Format<"uri">` in the schema
72
+ * for file upload/download operations instead of binary data formats.
74
73
  *
75
74
  * In OpenAPI, this might represent:
76
75
  *
@@ -88,7 +87,10 @@ export namespace IAutoBeInterfaceOperationApplication {
88
87
  * ```
89
88
  */
90
89
  export interface IOperation
91
- extends Omit<AutoBeOpenApi.IOperation, "authorizationRole"> {
90
+ extends Omit<
91
+ AutoBeOpenApi.IOperation,
92
+ "authorizationRole" | "authorizationType"
93
+ > {
92
94
  /**
93
95
  * Authorization roles required to access this API operation.
94
96
  *
@@ -96,16 +98,47 @@ export namespace IAutoBeInterfaceOperationApplication {
96
98
  * endpoint. Multiple roles can be specified to allow different types of
97
99
  * users to access the same endpoint.
98
100
  *
101
+ * ## ⚠️ CRITICAL: Role Multiplication Effect
102
+ *
103
+ * **EACH ROLE IN THIS ARRAY GENERATES A SEPARATE ENDPOINT**
104
+ *
105
+ * - If you specify `["admin", "moderator", "member"]`, this creates 3
106
+ * separate endpoints
107
+ * - Total generated endpoints = operations × average roles.length
108
+ * - Example: 100 operations with 3 roles each = 300 actual endpoints
109
+ *
110
+ * ## 🔴 AVOID OVER-GENERATION
111
+ *
112
+ * **DO NOT create role-specific endpoints when a public endpoint would
113
+ * suffice:**
114
+ *
115
+ * - ❌ BAD: Separate GET endpoints for admin, member, moderator to view the
116
+ * same public data
117
+ * - ✅ GOOD: Single public endpoint `[]` with role-based filtering in business
118
+ * logic
119
+ *
120
+ * **DO NOT enumerate all possible roles when the Prisma schema uses a
121
+ * single User table:**
122
+ *
123
+ * - If Prisma has a User table with role/permission fields, you likely only
124
+ * need `["user"]`
125
+ * - Avoid listing `["admin", "seller", "buyer", "moderator", ...]`
126
+ * unnecessarily
127
+ * - The actual role checking happens in business logic, not at the endpoint
128
+ * level
129
+ *
99
130
  * ## Naming Convention
100
131
  *
101
- * All role names MUST use camelCase.
132
+ * DO: Use camelCase for all role names.
102
133
  *
103
134
  * ## Important Guidelines
104
135
  *
105
136
  * - Set to empty array `[]` for public endpoints that require no
106
137
  * authentication
107
138
  * - Set to array with role strings for role-restricted endpoints
108
- * - The role names MUST match exactly with the user type/role defined in the
139
+ * - **MINIMIZE the number of roles per endpoint to prevent explosion**
140
+ * - Consider if the endpoint can be public with role-based filtering instead
141
+ * - The role names match exactly with the user type/role defined in the
109
142
  * database
110
143
  * - This will be used by the Realize Agent to generate appropriate decorator
111
144
  * and authorization logic in the provider functions
@@ -114,11 +147,26 @@ export namespace IAutoBeInterfaceOperationApplication {
114
147
  *
115
148
  * ## Examples
116
149
  *
117
- * - `[]` - Public endpoint, no authentication required
118
- * - `["user"]` - Any authenticated user can access
119
- * - `["admin"]` - Only admin users can access
150
+ * - `[]` - Public endpoint, no authentication required (PREFERRED for read
151
+ * operations)
152
+ * - `["user"]` - Any authenticated user can access (PREFERRED for
153
+ * user-specific operations)
154
+ * - `["admin"]` - Only admin users can access (USE SPARINGLY)
120
155
  * - `["admin", "moderator"]` - Both admin and moderator users can access
121
- * - `["seller"]` - Only seller users can access
156
+ * (AVOID if possible)
157
+ * - `["seller"]` - Only seller users can access (ONLY if Seller is a separate
158
+ * table)
159
+ *
160
+ * ## Best Practices
161
+ *
162
+ * 1. **Start with public `[]` for all read operations** unless sensitive data
163
+ * is involved
164
+ * 2. **Use single role `["user"]` for authenticated operations** and handle
165
+ * permissions in business logic
166
+ * 3. **Only use multiple roles when absolutely necessary** for different
167
+ * business logic paths
168
+ * 4. **Remember: Fewer roles = Fewer endpoints = Better performance and
169
+ * maintainability**
122
170
  *
123
171
  * Note: The actual authentication/authorization implementation will be
124
172
  * handled by decorators at the controller level, and the provider function
@@ -97,6 +97,43 @@ export namespace IAutoBeInterfaceOperationsReviewApplication {
97
97
  * operations unchanged. These operations are validated and ready for schema
98
98
  * generation and subsequent implementation phases.
99
99
  */
100
- content: AutoBeOpenApi.IOperation[];
100
+ content: IOperation[];
101
101
  }
102
+
103
+ /**
104
+ * Operation of the Restful API.
105
+ *
106
+ * This interface defines a single API endpoint with its HTTP {@link method},
107
+ * {@link path}, {@link parameters path parameters},
108
+ * {@link requestBody request body}, and {@link responseBody} structure. It
109
+ * corresponds to an individual operation in the paths section of an OpenAPI
110
+ * document.
111
+ *
112
+ * Each operation requires a detailed explanation of its purpose through the
113
+ * reason and description fields, making it clear why the API was designed and
114
+ * how it should be used.
115
+ *
116
+ * All request bodies and responses for this operation must be object types
117
+ * and must reference named types defined in the components section. The
118
+ * content-type is always `application/json`. For file upload/download
119
+ * operations, use `string & tags.Format<"uri">` in the appropriate schema
120
+ * instead of binary data formats.
121
+ *
122
+ * In OpenAPI, this might represent:
123
+ *
124
+ * ```json
125
+ * {
126
+ * "/shoppings/customers/orders": {
127
+ * "post": {
128
+ * "description": "Create a new order application from shopping cart...",
129
+ * "parameters": [...],
130
+ * "requestBody": {...},
131
+ * "responses": {...}
132
+ * }
133
+ * }
134
+ * }
135
+ * ```
136
+ */
137
+ export interface IOperation
138
+ extends Omit<AutoBeOpenApi.IOperation, "authorizationType"> {}
102
139
  }
@@ -14,10 +14,9 @@ export interface IAutoBeInterfaceSchemaApplication {
14
14
  * creation. This ensures that the final OpenAPI document has complete type
15
15
  * coverage for all operations.
16
16
  *
17
- * CRITICAL: All schema definitions must follow the established naming
18
- * conventions (IEntityName, IEntityName.ICreate, etc.) and must be thoroughly
19
- * documented with descriptions that reference the original Prisma schema
20
- * comments.
17
+ * DO: Follow established naming conventions (IEntityName,
18
+ * IEntityName.ICreate, etc.) DO: Document thoroughly with descriptions that
19
+ * reference the original Prisma schema comments.
21
20
  *
22
21
  * @param props Properties containing components to generate.
23
22
  */
@@ -25,6 +24,40 @@ export interface IAutoBeInterfaceSchemaApplication {
25
24
  }
26
25
  export namespace IAutoBeInterfaceSchemaApplication {
27
26
  export interface IProps {
27
+ /**
28
+ * TypeScript draft code for schema definitions.
29
+ *
30
+ * This property contains TypeScript interface definitions that serve as a
31
+ * preliminary draft before generating the final JSON schema components.
32
+ * The draft allows for initial design and validation of the schema structure
33
+ * using TypeScript's type system before converting to OpenAPI/JSON Schema format.
34
+ *
35
+ * The draft typically includes:
36
+ * - Entity interfaces matching the Prisma models
37
+ * - Operation-specific variants (ICreate, IUpdate, etc.)
38
+ * - Utility types and enumerations
39
+ * - Type relationships and constraints
40
+ *
41
+ * This TypeScript draft serves as the foundation for the subsequent schema
42
+ * generation, ensuring type safety and consistency. The final schemas in the
43
+ * `schemas` property should be derived from and validated against this draft.
44
+ *
45
+ * Example draft structure:
46
+ * ```typescript
47
+ * interface IUser {
48
+ * id: string;
49
+ * email: string;
50
+ * profile: IUserProfile;
51
+ * }
52
+ *
53
+ * namespace IUser {
54
+ * interface ICreate extends Omit<IUser, "id"> {}
55
+ * interface IUpdate extends Partial<ICreate> {}
56
+ * }
57
+ * ```
58
+ */
59
+ draft: string;
60
+
28
61
  /**
29
62
  * Complete set of schema components for the OpenAPI specification.
30
63
  *
@@ -32,23 +65,23 @@ export namespace IAutoBeInterfaceSchemaApplication {
32
65
  * the system. It is the central repository of all named schema types that
33
66
  * will be used throughout the API specification.
34
67
  *
35
- * CRITICAL REQUIREMENT: All object types MUST be defined as named types in
36
- * the components.schemas section. Inline anonymous object definitions are
37
- * strictly prohibited.
68
+ * DO: Define all object types as named types in the components.schemas
69
+ * section. DO NOT: Use inline anonymous object definitions.
38
70
  *
39
- * This components object should include:
71
+ * This components object includes:
40
72
  *
41
73
  * - Main entity types (IEntityName)
42
74
  * - Operation-specific variants (.ICreate, .IUpdate, .ISummary, etc.)
43
75
  * - Container types (IPage<T> for pagination)
44
76
  * - Enumeration types
45
77
  *
46
- * All schema definitions must include detailed descriptions that reference
47
- * the original Prisma schema comments and thoroughly document each
48
- * property. Every property that references an object must use a $ref to a
49
- * named type in the components.schemas section. This applies to all objects
50
- * in request bodies, response bodies, and properties that are objects or
51
- * arrays of objects.
78
+ * DO: Include detailed descriptions that reference the original Prisma
79
+ * schema comments and thoroughly document each property. DO: Use a $ref to
80
+ * a named type in the components.schemas section for every property that
81
+ * references an object.
82
+ *
83
+ * This applies to all objects in request bodies, response bodies, and
84
+ * properties that are objects or arrays of objects.
52
85
  *
53
86
  * Example structure:
54
87
  *
@@ -32,19 +32,16 @@ export namespace IAutoBeInterfaceSchemasReviewApplication {
32
32
  /**
33
33
  * Issues and problems found during schema analysis.
34
34
  *
35
- * IMPORTANT: Only document problems that need fixing. Do NOT include:
36
- *
37
- * - Positive feedback about what's already correct
38
- * - Compliments about well-structured schemas
39
- * - Confirmation that certain aspects meet standards
35
+ * DO: Document only problems that need fixing.
36
+ * DO NOT: Include positive feedback, compliments, or confirmations
40
37
  *
41
38
  * Focus exclusively on issues organized by severity:
42
39
  *
43
- * - CRITICAL: Security vulnerabilities (exposed passwords, missing auth
44
- * boundaries)
45
- * - HIGH: Missing required variants, incorrect type mappings
46
- * - MEDIUM: Missing format specifications, incomplete relationships
47
- * - LOW: Documentation improvements, style consistency
40
+ * Severity levels:
41
+ * - Security vulnerabilities (exposed passwords, missing auth boundaries)
42
+ * - Missing required variants, incorrect type mappings
43
+ * - Missing format specifications, incomplete relationships
44
+ * - Documentation improvements, style consistency
48
45
  *
49
46
  * Each issue must include the specific schema name and what needs to be
50
47
  * fixed. If there are no issues at all, simply state: "No issues found."
@@ -70,21 +67,18 @@ export namespace IAutoBeInterfaceSchemasReviewApplication {
70
67
  /**
71
68
  * Final validated and enhanced schemas ready for production use.
72
69
  *
73
- * CRITICAL REQUIREMENTS:
74
- *
75
- * - MUST NEVER be an empty object {}
76
- * - MUST contain valid OpenAPI schema definitions
77
- * - MUST include all entities that were in the original input
78
- * - If original schemas have critical issues, MUST contain fixed versions
79
- * - If entity names are wrong, MUST contain renamed correct versions
80
- * - If schemas are missing variants, MUST include the created variants
81
- *
82
- * FORBIDDEN:
70
+ * DO:
71
+ * - Include valid OpenAPI schema definitions
72
+ * - Include all entities that were in the original input
73
+ * - Provide fixed versions if original schemas have issues
74
+ * - Rename entities correctly if names are wrong
75
+ * - Include created variants if schemas are missing them
83
76
  *
84
- * - Empty object {} will cause all schemas to be deleted
85
- * - Returning undefined or null
86
- * - Including explanations or excuses in schema descriptions
87
- * - Leaving broken schemas unfixed
77
+ * DO NOT:
78
+ * - Return an empty object {} (this will delete all schemas)
79
+ * - Return undefined or null
80
+ * - Include explanations or excuses in schema descriptions
81
+ * - Leave broken schemas unfixed
88
82
  *
89
83
  * When original schemas are beyond repair, recreate them properly based on
90
84
  * entity names and context. This field becomes the final schemas used by
@@ -0,0 +1,41 @@
1
+ import { AutoBeOpenApi } from "@autobe/interface";
2
+ import { IValidation } from "typia";
3
+
4
+ export const validateAuthorizationSchema = (props: {
5
+ errors: IValidation.IError[];
6
+ schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
7
+ path: string;
8
+ }): void => {
9
+ for (const [key, value] of Object.entries(props.schemas)) {
10
+ if (!key.endsWith(".IAuthorized")) continue;
11
+
12
+ // Check if it's an object type
13
+ if (!isObjectSchema(value)) {
14
+ props.errors.push({
15
+ path: `${props.path}.${key}`,
16
+ expected: `AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema.IObject>`,
17
+ value: value,
18
+ description: `${key} must be an object type for authorization responses`,
19
+ });
20
+ continue;
21
+ }
22
+
23
+ // Check if token property exists
24
+ value.properties ??= {};
25
+ value.properties["token"] = {
26
+ $ref: "#/components/schemas/IAuthorizationToken",
27
+ description: "JWT token information for authentication",
28
+ } as AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema.IReference>;
29
+
30
+ value.required ??= [];
31
+ if (value.required.includes("token") === false) {
32
+ value.required.push("token");
33
+ }
34
+ }
35
+ };
36
+
37
+ const isObjectSchema = (
38
+ schema: AutoBeOpenApi.IJsonSchemaDescriptive,
39
+ ): schema is AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema.IObject> => {
40
+ return "type" in schema && schema.type === "object";
41
+ };
@@ -1,4 +1,5 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
+ import { NamingConvention } from "typia/lib/utils/NamingConvention";
2
3
  import { v4 } from "uuid";
3
4
 
4
5
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
@@ -11,18 +12,9 @@ export const transformPrismaComponentsHistories = (
11
12
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
12
13
  > => {
13
14
  if (state.analyze === null)
14
- return [
15
- {
16
- id: v4(),
17
- created_at: new Date().toISOString(),
18
- type: "systemMessage",
19
- text: [
20
- "Requirement analysis is not yet completed.",
21
- "Don't call any tool function,",
22
- "but say to process the requirement analysis.",
23
- ].join(" "),
24
- },
25
- ];
15
+ // unreachable
16
+ throw new Error("Analyze state is not set.");
17
+ if (prefix) prefix = NamingConvention.snake(prefix);
26
18
  return [
27
19
  {
28
20
  id: v4(),
@@ -50,13 +42,14 @@ export const transformPrismaComponentsHistories = (
50
42
  `* Prefix provided by the user: ${prefix}`,
51
43
  "",
52
44
  "The user wants all database schema (table) names to start with the prefix provided below.",
53
- "If the prefix is `null`, it should be ignored.",
54
- "If a prefix is provided, all table names **must begin with it**.",
55
- "However, if there is a special-purpose prefix like `mv` (for materialized views), it **must precede** the given prefix.",
45
+ "",
46
+ "DO: Use the provided prefix for all table names",
47
+ "DO: Place special-purpose prefixes like `mv` (for materialized views) before the given prefix",
48
+ "DO NOT: Apply prefix if it is `null`",
56
49
  "",
57
50
  "## Prefix Example",
58
51
  "",
59
- "If the prefix is `shopping`, then table names should be like:",
52
+ "If the prefix is `shopping`, then table names are like:",
60
53
  "",
61
54
  "* `shopping_sales`",
62
55
  "* `shopping_sale_options`",
@@ -10,9 +10,11 @@ import {
10
10
  } from "@autobe/interface";
11
11
  import { AutoBePrismaSchemasEvent } from "@autobe/interface/src/events/AutoBePrismaSchemasEvent";
12
12
  import { ILlmSchema } from "@samchon/openapi";
13
+ import { v4 } from "uuid";
13
14
 
14
15
  import { AutoBeContext } from "../../context/AutoBeContext";
15
16
  import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
17
+ import { predicateStateMessage } from "../../utils/predicateStateMessage";
16
18
  import { orchestratePrismaComponents } from "./orchestratePrismaComponent";
17
19
  import { orchestratePrismaCorrect } from "./orchestratePrismaCorrect";
18
20
  import { orchestratePrismaReview } from "./orchestratePrismaReview";
@@ -22,7 +24,17 @@ export const orchestratePrisma = async <Model extends ILlmSchema.Model>(
22
24
  ctx: AutoBeContext<Model>,
23
25
  props: IAutoBeApplicationProps,
24
26
  ): Promise<AutoBePrismaHistory | AutoBeAssistantMessageHistory> => {
27
+ // PREDICATION
25
28
  const start: Date = new Date();
29
+ const predicate: string | null = predicateStateMessage(ctx.state(), "prisma");
30
+ if (predicate !== null)
31
+ return ctx.assistantMessage({
32
+ type: "assistantMessage",
33
+ id: v4(),
34
+ created_at: start.toISOString(),
35
+ text: predicate,
36
+ completed_at: new Date().toISOString(),
37
+ });
26
38
  ctx.dispatch({
27
39
  type: "prismaStart",
28
40
  created_at: start.toISOString(),
@@ -31,12 +43,9 @@ export const orchestratePrisma = async <Model extends ILlmSchema.Model>(
31
43
  });
32
44
 
33
45
  // COMPONENTS
34
- const componentEvent:
35
- | AutoBeAssistantMessageHistory
36
- | AutoBePrismaComponentsEvent = await orchestratePrismaComponents(ctx);
37
- if (componentEvent.type === "assistantMessage")
38
- return ctx.assistantMessage(componentEvent);
39
- else ctx.dispatch(componentEvent);
46
+ const componentEvent: AutoBePrismaComponentsEvent =
47
+ await orchestratePrismaComponents(ctx);
48
+ ctx.dispatch(componentEvent);
40
49
 
41
50
  // CONSTRUCT AST DATA
42
51
  const schemaEvents: AutoBePrismaSchemasEvent[] =
@@ -1,13 +1,8 @@
1
- import {
2
- AgenticaAssistantMessageHistory,
3
- IAgenticaController,
4
- } from "@agentica/core";
5
- import { AutoBeAssistantMessageHistory } from "@autobe/interface";
1
+ import { IAgenticaController } from "@agentica/core";
6
2
  import { AutoBePrismaComponentsEvent } from "@autobe/interface/src/events/AutoBePrismaComponentsEvent";
7
3
  import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
8
4
  import { IPointer } from "tstl";
9
5
  import typia from "typia";
10
- import { v4 } from "uuid";
11
6
 
12
7
  import { AutoBeContext } from "../../context/AutoBeContext";
13
8
  import { assertSchemaModel } from "../../context/assertSchemaModel";
@@ -18,14 +13,14 @@ export async function orchestratePrismaComponents<
18
13
  Model extends ILlmSchema.Model,
19
14
  >(
20
15
  ctx: AutoBeContext<Model>,
21
- message: string = "Please extract files and tables from the given documents.",
22
- ): Promise<AutoBeAssistantMessageHistory | AutoBePrismaComponentsEvent> {
16
+ message: string = "Design database from the given requirement analysis documents.",
17
+ ): Promise<AutoBePrismaComponentsEvent> {
23
18
  const start: Date = new Date();
24
19
  const pointer: IPointer<IAutoBePrismaComponentApplication.IProps | null> = {
25
20
  value: null,
26
21
  };
27
22
  const prefix: string | null = ctx.state().analyze?.prefix ?? null;
28
- const { histories, tokenUsage } = await ctx.conversate({
23
+ const { tokenUsage } = await ctx.conversate({
29
24
  source: "prismaComponents",
30
25
  histories: transformPrismaComponentsHistories(ctx.state(), prefix),
31
26
  controller: createController({
@@ -34,19 +29,11 @@ export async function orchestratePrismaComponents<
34
29
  pointer.value = next;
35
30
  },
36
31
  }),
37
- enforceFunctionCall: false,
32
+ enforceFunctionCall: true,
38
33
  message,
39
34
  });
40
- if (histories.at(-1)?.type === "assistantMessage")
41
- return {
42
- ...(histories.at(-1)! as AgenticaAssistantMessageHistory),
43
- created_at: start.toISOString(),
44
- completed_at: new Date().toISOString(),
45
- id: v4(),
46
- } satisfies AutoBeAssistantMessageHistory;
47
- else if (pointer.value === null) {
35
+ if (pointer.value === null)
48
36
  throw new Error("Failed to extract files and tables."); // unreachable
49
- }
50
37
  return {
51
38
  type: "prismaComponents",
52
39
  created_at: start.toISOString(),
@@ -1,5 +1,5 @@
1
1
  import { IAgenticaController } from "@agentica/core";
2
- import { AutoBePrisma } from "@autobe/interface";
2
+ import { AutoBePrisma, AutoBeProgressEventBase } from "@autobe/interface";
3
3
  import { AutoBePrismaReviewEvent } from "@autobe/interface/src/events/AutoBePrismaReviewEvent";
4
4
  import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
5
5
  import { IPointer } from "tstl";
@@ -7,7 +7,6 @@ import typia from "typia";
7
7
 
8
8
  import { AutoBeContext } from "../../context/AutoBeContext";
9
9
  import { assertSchemaModel } from "../../context/assertSchemaModel";
10
- import { IProgress } from "../internal/IProgress";
11
10
  import { transformPrismaReviewHistories } from "./histories/transformPrismaReviewHistories";
12
11
  import { IAutoBePrismaReviewApplication } from "./structures/IAutoBePrismaReviewApplication";
13
12
 
@@ -17,15 +16,22 @@ export async function orchestratePrismaReview<Model extends ILlmSchema.Model>(
17
16
  schemas: Record<string, string>,
18
17
  componentList: AutoBePrisma.IComponent[],
19
18
  ): Promise<AutoBePrismaReviewEvent[]> {
20
- const progress: IProgress = {
19
+ const progress: AutoBeProgressEventBase = {
21
20
  completed: 0,
22
21
  total: componentList.length,
23
22
  };
24
- return await Promise.all(
25
- componentList.map((component) =>
26
- step(ctx, application, schemas, component, progress),
27
- ),
28
- );
23
+ return (
24
+ await Promise.all(
25
+ componentList.map(async (component) => {
26
+ try {
27
+ return await step(ctx, application, schemas, component, progress);
28
+ } catch {
29
+ ++progress.completed;
30
+ return null;
31
+ }
32
+ }),
33
+ )
34
+ ).filter((v) => v !== null);
29
35
  }
30
36
 
31
37
  async function step<Model extends ILlmSchema.Model>(
@@ -33,7 +39,7 @@ async function step<Model extends ILlmSchema.Model>(
33
39
  application: AutoBePrisma.IApplication,
34
40
  schemas: Record<string, string>,
35
41
  component: AutoBePrisma.IComponent,
36
- progress: IProgress,
42
+ progress: AutoBeProgressEventBase,
37
43
  ): Promise<AutoBePrismaReviewEvent> {
38
44
  const start: Date = new Date();
39
45
  const pointer: IPointer<IAutoBePrismaReviewApplication.IProps | null> = {
@@ -33,7 +33,7 @@ export const transformRealizeAuthorizationHistories = <
33
33
  "",
34
34
  "## Prisma Schema",
35
35
  "",
36
- JSON.stringify(ctx.state().prisma?.schemas, null, 2),
36
+ JSON.stringify(ctx.state().prisma?.schemas),
37
37
  "",
38
38
  "## Component Naming Convention",
39
39
  "",
@@ -40,33 +40,29 @@ export const transformRealizeAuthorizationCorrectHistories = <
40
40
  "## Generated TypeScript Code",
41
41
  "",
42
42
  "```json",
43
- `${JSON.stringify(
44
- {
45
- provider: {
46
- location: auth.provider.location,
47
- name: auth.provider.name,
48
- content: auth.provider.content,
49
- },
50
- decorator: {
51
- location: auth.decorator.location,
52
- name: auth.decorator.name,
53
- content: auth.decorator.content,
54
- },
55
- payload: {
56
- location: auth.payload.location,
57
- name: auth.payload.name,
58
- content: auth.payload.content,
59
- },
60
- } satisfies Omit<AutoBeRealizeAuthorization, "role">,
61
- null,
62
- 2,
63
- )}`,
43
+ `${JSON.stringify({
44
+ provider: {
45
+ location: auth.provider.location,
46
+ name: auth.provider.name,
47
+ content: auth.provider.content,
48
+ },
49
+ decorator: {
50
+ location: auth.decorator.location,
51
+ name: auth.decorator.name,
52
+ content: auth.decorator.content,
53
+ },
54
+ payload: {
55
+ location: auth.payload.location,
56
+ name: auth.payload.name,
57
+ content: auth.payload.content,
58
+ },
59
+ } satisfies Omit<AutoBeRealizeAuthorization, "role">)}`,
64
60
  "```",
65
61
  "",
66
62
  "## Prisma Schema",
67
63
  "",
68
64
  "```json",
69
- `${JSON.stringify(ctx.state().prisma?.schemas, null, 2)}`,
65
+ `${JSON.stringify(ctx.state().prisma?.schemas)}`,
70
66
  "```",
71
67
  "",
72
68
  "## File Paths",
@@ -80,7 +76,7 @@ export const transformRealizeAuthorizationCorrectHistories = <
80
76
  "Fix the compilation error in the provided code.",
81
77
  "",
82
78
  "```json",
83
- JSON.stringify(diagnostics, null, 2),
79
+ JSON.stringify(diagnostics),
84
80
  "```",
85
81
  "## Component Naming Convention",
86
82
  "",