@autobe/agent 0.25.7 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/lib/AutoBeAgent.d.ts +2 -1
  2. package/lib/AutoBeAgent.js +30 -7
  3. package/lib/AutoBeAgent.js.map +1 -1
  4. package/lib/AutoBeMockAgent.js +13 -12
  5. package/lib/AutoBeMockAgent.js.map +1 -1
  6. package/lib/constants/AutoBeSystemPromptConstant.d.ts +27 -20
  7. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  8. package/lib/context/AutoBeContext.d.ts +4 -1
  9. package/lib/context/AutoBeTokenUsage.d.ts +1 -1
  10. package/lib/context/AutoBeTokenUsage.js.map +1 -1
  11. package/lib/factory/AutoBeFunctionCallingMetricFactory.d.ts +7 -0
  12. package/lib/factory/AutoBeFunctionCallingMetricFactory.js +35 -0
  13. package/lib/factory/AutoBeFunctionCallingMetricFactory.js.map +1 -0
  14. package/lib/factory/AutoBeProcessAggregateFactory.d.ts +13 -0
  15. package/lib/factory/AutoBeProcessAggregateFactory.js +100 -0
  16. package/lib/factory/AutoBeProcessAggregateFactory.js.map +1 -0
  17. package/lib/factory/consentFunctionCall.js +3 -0
  18. package/lib/factory/consentFunctionCall.js.map +1 -1
  19. package/lib/factory/createAutoBeContext.d.ts +2 -1
  20. package/lib/factory/createAutoBeContext.js +82 -28
  21. package/lib/factory/createAutoBeContext.js.map +1 -1
  22. package/lib/factory/getCommonPrompt.d.ts +2 -0
  23. package/lib/factory/getCommonPrompt.js +20 -0
  24. package/lib/factory/getCommonPrompt.js.map +1 -0
  25. package/lib/index.mjs +20929 -19874
  26. package/lib/index.mjs.map +1 -1
  27. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
  28. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
  29. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
  30. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  31. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +6 -6
  32. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  33. package/lib/orchestrate/analyze/orchestrateAnalyze.js +2 -1
  34. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  35. package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js +2 -1
  36. package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
  37. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +75 -74
  38. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  39. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +5 -4
  40. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  41. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +9 -9
  42. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +1 -1
  43. package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +2 -17
  44. package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
  45. package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.d.ts +6 -0
  46. package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js +58 -0
  47. package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js.map +1 -0
  48. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.d.ts +2 -1
  49. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +3 -2
  50. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
  51. package/lib/{factory/createAutoBeApplication.d.ts → orchestrate/facade/createAutoBeFacadeController.d.ts} +2 -2
  52. package/lib/{factory/createAutoBeApplication.js → orchestrate/facade/createAutoBeFacadeController.js} +53 -57
  53. package/lib/orchestrate/facade/createAutoBeFacadeController.js.map +1 -0
  54. package/lib/orchestrate/facade/histories/IAutoBeFacadeApplication.js.map +1 -0
  55. package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationProps.js.map +1 -0
  56. package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationResult.js.map +1 -0
  57. package/lib/orchestrate/facade/{transformFacadeStateMessage.d.ts → structures/transformFacadeStateMessage.d.ts} +1 -1
  58. package/lib/orchestrate/facade/structures/transformFacadeStateMessage.js +46 -0
  59. package/lib/orchestrate/facade/structures/transformFacadeStateMessage.js.map +1 -0
  60. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +2 -2
  61. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +8 -8
  62. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  63. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
  64. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  65. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
  66. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  67. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +3 -2
  68. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
  69. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
  70. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  71. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
  72. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  73. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
  74. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  75. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +1 -0
  76. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +46 -20
  77. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  78. package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.d.ts +5 -0
  79. package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js +51 -0
  80. package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js.map +1 -0
  81. package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.d.ts +11 -0
  82. package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js +81 -0
  83. package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js.map +1 -0
  84. package/lib/orchestrate/interface/orchestrateInterface.d.ts +1 -1
  85. package/lib/orchestrate/interface/orchestrateInterface.js +33 -6
  86. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  87. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +185 -97
  88. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  89. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +234 -59
  90. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  91. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +5 -4
  92. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  93. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +0 -6
  94. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +4 -4
  95. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -1
  96. package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
  97. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +4 -3
  98. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  99. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +178 -90
  100. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  101. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +176 -88
  102. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  103. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +6 -5
  104. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -1
  105. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.d.ts +7 -0
  106. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +445 -0
  107. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -0
  108. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.d.ts +14 -0
  109. package/lib/orchestrate/interface/{orchestrateInterfaceSchemasReview.js → orchestrateInterfaceSchemaReview.js} +302 -121
  110. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -0
  111. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +243 -65
  112. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  113. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +22 -22
  114. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +7 -7
  115. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.d.ts +101 -0
  116. package/lib/orchestrate/interface/structures/{IAutobeInterfaceSchemasReviewApplication.js → IAutoBeInterfaceSchemaContentReviewApplication.js} +1 -1
  117. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.js.map +1 -0
  118. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.d.ts +97 -0
  119. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js +3 -0
  120. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js.map +1 -0
  121. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.d.ts +44 -0
  122. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.js +3 -0
  123. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.js.map +1 -0
  124. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.d.ts +92 -0
  125. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js +3 -0
  126. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js.map +1 -0
  127. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +65 -24
  128. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
  129. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +94 -0
  130. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
  131. package/lib/orchestrate/interface/utils/OperationValidator.d.ts +1 -1
  132. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +13 -13
  133. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  134. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
  135. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  136. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
  137. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  138. package/lib/orchestrate/prisma/orchestratePrisma.d.ts +1 -1
  139. package/lib/orchestrate/prisma/orchestratePrisma.js +1 -0
  140. package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  141. package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +2 -2
  142. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +4 -3
  143. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  144. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +2 -1
  145. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  146. package/lib/orchestrate/prisma/orchestratePrismaReview.js +2 -1
  147. package/lib/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
  148. package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +2 -2
  149. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +4 -3
  150. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  151. package/lib/orchestrate/realize/histories/transformRealizeAuthorization.d.ts +2 -2
  152. package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js +8 -7
  153. package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
  154. package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +4 -4
  155. package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  156. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.d.ts +4 -7
  157. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +8 -18
  158. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -1
  159. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +0 -1
  160. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +8 -28
  161. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  162. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +1 -1
  163. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +16 -280
  164. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
  165. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +1 -1
  166. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  167. package/lib/orchestrate/realize/orchestrateRealize.d.ts +1 -1
  168. package/lib/orchestrate/realize/orchestrateRealize.js +4 -3
  169. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  170. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +14 -13
  171. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  172. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +12 -11
  173. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  174. package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +1 -1
  175. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +46 -24
  176. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  177. package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.js → orchestrateRealizeCorrectCasting.js} +64 -51
  178. package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -0
  179. package/lib/orchestrate/realize/orchestrateRealizeWrite.js +2 -1
  180. package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  181. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
  182. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.d.ts +2 -2
  183. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js +6 -6
  184. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js.map +1 -1
  185. package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -1
  186. package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
  187. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +2 -2
  188. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
  189. package/lib/orchestrate/realize/utils/getRealizeWriteDto.js +1 -1
  190. package/lib/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -1
  191. package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js +2 -2
  192. package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -1
  193. package/lib/orchestrate/realize/utils/printErrorHints.js +1 -1
  194. package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -1
  195. package/lib/orchestrate/realize/utils/replaceImportStatements.js +0 -85
  196. package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  197. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +1 -1
  198. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
  199. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +5 -22
  200. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  201. package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +10 -10
  202. package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
  203. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +5 -5
  204. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  205. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +2 -2
  206. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
  207. package/lib/orchestrate/test/orchestrateTest.d.ts +1 -1
  208. package/lib/orchestrate/test/orchestrateTest.js +2 -1
  209. package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
  210. package/lib/orchestrate/test/orchestrateTestCorrect.js +5 -1
  211. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  212. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +4 -2
  213. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
  214. package/lib/orchestrate/test/orchestrateTestScenario.js +28 -27
  215. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  216. package/lib/orchestrate/test/orchestrateTestScenarioReview.js +4 -3
  217. package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
  218. package/lib/orchestrate/test/orchestrateTestWrite.js +2 -1
  219. package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  220. package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.d.ts → IAutoBeTestScenarioAuthorizationActor.d.ts} +1 -1
  221. package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.js → IAutoBeTestScenarioAuthorizationActor.js} +1 -1
  222. package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationActor.js.map +1 -0
  223. package/lib/utils/TokenUsageComputer.d.ts +5 -0
  224. package/lib/utils/TokenUsageComputer.js +29 -0
  225. package/lib/utils/TokenUsageComputer.js.map +1 -0
  226. package/package.json +7 -7
  227. package/src/AutoBeAgent.ts +43 -6
  228. package/src/AutoBeMockAgent.ts +13 -12
  229. package/src/constants/AutoBeSystemPromptConstant.ts +27 -20
  230. package/src/context/AutoBeContext.ts +8 -0
  231. package/src/context/AutoBeTokenUsage.ts +1 -1
  232. package/src/factory/AutoBeFunctionCallingMetricFactory.ts +44 -0
  233. package/src/factory/AutoBeProcessAggregateFactory.ts +141 -0
  234. package/src/factory/consentFunctionCall.ts +4 -0
  235. package/src/factory/createAutoBeContext.ts +101 -37
  236. package/src/factory/getCommonPrompt.ts +25 -0
  237. package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +5 -5
  238. package/src/orchestrate/analyze/orchestrateAnalyze.ts +2 -1
  239. package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +2 -1
  240. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +5 -4
  241. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +3 -2
  242. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +9 -9
  243. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +1 -1
  244. package/src/orchestrate/common/histories/transformCommonCorrectCastingHistories.ts +2 -20
  245. package/src/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.ts +65 -0
  246. package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +5 -2
  247. package/src/orchestrate/facade/createAutoBeFacadeController.ts +135 -0
  248. package/src/orchestrate/facade/{transformFacadeStateMessage.ts → structures/transformFacadeStateMessage.ts} +2 -2
  249. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +9 -9
  250. package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +1 -0
  251. package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +45 -20
  252. package/src/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.ts +55 -0
  253. package/src/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.ts +90 -0
  254. package/src/orchestrate/interface/orchestrateInterface.ts +47 -16
  255. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +20 -19
  256. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +2 -1
  257. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +7 -6
  258. package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +5 -6
  259. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +7 -6
  260. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +25 -24
  261. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +6 -5
  262. package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +4 -3
  263. package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +270 -0
  264. package/src/orchestrate/interface/{orchestrateInterfaceSchemasReview.ts → orchestrateInterfaceSchemaReview.ts} +89 -76
  265. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +18 -9
  266. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +26 -22
  267. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +7 -7
  268. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.ts +108 -0
  269. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.ts +104 -0
  270. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.ts +45 -0
  271. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.ts +99 -0
  272. package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +45 -3
  273. package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +110 -0
  274. package/src/orchestrate/interface/utils/OperationValidator.ts +1 -1
  275. package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +12 -12
  276. package/src/orchestrate/prisma/orchestratePrisma.ts +6 -5
  277. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +6 -5
  278. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +2 -1
  279. package/src/orchestrate/prisma/orchestratePrismaReview.ts +2 -1
  280. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +9 -8
  281. package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +8 -7
  282. package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +4 -4
  283. package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +14 -28
  284. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -30
  285. package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +20 -285
  286. package/src/orchestrate/realize/orchestrateRealize.ts +4 -3
  287. package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +11 -10
  288. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +5 -4
  289. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +77 -62
  290. package/src/orchestrate/realize/{orchestRateRealizeCorrectCasting.ts → orchestrateRealizeCorrectCasting.ts} +92 -90
  291. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +2 -1
  292. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +3 -3
  293. package/src/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.ts +10 -7
  294. package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -1
  295. package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +2 -2
  296. package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +1 -1
  297. package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +2 -2
  298. package/src/orchestrate/realize/utils/printErrorHints.ts +1 -1
  299. package/src/orchestrate/realize/utils/replaceImportStatements.ts +0 -90
  300. package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +1 -1
  301. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +6 -24
  302. package/src/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.ts +10 -10
  303. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +12 -10
  304. package/src/orchestrate/test/orchestrateTest.ts +3 -2
  305. package/src/orchestrate/test/orchestrateTestCorrect.ts +5 -1
  306. package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +4 -2
  307. package/src/orchestrate/test/orchestrateTestScenario.ts +32 -31
  308. package/src/orchestrate/test/orchestrateTestScenarioReview.ts +4 -3
  309. package/src/orchestrate/test/orchestrateTestWrite.ts +2 -1
  310. package/src/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.ts → IAutoBeTestScenarioAuthorizationActor.ts} +1 -1
  311. package/src/utils/TokenUsageComputer.ts +35 -0
  312. package/lib/context/IAutoBeFacadeApplication.js.map +0 -1
  313. package/lib/context/IAutoBeFacadeApplicationProps.js.map +0 -1
  314. package/lib/context/IAutoBeFacadeApplicationResult.js.map +0 -1
  315. package/lib/factory/createAutoBeApplication.js.map +0 -1
  316. package/lib/orchestrate/facade/transformFacadeStateMessage.js +0 -46
  317. package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +0 -1
  318. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +0 -4
  319. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +0 -60
  320. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +0 -1
  321. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +0 -9
  322. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +0 -1
  323. package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +0 -91
  324. package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.js.map +0 -1
  325. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +0 -1
  326. package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.js.map +0 -1
  327. package/src/factory/createAutoBeApplication.ts +0 -123
  328. package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +0 -67
  329. package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +0 -96
  330. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.d.ts +0 -0
  331. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.js +0 -0
  332. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.d.ts +0 -0
  333. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.js +0 -0
  334. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.d.ts +0 -0
  335. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.js +0 -0
  336. /package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.d.ts → orchestrateRealizeCorrectCasting.d.ts} +0 -0
  337. /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.ts +0 -0
  338. /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.ts +0 -0
  339. /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.ts +0 -0
@@ -13,6 +13,7 @@ export namespace JsonSchemaValidator {
13
13
  export const validateSchemas = (props: IProps): void => {
14
14
  validateAuthorization(props);
15
15
  validatePrismaSchema(props.errors);
16
+ validateRecursive(props);
16
17
  for (const key of Object.keys(props.schemas))
17
18
  validateKey({
18
19
  errors: props.errors,
@@ -174,4 +175,113 @@ export namespace JsonSchemaValidator {
174
175
  `;
175
176
  }
176
177
  };
178
+
179
+ const validateRecursive = (props: IProps): void => {
180
+ for (const [key, value] of Object.entries(props.schemas)) {
181
+ const report = (description: string) =>
182
+ props.errors.push({
183
+ path: `${props.path}[${JSON.stringify(key)}]`,
184
+ expected: "Non-infinite recursive schema definition",
185
+ value,
186
+ description,
187
+ });
188
+ if (
189
+ AutoBeOpenApiTypeChecker.isReference(value) &&
190
+ value.$ref === `#/components/schemas/${key}`
191
+ )
192
+ report(StringUtil.trim`
193
+ You have defined a nonsensible type like below:
194
+
195
+ \`\`\`typescript
196
+ type ${key} = ${key};
197
+ \`\`\`
198
+
199
+ This is an infinite recursive type definition that cannot exist in any
200
+ programming language. A type cannot be defined as itself - this creates
201
+ a circular definition with no base case, making the type impossible to
202
+ instantiate or validate.
203
+
204
+ If you need tree or graph structures, use explicit relationships with
205
+ ID references (e.g., parentId: string) instead of recursive type definitions.
206
+ Remove the self-reference and redesign the schema at the next time.
207
+ `);
208
+ else if (
209
+ AutoBeOpenApiTypeChecker.isArray(value) &&
210
+ AutoBeOpenApiTypeChecker.isReference(value.items) &&
211
+ value.items.$ref === `#/components/schemas/${key}`
212
+ )
213
+ report(StringUtil.trim`
214
+ You have defined a nonsensible type like below:
215
+
216
+ \`\`\`typescript
217
+ type ${key} = Array<${key}>;
218
+ \`\`\`
219
+
220
+ This is an infinite recursive array type that cannot exist in any
221
+ programming language. An array of itself creates a circular definition
222
+ with no base case, making the type impossible to instantiate or validate.
223
+
224
+ If you need nested structures, define explicit depth levels with separate
225
+ types, or use parent-child relationships with ID references.
226
+ Remove the self-reference and redesign the schema at the next time.
227
+ `);
228
+ else if (
229
+ AutoBeOpenApiTypeChecker.isOneOf(value) &&
230
+ value.oneOf.some(
231
+ (v) =>
232
+ AutoBeOpenApiTypeChecker.isReference(v) &&
233
+ v.$ref === `#/components/schemas/${key}`,
234
+ ) === true
235
+ )
236
+ report(StringUtil.trim`
237
+ You have defined a nonsensible type like below:
238
+
239
+ \`\`\`typescript
240
+ type ${key} = ${key} | ...;
241
+ \`\`\`
242
+
243
+ This is an infinite recursive union type that cannot exist in any
244
+ programming language. A union that includes itself as a variant creates
245
+ a circular definition with no base case, making the type impossible to
246
+ instantiate or validate.
247
+
248
+ If you need polymorphic hierarchies, define separate concrete types for
249
+ each variant without including the union type itself as a variant.
250
+ Remove the self-reference and redesign the schema at the next time.
251
+ `);
252
+ else if (
253
+ AutoBeOpenApiTypeChecker.isObject(value) &&
254
+ value.properties &&
255
+ value.required &&
256
+ Object.entries(value.properties).some(
257
+ ([k, v]) =>
258
+ AutoBeOpenApiTypeChecker.isReference(v) &&
259
+ v.$ref === `#/components/schemas/${key}` &&
260
+ value.required.includes(k),
261
+ )
262
+ )
263
+ report(StringUtil.trim`
264
+ You have defined a nonsensible type like below:
265
+
266
+ \`\`\`typescript
267
+ interface ${key} {
268
+ someProperty: ${key}; // required, non-nullable
269
+ }
270
+ \`\`\`
271
+
272
+ This is an infinite recursive object type that cannot exist in any
273
+ programming language. A required non-nullable property referencing its
274
+ own type creates a circular definition with no base case, making the
275
+ type impossible to instantiate.
276
+
277
+ To create an instance of ${key}, you would need an instance of ${key},
278
+ which requires another instance of ${key}, infinitely. This is logically
279
+ impossible.
280
+
281
+ If you need parent-child or graph relationships, make the self-referencing
282
+ property either nullable or optional, or use ID references (e.g., parentId: string).
283
+ Remove the required self-reference and redesign the schema at the next time.
284
+ `);
285
+ }
286
+ };
177
287
  }
@@ -14,7 +14,7 @@ export namespace OperationValidator {
14
14
  operations: Array<
15
15
  Omit<
16
16
  AutoBeOpenApi.IOperation,
17
- "authorizationRole" | "authorizationType" | "prerequisites"
17
+ "authorizationActor" | "authorizationType" | "prerequisites"
18
18
  >
19
19
  >;
20
20
  }): void => {
@@ -65,19 +65,19 @@ export const transformPrismaComponentsHistories = (
65
65
  - \`mv_shopping_daily_stats\`
66
66
 
67
67
  ${
68
- state.analyze.roles.length > 0
68
+ state.analyze.actors.length > 0
69
69
  ? StringUtil.trim`
70
- ## User Role Handling
71
-
72
- The Requirement Analysis Report contains the following user roles: ${state.analyze.roles.join(", ")}
73
-
74
- **Do not normalize** user roles into a single table.
75
- Instead, create separate tables for each distinct role mentioned in the requirements.
76
-
77
- Create separate tables for each role:
78
-
79
- ${state.analyze.roles
80
- .map((role) => `- ${props.prefix}_${role.name.toLowerCase()}`)
70
+ ## User Actor Handling
71
+
72
+ The Requirement Analysis Report contains the following user actors: ${state.analyze.actors.join(", ")}
73
+
74
+ **Do not normalize** user actors into a single table.
75
+ Instead, create separate tables for each distinct actor mentioned in the requirements.
76
+
77
+ Create separate tables for each actor:
78
+
79
+ ${state.analyze.actors
80
+ .map((actor) => `- ${props.prefix}_${actor.name.toLowerCase()}`)
81
81
  .join("\n")}
82
82
  `
83
83
  : ""
@@ -2,19 +2,19 @@ import {
2
2
  AutoBeAssistantMessageHistory,
3
3
  AutoBePrisma,
4
4
  AutoBePrismaCompleteEvent,
5
- AutoBePrismaComponentsEvent,
5
+ AutoBePrismaComponentEvent,
6
6
  AutoBePrismaHistory,
7
7
  AutoBePrismaReviewEvent,
8
8
  IAutoBeCompiler,
9
9
  IAutoBePrismaValidation,
10
10
  } from "@autobe/interface";
11
- import { AutoBePrismaSchemasEvent } from "@autobe/interface/src/events/AutoBePrismaSchemasEvent";
11
+ import { AutoBePrismaSchemaEvent } from "@autobe/interface/src/events/AutoBePrismaSchemaEvent";
12
12
  import { ILlmSchema } from "@samchon/openapi";
13
13
  import { v7 } from "uuid";
14
14
 
15
15
  import { AutoBeContext } from "../../context/AutoBeContext";
16
- import { IAutoBeFacadeApplicationProps } from "../../context/IAutoBeFacadeApplicationProps";
17
16
  import { predicateStateMessage } from "../../utils/predicateStateMessage";
17
+ import { IAutoBeFacadeApplicationProps } from "../facade/histories/IAutoBeFacadeApplicationProps";
18
18
  import { orchestratePrismaComponents } from "./orchestratePrismaComponent";
19
19
  import { orchestratePrismaCorrect } from "./orchestratePrismaCorrect";
20
20
  import { orchestratePrismaReview } from "./orchestratePrismaReview";
@@ -44,12 +44,12 @@ export const orchestratePrisma = async <Model extends ILlmSchema.Model>(
44
44
  });
45
45
 
46
46
  // COMPONENTS
47
- const componentEvent: AutoBePrismaComponentsEvent =
47
+ const componentEvent: AutoBePrismaComponentEvent =
48
48
  await orchestratePrismaComponents(ctx, props.instruction);
49
49
  ctx.dispatch(componentEvent);
50
50
 
51
51
  // CONSTRUCT AST DATA
52
- const schemaEvents: AutoBePrismaSchemasEvent[] =
52
+ const schemaEvents: AutoBePrismaSchemaEvent[] =
53
53
  await orchestratePrismaSchemas(
54
54
  ctx,
55
55
  props.instruction,
@@ -104,6 +104,7 @@ export const orchestratePrisma = async <Model extends ILlmSchema.Model>(
104
104
  compiled: await compiler.prisma.compile({
105
105
  files: finalSchemas,
106
106
  }),
107
+ aggregates: ctx.getCurrentAggregates("prisma"),
107
108
  step: ctx.state().analyze?.step ?? 0,
108
109
  elapsed: new Date().getTime() - start.getTime(),
109
110
  created_at: new Date().toISOString(),
@@ -1,5 +1,5 @@
1
1
  import { IAgenticaController } from "@agentica/core";
2
- import { AutoBePrismaComponentsEvent } from "@autobe/interface/src/events/AutoBePrismaComponentsEvent";
2
+ import { AutoBePrismaComponentEvent } from "@autobe/interface/src/events/AutoBePrismaComponentEvent";
3
3
  import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
4
4
  import { IPointer } from "tstl";
5
5
  import typia from "typia";
@@ -16,14 +16,14 @@ export async function orchestratePrismaComponents<
16
16
  ctx: AutoBeContext<Model>,
17
17
  instruction: string,
18
18
  message: string = "Design database from the given requirement analysis documents.",
19
- ): Promise<AutoBePrismaComponentsEvent> {
19
+ ): Promise<AutoBePrismaComponentEvent> {
20
20
  const start: Date = new Date();
21
21
  const pointer: IPointer<IAutoBePrismaComponentApplication.IProps | null> = {
22
22
  value: null,
23
23
  };
24
24
  const prefix: string | null = ctx.state().analyze?.prefix ?? null;
25
- const { tokenUsage } = await ctx.conversate({
26
- source: "prismaComponents",
25
+ const { metric, tokenUsage } = await ctx.conversate({
26
+ source: "prismaComponent",
27
27
  histories: transformPrismaComponentsHistories(ctx.state(), {
28
28
  prefix,
29
29
  instruction,
@@ -40,13 +40,14 @@ export async function orchestratePrismaComponents<
40
40
  if (pointer.value === null)
41
41
  throw new Error("Failed to extract files and tables."); // unreachable
42
42
  return {
43
- type: "prismaComponents",
43
+ type: "prismaComponent",
44
44
  id: v7(),
45
45
  created_at: start.toISOString(),
46
46
  thinking: pointer.value.thinking,
47
47
  review: pointer.value.review,
48
48
  decision: pointer.value.decision,
49
49
  components: pointer.value.components,
50
+ metric,
50
51
  tokenUsage,
51
52
  step: ctx.state().analyze?.step ?? 0,
52
53
  };
@@ -116,7 +116,7 @@ async function execute<Model extends ILlmSchema.Model>(
116
116
  const pointer: IPointer<IAutoBePrismaCorrectApplication.IProps | null> = {
117
117
  value: null,
118
118
  };
119
- const { tokenUsage } = await ctx.conversate({
119
+ const { metric, tokenUsage } = await ctx.conversate({
120
120
  source: "prismaCorrect",
121
121
  histories: transformPrismaCorrectHistories(failure),
122
122
  controller: createController({
@@ -149,6 +149,7 @@ async function execute<Model extends ILlmSchema.Model>(
149
149
  failure,
150
150
  planning: pointer.value.planning,
151
151
  correction: correction,
152
+ metric,
152
153
  tokenUsage,
153
154
  step: ctx.state().analyze?.step ?? 0,
154
155
  created_at: new Date().toISOString(),
@@ -56,7 +56,7 @@ async function step<Model extends ILlmSchema.Model>(
56
56
  const pointer: IPointer<IAutoBePrismaReviewApplication.IProps | null> = {
57
57
  value: null,
58
58
  };
59
- const { tokenUsage } = await ctx.conversate({
59
+ const { metric, tokenUsage } = await ctx.conversate({
60
60
  source: "prismaReview",
61
61
  histories: transformPrismaReviewHistories({
62
62
  analysis:
@@ -90,6 +90,7 @@ async function step<Model extends ILlmSchema.Model>(
90
90
  review: pointer.value.review,
91
91
  plan: pointer.value.plan,
92
92
  modifications: pointer.value.modifications,
93
+ metric,
93
94
  tokenUsage,
94
95
  completed: ++props.progress.completed,
95
96
  total: props.progress.total,
@@ -1,6 +1,6 @@
1
1
  import { IAgenticaController } from "@agentica/core";
2
2
  import { AutoBePrisma } from "@autobe/interface";
3
- import { AutoBePrismaSchemasEvent } from "@autobe/interface/src/events/AutoBePrismaSchemasEvent";
3
+ import { AutoBePrismaSchemaEvent } from "@autobe/interface/src/events/AutoBePrismaSchemaEvent";
4
4
  import { StringUtil } from "@autobe/utils";
5
5
  import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
6
6
  import { IPointer } from "tstl";
@@ -17,7 +17,7 @@ export async function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(
17
17
  ctx: AutoBeContext<Model>,
18
18
  instruction: string,
19
19
  componentList: AutoBePrisma.IComponent[],
20
- ): Promise<AutoBePrismaSchemasEvent[]> {
20
+ ): Promise<AutoBePrismaSchemaEvent[]> {
21
21
  const start: Date = new Date();
22
22
  const total: number = componentList
23
23
  .map((c) => c.tables.length)
@@ -29,7 +29,7 @@ export async function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(
29
29
  .filter((y) => component !== y)
30
30
  .map((c) => c.tables)
31
31
  .flat();
32
- const event: AutoBePrismaSchemasEvent = await process(ctx, {
32
+ const event: AutoBePrismaSchemaEvent = await process(ctx, {
33
33
  instruction,
34
34
  component,
35
35
  otherTables,
@@ -55,12 +55,12 @@ async function process<Model extends ILlmSchema.Model>(
55
55
  completed: IPointer<number>;
56
56
  promptCacheKey: string;
57
57
  },
58
- ): Promise<AutoBePrismaSchemasEvent> {
58
+ ): Promise<AutoBePrismaSchemaEvent> {
59
59
  const pointer: IPointer<IAutoBePrismaSchemaApplication.IProps | null> = {
60
60
  value: null,
61
61
  };
62
- const { tokenUsage } = await ctx.conversate({
63
- source: "prismaSchemas",
62
+ const { metric, tokenUsage } = await ctx.conversate({
63
+ source: "prismaSchema",
64
64
  histories: transformPrismaSchemaHistories({
65
65
  analysis:
66
66
  ctx
@@ -87,7 +87,7 @@ async function process<Model extends ILlmSchema.Model>(
87
87
  if (pointer.value === null)
88
88
  throw new Error("Unreachable code: Prisma Schema not generated");
89
89
  return {
90
- type: "prismaSchemas",
90
+ type: "prismaSchema",
91
91
  id: v7(),
92
92
  created_at: props.start.toISOString(),
93
93
  plan: pointer.value.plan,
@@ -97,11 +97,12 @@ async function process<Model extends ILlmSchema.Model>(
97
97
  namespace: props.component.namespace,
98
98
  models: pointer.value.models,
99
99
  },
100
+ metric,
100
101
  tokenUsage,
101
102
  completed: (props.completed.value += props.component.tables.length),
102
103
  total: props.total,
103
104
  step: ctx.state().analyze?.step ?? 0,
104
- } satisfies AutoBePrismaSchemasEvent;
105
+ } satisfies AutoBePrismaSchemaEvent;
105
106
  }
106
107
 
107
108
  function createController<Model extends ILlmSchema.Model>(
@@ -1,5 +1,5 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
- import { AutoBeAnalyzeRole } from "@autobe/interface";
2
+ import { AutoBeAnalyzeActor } from "@autobe/interface";
3
3
  import { StringUtil } from "@autobe/utils";
4
4
  import { ILlmSchema } from "@samchon/openapi";
5
5
  import { v7 } from "uuid";
@@ -11,7 +11,7 @@ export const transformRealizeAuthorizationHistories = <
11
11
  Model extends ILlmSchema.Model,
12
12
  >(
13
13
  ctx: AutoBeContext<Model>,
14
- role: AutoBeAnalyzeRole,
14
+ actor: AutoBeAnalyzeActor,
15
15
  ): Array<
16
16
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
17
17
  > => {
@@ -27,9 +27,10 @@ export const transformRealizeAuthorizationHistories = <
27
27
  created_at: new Date().toISOString(),
28
28
  type: "systemMessage",
29
29
  text: StringUtil.trim`
30
- ## Role
30
+ ## Actor
31
+
31
32
  \`\`\`json
32
- ${JSON.stringify(role)}
33
+ ${JSON.stringify(actor)}
33
34
  \`\`\`
34
35
 
35
36
  ## Prisma Schema
@@ -42,9 +43,9 @@ export const transformRealizeAuthorizationHistories = <
42
43
 
43
44
  Please follow this naming convention for the authorization components:
44
45
 
45
- - Provider Name: ${role.name}Authorize (e.g. ${role.name}Authorize)
46
- - Decorator Name: ${role.name.charAt(0).toUpperCase() + role.name.slice(1)}Auth (e.g. ${role.name.charAt(0).toUpperCase() + role.name.slice(1)}Auth)
47
- - Payload Name: ${role.name.charAt(0).toUpperCase() + role.name.slice(1)}Payload (e.g. ${role.name.charAt(0).toUpperCase() + role.name.slice(1)}Payload)
46
+ - Provider Name: ${actor.name}Authorize (e.g. ${actor.name}Authorize)
47
+ - Decorator Name: ${actor.name.charAt(0).toUpperCase() + actor.name.slice(1)}Auth (e.g. ${actor.name.charAt(0).toUpperCase() + actor.name.slice(1)}Auth)
48
+ - Payload Name: ${actor.name.charAt(0).toUpperCase() + actor.name.slice(1)}Payload (e.g. ${actor.name.charAt(0).toUpperCase() + actor.name.slice(1)}Payload)
48
49
  `,
49
50
  },
50
51
  ];
@@ -57,7 +57,7 @@ export const transformRealizeAuthorizationCorrectHistories = <
57
57
  name: auth.payload.name,
58
58
  content: auth.payload.content,
59
59
  },
60
- } satisfies Omit<AutoBeRealizeAuthorization, "role">)}
60
+ } satisfies Omit<AutoBeRealizeAuthorization, "actor">)}
61
61
  \`\`\`
62
62
 
63
63
  ## Prisma Schema
@@ -86,9 +86,9 @@ export const transformRealizeAuthorizationCorrectHistories = <
86
86
 
87
87
  Please follow this naming convention for the authorization components:
88
88
 
89
- - Provider Name: ${auth.role.name.toLowerCase()}Authorize (e.g. ${auth.role.name.toLowerCase()}Authorize)
90
- - Decorator Name: ${auth.role.name.charAt(0).toUpperCase() + auth.role.name.slice(1).toLowerCase()}Auth (e.g. ${auth.role.name.charAt(0).toUpperCase() + auth.role.name.slice(1).toLowerCase()}Auth)
91
- - Payload Name: ${auth.role.name.charAt(0).toUpperCase() + auth.role.name.slice(1).toLowerCase()}Payload (e.g. ${auth.role.name.charAt(0).toUpperCase() + auth.role.name.slice(1).toLowerCase()}Payload)
89
+ - Provider Name: ${auth.actor.name.toLowerCase()}Authorize (e.g. ${auth.actor.name.toLowerCase()}Authorize)
90
+ - Decorator Name: ${auth.actor.name.charAt(0).toUpperCase() + auth.actor.name.slice(1).toLowerCase()}Auth (e.g. ${auth.actor.name.charAt(0).toUpperCase() + auth.actor.name.slice(1).toLowerCase()}Auth)
91
+ - Payload Name: ${auth.actor.name.charAt(0).toUpperCase() + auth.actor.name.slice(1).toLowerCase()}Payload (e.g. ${auth.actor.name.charAt(0).toUpperCase() + auth.actor.name.slice(1).toLowerCase()}Payload)
92
92
  `,
93
93
  },
94
94
  ];
@@ -1,44 +1,30 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
- import { IAutoBeTypeScriptCompileResult } from "@autobe/interface";
3
- import { StringUtil } from "@autobe/utils";
4
2
  import { v7 } from "uuid";
5
3
 
6
4
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
7
- import { printErrorHints } from "../utils/printErrorHints";
5
+ import { transformPreviousAndLatestCorrectHistories } from "../../common/histories/transformPreviousAndLatestCorrectHistories";
6
+ import { IAutoBeRealizeFunctionFailure } from "../structures/IAutoBeRealizeFunctionFailure";
8
7
 
9
- interface IFailure {
10
- diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[];
11
- script: string;
12
- }
13
-
14
- export const transformRealizeCorrectCastingHistories = (
15
- failures: IFailure[],
16
- ): Array<
8
+ export const transformRealizeCorrectCastingHistories = (props: {
9
+ failures: IAutoBeRealizeFunctionFailure[];
10
+ }): Array<
17
11
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
18
12
  > => {
19
- return [
13
+ const histories: Array<
14
+ IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
15
+ > = [
20
16
  {
21
17
  id: v7(),
22
18
  created_at: new Date().toISOString(),
23
19
  type: "systemMessage",
24
20
  text: AutoBeSystemPromptConstant.COMMON_CORRECT_CASTING,
25
21
  },
26
- ...failures.map(
27
- (f) =>
28
- ({
29
- id: v7(),
30
- created_at: new Date().toISOString(),
31
- type: "assistantMessage",
32
- text: StringUtil.trim`
33
- # Errors
34
-
35
- This is a past code and an error with the code.
36
- Please refer to the annotation for the location of the error.
37
-
38
- ${printErrorHints(f.script, f.diagnostics)}
39
- \`\`\`
40
- `,
41
- }) satisfies IAgenticaHistoryJson.IAssistantMessage,
22
+ ...transformPreviousAndLatestCorrectHistories(
23
+ props.failures.map((f) => ({
24
+ script: f.function.content,
25
+ diagnostics: f.diagnostics,
26
+ })),
42
27
  ),
43
28
  ];
29
+ return histories;
44
30
  };
@@ -1,13 +1,12 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { AutoBeRealizeAuthorization } from "@autobe/interface";
3
- import { StringUtil } from "@autobe/utils";
4
3
  import { v7 } from "uuid";
5
4
 
6
5
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
7
6
  import { AutoBeState } from "../../../context/AutoBeState";
7
+ import { transformPreviousAndLatestCorrectHistories } from "../../common/histories/transformPreviousAndLatestCorrectHistories";
8
8
  import { IAutoBeRealizeFunctionFailure } from "../structures/IAutoBeRealizeFunctionFailure";
9
9
  import { IAutoBeRealizeScenarioResult } from "../structures/IAutoBeRealizeScenarioResult";
10
- import { printErrorHints } from "../utils/printErrorHints";
11
10
  import { transformRealizeWriteHistories } from "./transformRealizeWriteHistories";
12
11
 
13
12
  export function transformRealizeCorrectHistories(props: {
@@ -15,49 +14,33 @@ export function transformRealizeCorrectHistories(props: {
15
14
  scenario: IAutoBeRealizeScenarioResult;
16
15
  authorization: AutoBeRealizeAuthorization | null;
17
16
  totalAuthorizations: AutoBeRealizeAuthorization[];
18
- code: string;
19
17
  dto: Record<string, string>;
20
18
  failures: IAutoBeRealizeFunctionFailure[];
21
19
  }): Array<
22
20
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
23
21
  > {
24
- return [
22
+ const histories: Array<
23
+ IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
24
+ > = [
25
25
  ...transformRealizeWriteHistories(props),
26
26
  {
27
27
  id: v7(),
28
28
  created_at: new Date().toISOString(),
29
29
  type: "systemMessage",
30
30
  text: AutoBeSystemPromptConstant.COMMON_CORRECT_CASTING,
31
- },
32
- {
33
- id: v7(),
34
- type: "assistantMessage",
35
- text: StringUtil.trim`
36
- Below is the code you made before. It's also something to review.
37
-
38
- \`\`\`typescript
39
- ${props.code}
40
- \`\`\`
41
- `,
42
- created_at: new Date().toISOString(),
43
- },
44
- ...props.failures.map((f) => {
45
- return {
46
- id: v7(),
47
- type: "assistantMessage",
48
- text: StringUtil.trim`
49
- This is a past code and an error with the code. Please refer to the annotation for the location of the error.
50
-
51
- ${printErrorHints(f.function.content, f.diagnostics)}
52
- `,
53
- created_at: new Date().toISOString(),
54
- } satisfies IAgenticaHistoryJson.IAssistantMessage;
55
- }),
31
+ } as IAgenticaHistoryJson.ISystemMessage,
56
32
  {
57
33
  id: v7(),
58
34
  type: "systemMessage",
59
35
  text: AutoBeSystemPromptConstant.REALIZE_CORRECT,
60
36
  created_at: new Date().toISOString(),
61
- },
37
+ } as IAgenticaHistoryJson.ISystemMessage,
38
+ ...transformPreviousAndLatestCorrectHistories(
39
+ props.failures.map((f) => ({
40
+ script: f.function.content,
41
+ diagnostics: f.diagnostics,
42
+ })),
43
+ ),
62
44
  ];
45
+ return histories;
63
46
  }