@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
@@ -1,20 +1,20 @@
1
- import { AutoBeAnalyzeRole, CamelCasePattern } from "@autobe/interface";
1
+ import { AutoBeAnalyzeActor, CamelCasePattern } from "@autobe/interface";
2
2
  import { AutoBeAnalyzeFile } from "@autobe/interface/src/histories/contents/AutoBeAnalyzeFile";
3
3
  import { tags } from "typia";
4
4
 
5
5
  export interface IAutoBeAnalyzeScenarioApplication {
6
6
  /**
7
- * Compose project structure with roles and files.
7
+ * Compose project structure with actors and files.
8
8
  *
9
- * Design a list of roles and initial documents that you need to create for
10
- * that requirement. Roles define team member responsibilities, while files
9
+ * Design a list of actors and initial documents that you need to create for
10
+ * that requirement. Actors define user types and their responsibilities, while files
11
11
  * define the documentation structure. These are managed separately. If you
12
12
  * determine from the conversation that the user's requirements have not been
13
13
  * fully gathered, you must stop the analysis and continue collecting the
14
14
  * remaining requirements. In this case, you do not need to generate any files
15
- * or roles. Simply pass an empty array to `input.files` and `input.roles`.
15
+ * or actors. Simply pass an empty array to `input.files` and `input.actors`.
16
16
  *
17
- * @param input Prefix, roles, and files
17
+ * @param input Prefix, actors, and files
18
18
  * @returns
19
19
  */
20
20
  compose(input: IAutoBeAnalyzeScenarioApplication.IProps): void;
@@ -33,8 +33,8 @@ export namespace IAutoBeAnalyzeScenarioApplication {
33
33
  */
34
34
  prefix: string & CamelCasePattern;
35
35
 
36
- /** Roles to be assigned for the project */
37
- roles: AutoBeAnalyzeRole[];
36
+ /** Actors to be assigned for the project */
37
+ actors: AutoBeAnalyzeActor[];
38
38
 
39
39
  /**
40
40
  * Language for document content. When specified by the user, this takes
@@ -63,7 +63,7 @@ export namespace IAutoBeAnalyzeScenarioApplication {
63
63
  * - User journey mapping and use case scenarios
64
64
  * - Business rules and workflow definitions
65
65
  * - Service overview and business model description
66
- * - User roles and permission requirements (described in natural language)
66
+ * - User actors and permission requirements (described in natural language)
67
67
  * - Business logic and validation rules
68
68
  * - DO NOT: Include database schemas, ERD, or API specifications
69
69
  * - DO: Write all requirements in natural language for clarity
@@ -33,7 +33,7 @@ export namespace IAutoBeAnalyzeWriteApplication {
33
33
  * Example plan structure:
34
34
  *
35
35
  * - Service overview with business model
36
- * - User roles and authentication requirements
36
+ * - User actors and authentication requirements
37
37
  * - Functional requirements with EARS format
38
38
  * - Non-functional requirements
39
39
  * - Business requirements in natural language
@@ -1,9 +1,9 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { IAutoBeTypeScriptCompileResult } from "@autobe/interface";
3
- import { StringUtil } from "@autobe/utils";
4
3
  import { v7 } from "uuid";
5
4
 
6
5
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
6
+ import { transformPreviousAndLatestCorrectHistories } from "./transformPreviousAndLatestCorrectHistories";
7
7
 
8
8
  interface IFailure {
9
9
  diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[];
@@ -21,23 +21,5 @@ export const transformCommonCorrectCastingHistories = (
21
21
  type: "systemMessage",
22
22
  text: AutoBeSystemPromptConstant.COMMON_CORRECT_CASTING,
23
23
  },
24
- ...failures.map(
25
- (f, i, array) =>
26
- ({
27
- id: v7(),
28
- created_at: new Date().toISOString(),
29
- type: "assistantMessage",
30
- text: StringUtil.trim`
31
- # ${i === array.length - 1 ? "Latest Failure" : "Previous Failure"}
32
- ## Generated TypeScript Code
33
- \`\`\`typescript
34
- ${f.script}
35
- \`\`\`
36
- ## Compile Errors
37
- \`\`\`json
38
- ${JSON.stringify(f.diagnostics)}
39
- \`\`\`
40
- `,
41
- }) satisfies IAgenticaHistoryJson.IAssistantMessage,
42
- ),
24
+ ...transformPreviousAndLatestCorrectHistories(failures),
43
25
  ];
@@ -0,0 +1,65 @@
1
+ import { IAgenticaHistoryJson } from "@agentica/core";
2
+ import { IAutoBeTypeScriptCompileResult } from "@autobe/interface";
3
+ import { StringUtil } from "@autobe/utils";
4
+ import { v7 } from "uuid";
5
+
6
+ import { printErrorHints } from "../../realize/utils/printErrorHints";
7
+
8
+ export const transformPreviousAndLatestCorrectHistories = (
9
+ array: Array<{
10
+ script: string;
11
+ diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[];
12
+ }>,
13
+ ): IAgenticaHistoryJson.IAssistantMessage[] =>
14
+ array.map((failure, i) => ({
15
+ id: v7(),
16
+ type: "assistantMessage",
17
+ text: StringUtil.trim`
18
+ ${
19
+ i === array.length - 1
20
+ ? "# Latest Failure"
21
+ : StringUtil.trim`
22
+ # Previous Failure
23
+
24
+ This is the previous failure for your reference.
25
+
26
+ Never try to fix this previous failure code, but only
27
+ focus on the latest failure below. This is provided just
28
+ to give you context about your past mistakes.
29
+
30
+ If same mistake happens again, you must try to not
31
+ repeat the same mistake. Change your approach to fix
32
+ the issue.
33
+ `
34
+ }
35
+
36
+ ## Original Code
37
+
38
+ Here is the previous code you have to review and fix.
39
+
40
+ \`\`\`typescript
41
+ ${failure.script}
42
+ \`\`\`
43
+
44
+ ## Compilation Errors
45
+
46
+ Here are the compilation errors found in the code above.
47
+
48
+ \`\`\`json
49
+ ${JSON.stringify(failure.diagnostics)}
50
+ \`\`\`
51
+
52
+ ## Error Annotated Code
53
+
54
+ Here is the error annotated code.
55
+
56
+ Please refer to the annotation for the location of the error.
57
+
58
+ By the way, note that, this code is only for reference purpose.
59
+ Never fix code from this error annotated code. You must fix
60
+ the original code above.
61
+
62
+ ${printErrorHints(failure.script, failure.diagnostics)}
63
+ `,
64
+ created_at: new Date().toISOString(),
65
+ }));
@@ -1,4 +1,5 @@
1
1
  import {
2
+ AutoBeFunctionCallingMetric,
2
3
  AutoBeRealizeCorrectEvent,
3
4
  AutoBeRealizeValidateEvent,
4
5
  AutoBeTestCorrectEvent,
@@ -33,6 +34,7 @@ interface IFactoryProps<
33
34
  draft: string;
34
35
  review: string | undefined;
35
36
  final: string | undefined;
37
+ metric: AutoBeFunctionCallingMetric;
36
38
  tokenUsage: IAutoBeTokenUsageJson.IComponent;
37
39
  }): CorrectEvent;
38
40
  script(event: ValidateEvent): string;
@@ -92,7 +94,7 @@ const correct = async <
92
94
  > = {
93
95
  value: null,
94
96
  };
95
- const { tokenUsage } = await ctx.conversate({
97
+ const { metric, tokenUsage } = await ctx.conversate({
96
98
  source: factory.source,
97
99
  histories: transformCommonCorrectCastingHistories(
98
100
  [...failures, event].map((e) => ({
@@ -115,7 +117,7 @@ const correct = async <
115
117
  message: StringUtil.trim`
116
118
  Fix the TypeScript casting problems to resolve the compilation error.
117
119
 
118
- You don't need to explain me anything, but just fix or give it up
120
+ You don't need to explain me anything, but just fix or give it up
119
121
  immediately without any hesitation, explanation, and questions.
120
122
  `,
121
123
  });
@@ -129,6 +131,7 @@ const correct = async <
129
131
  draft: pointer.value.draft,
130
132
  review: pointer.value.revise.review,
131
133
  final: pointer.value.revise.final ?? undefined,
134
+ metric,
132
135
  tokenUsage,
133
136
  }),
134
137
  );
@@ -0,0 +1,135 @@
1
+ import { IAgenticaController } from "@agentica/core";
2
+ import {
3
+ AutoBeAnalyzeHistory,
4
+ AutoBeAssistantMessageEvent,
5
+ AutoBeAssistantMessageHistory,
6
+ AutoBeInterfaceHistory,
7
+ AutoBePrismaHistory,
8
+ AutoBeRealizeHistory,
9
+ AutoBeTestHistory,
10
+ } from "@autobe/interface";
11
+ import { StringUtil } from "@autobe/utils";
12
+ import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
13
+ import typia from "typia";
14
+
15
+ import { AutoBeContext } from "../../context/AutoBeContext";
16
+ import { assertSchemaModel } from "../../context/assertSchemaModel";
17
+ import { orchestrateAnalyze } from "../analyze/orchestrateAnalyze";
18
+ import { orchestrateInterface } from "../interface/orchestrateInterface";
19
+ import { orchestratePrisma } from "../prisma/orchestratePrisma";
20
+ import { orchestrateRealize } from "../realize/orchestrateRealize";
21
+ import { orchestrateTest } from "../test/orchestrateTest";
22
+ import { IAutoBeFacadeApplication } from "./histories/IAutoBeFacadeApplication";
23
+
24
+ export const createAutoBeFacadeController = <
25
+ Model extends ILlmSchema.Model,
26
+ >(props: {
27
+ model: Model;
28
+ context: AutoBeContext<Model>;
29
+ }): IAgenticaController.IClass<Model> => {
30
+ assertSchemaModel(props.model);
31
+ const application: ILlmApplication<Model> = collection[
32
+ props.model
33
+ ] satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
34
+ return {
35
+ protocol: "class",
36
+ name: "autobe",
37
+ application,
38
+ execute: {
39
+ analyze: async () => {
40
+ const history: AutoBeAssistantMessageHistory | AutoBeAnalyzeHistory =
41
+ await orchestrateAnalyze(props.context);
42
+ if (history.type === "assistantMessage")
43
+ return {
44
+ type: "in-progress",
45
+ description: StringUtil.trim`
46
+ Requirements are not yet fully elicited,
47
+ therefore additional questions will be made to the user.
48
+ `,
49
+ };
50
+ return {
51
+ type: "success",
52
+ description:
53
+ "Analysis completed successfully, and report has been published.",
54
+ };
55
+ },
56
+ prisma: async (next) => {
57
+ const history: AutoBeAssistantMessageHistory | AutoBePrismaHistory =
58
+ await orchestratePrisma(props.context, next);
59
+ if (history.type === "assistantMessage")
60
+ return {
61
+ type: "prerequisites-not-satisfied",
62
+ description: "Requirement analysis is not yet completed.",
63
+ };
64
+ return {
65
+ type: history.compiled.type,
66
+ description:
67
+ history.compiled.type === "success"
68
+ ? "Prisma schemas have been generated successfully."
69
+ : history.result.success === false ||
70
+ history.compiled.type === "failure"
71
+ ? "Prisma schemas are generated, but compilation failed."
72
+ : "Unexpected error occurred while generating Prisma schemas.",
73
+ };
74
+ },
75
+ interface: async (next) => {
76
+ const history: AutoBeAssistantMessageEvent | AutoBeInterfaceHistory =
77
+ await orchestrateInterface(props.context)(next);
78
+ if (history.type === "assistantMessage")
79
+ return {
80
+ type: "prerequisites-not-satisfied",
81
+ description: "Prisma schemas are not yet completed.",
82
+ };
83
+ return {
84
+ type: "success",
85
+ description: "API interfaces have been designed successfully.",
86
+ };
87
+ },
88
+ test: async (next) => {
89
+ const history: AutoBeAssistantMessageHistory | AutoBeTestHistory =
90
+ await orchestrateTest(props.context)(next);
91
+ if (history.type === "assistantMessage")
92
+ return {
93
+ type: "prerequisites-not-satisfied",
94
+ description: "API interfaces are not yet completed.",
95
+ };
96
+ return {
97
+ type: history.compiled.type,
98
+ description:
99
+ history.compiled.type === "success"
100
+ ? "Test functions have been generated successfully."
101
+ : history.compiled.type === "failure"
102
+ ? "Test functions are written, but compilation failed."
103
+ : "Unexpected error occurred while writing test functions.",
104
+ };
105
+ },
106
+ realize: async (next) => {
107
+ const history: AutoBeAssistantMessageHistory | AutoBeRealizeHistory =
108
+ await orchestrateRealize(props.context)(next);
109
+ if (history.type === "assistantMessage")
110
+ return {
111
+ type: "prerequisites-not-satisfied",
112
+ description: "API interfaces are not yet completed.",
113
+ };
114
+ return {
115
+ type: history.compiled.type,
116
+ description:
117
+ history.compiled.type === "success"
118
+ ? "API implementation codes have been generated successfully."
119
+ : history.compiled.type === "failure"
120
+ ? "Implementation codes are composed, but compilation failed."
121
+ : "Unexpected error occurred while writing implementation codes.",
122
+ };
123
+ },
124
+ } satisfies IAutoBeFacadeApplication,
125
+ };
126
+ };
127
+
128
+ const claude = typia.llm.application<IAutoBeFacadeApplication, "claude">();
129
+ const collection = {
130
+ chatgpt: typia.llm.application<IAutoBeFacadeApplication, "chatgpt">(),
131
+ claude,
132
+ llama: claude,
133
+ deepseek: claude,
134
+ "3.1": claude,
135
+ };
@@ -1,7 +1,7 @@
1
1
  import { StringUtil } from "@autobe/utils";
2
2
 
3
- import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
4
- import { AutoBeState } from "../../context/AutoBeState";
3
+ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
4
+ import { AutoBeState } from "../../../context/AutoBeState";
5
5
 
6
6
  export function transformFacadeStateMessage(state: AutoBeState): string {
7
7
  const currentState: ICurrentState = getCurrentState(state);
@@ -1,5 +1,5 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
- import { AutoBeAnalyzeHistory, AutoBeAnalyzeRole } from "@autobe/interface";
2
+ import { AutoBeAnalyzeActor, AutoBeAnalyzeHistory } from "@autobe/interface";
3
3
  import { StringUtil } from "@autobe/utils";
4
4
  import { v7 } from "uuid";
5
5
 
@@ -9,7 +9,7 @@ import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHisto
9
9
 
10
10
  export const transformInterfaceAuthorizationsHistories = (props: {
11
11
  state: AutoBeState;
12
- role: AutoBeAnalyzeRole;
12
+ actor: AutoBeAnalyzeActor;
13
13
  instruction: string;
14
14
  }): Array<
15
15
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
@@ -52,22 +52,22 @@ export const transformInterfaceAuthorizationsHistories = (props: {
52
52
  such as endpoint patterns, request/response formats, DTO schemas,
53
53
  and operation specifications.
54
54
 
55
- Follow these instructions when designing authorization operations for ${props.role.name}.
55
+ Follow these instructions when designing authorization operations for ${props.actor.name}.
56
56
  Carefully distinguish between:
57
57
  - Suggestions or recommendations (consider these as guidance)
58
58
  - Direct specifications or explicit commands (these must be followed exactly)
59
-
60
- When instructions contain direct specifications or explicit design decisions,
59
+
60
+ When instructions contain direct specifications or explicit design decisions,
61
61
  follow them precisely even if you believe you have better alternatives.
62
62
 
63
63
  ${props.instruction}
64
64
 
65
- ## Role
66
-
67
- You have to make API operations for the given role:
65
+ ## Actor
66
+
67
+ You have to make API operations for the given actor:
68
68
 
69
69
  \`\`\`json
70
- ${JSON.stringify(props.role)}
70
+ ${JSON.stringify(props.actor)}
71
71
  \`\`\`
72
72
  `,
73
73
  },
@@ -24,6 +24,7 @@ export const transformInterfaceEndpointsReviewHistories = (
24
24
  type: "assistantMessage",
25
25
  text: [
26
26
  "Below are endpoints generated by your request.",
27
+ "",
27
28
  "```json",
28
29
  JSON.stringify(endpoints),
29
30
  "```",
@@ -10,22 +10,29 @@ import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHisto
10
10
  export const transformInterfaceSchemaHistories = (props: {
11
11
  state: AutoBeState;
12
12
  operations: AutoBeOpenApi.IOperation[];
13
+ typeNames: string[];
13
14
  instruction: string;
14
15
  }): Array<
15
16
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
16
- > => [
17
- {
18
- type: "systemMessage",
19
- id: v7(),
20
- created_at: new Date().toISOString(),
21
- text: AutoBeSystemPromptConstant.INTERFACE_SCHEMA,
22
- },
23
- ...transformInterfaceAssetHistories(props.state),
24
- {
25
- type: "assistantMessage",
26
- id: v7(),
27
- created_at: new Date().toISOString(),
28
- text: StringUtil.trim`
17
+ > => {
18
+ const schemas: Set<string> = new Set();
19
+ for (const op of props.operations) {
20
+ if (op.requestBody) schemas.add(op.requestBody.typeName);
21
+ if (op.responseBody) schemas.add(op.responseBody.typeName);
22
+ }
23
+ return [
24
+ {
25
+ type: "systemMessage",
26
+ id: v7(),
27
+ created_at: new Date().toISOString(),
28
+ text: AutoBeSystemPromptConstant.INTERFACE_SCHEMA,
29
+ },
30
+ ...transformInterfaceAssetHistories(props.state),
31
+ {
32
+ type: "assistantMessage",
33
+ id: v7(),
34
+ created_at: new Date().toISOString(),
35
+ text: StringUtil.trim`
29
36
  ## API Design Instructions
30
37
 
31
38
  The following API-specific instructions were extracted from
@@ -33,23 +40,41 @@ export const transformInterfaceSchemaHistories = (props: {
33
40
  such as endpoint patterns, request/response formats, DTO schemas,
34
41
  and operation specifications.
35
42
 
36
- Follow these instructions when creating JSON schema components.
43
+ Follow these instructions when creating JSON schema components.
37
44
  Carefully distinguish between:
38
45
  - Suggestions or recommendations (consider these as guidance)
39
46
  - Direct specifications or explicit commands (these must be followed exactly)
40
-
41
- When instructions contain direct specifications or explicit design decisions,
47
+
48
+ When instructions contain direct specifications or explicit design decisions,
42
49
  follow them precisely even if you believe you have better alternatives.
43
50
 
44
51
  ${props.instruction}
45
52
 
46
- ## Operations
53
+ ## Operations (Filtered for Target Schemas)
54
+
55
+ Here is the list of API operations that directly use the schemas
56
+ you need to generate (via requestBody.typeName or responseBody.typeName).
47
57
 
48
- Here is the list of API operations you have to implement its types:
58
+ These are the ONLY operations relevant to your current task - other
59
+ operations have been filtered out to reduce noise and improve focus:
49
60
 
50
61
  \`\`\`json
51
62
  ${JSON.stringify(props.operations)}
52
63
  \`\`\`
64
+
65
+ ## Schemas
66
+
67
+ Here is the list of request/response bodies' type names from
68
+ OpenAPI operations.
69
+
70
+ Reference them when creating DTO schema components, especially
71
+ considering the DTO relationships.
72
+
73
+ ${Array.from(schemas)
74
+ .map((k) => `- \`${k}\``)
75
+ .join("\n")}
76
+
53
77
  `,
54
- },
55
- ];
78
+ },
79
+ ];
80
+ };
@@ -0,0 +1,55 @@
1
+ import { IAgenticaHistoryJson } from "@agentica/core";
2
+ import { StringUtil } from "@autobe/utils";
3
+ import { v7 } from "uuid";
4
+
5
+ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
6
+
7
+ export const transformInterfaceSchemaRenameHistories = (props: {
8
+ tableNames: string[];
9
+ typeNames: string[];
10
+ }): Array<
11
+ IAgenticaHistoryJson.ISystemMessage | IAgenticaHistoryJson.IAssistantMessage
12
+ > => {
13
+ return [
14
+ {
15
+ type: "systemMessage",
16
+ id: v7(),
17
+ created_at: new Date().toISOString(),
18
+ text: AutoBeSystemPromptConstant.INTERFACE_SCHEMA_RENAME,
19
+ },
20
+ {
21
+ type: "assistantMessage",
22
+ id: v7(),
23
+ created_at: new Date().toISOString(),
24
+ text: StringUtil.trim`
25
+ ## Prisma Table Names
26
+
27
+ Here is the complete list of table names from the Prisma database schema.
28
+ Use these as the source of truth for determining correct DTO type names.
29
+
30
+ Each table name should be converted to a DTO type name by:
31
+ 1. Converting from snake_case to PascalCase
32
+ 2. Preserving ALL words from the table name
33
+ 3. Adding "I" prefix for interface types
34
+
35
+ **Table Names:**
36
+ ${props.tableNames.map((name) => `- \`${name}\``).join("\n")}
37
+
38
+ ## Current DTO Type Names
39
+
40
+ Here is the list of existing DTO type names currently in the OpenAPI specification.
41
+ Analyze these to identify which ones violate the naming rules by omitting
42
+ intermediate words or service prefixes from their corresponding table names.
43
+
44
+ **Current Type Names:**
45
+ ${props.typeNames.map((name) => `- \`${name}\``).join("\n")}
46
+
47
+ ## Your Task
48
+
49
+ Compare the table names with the current type names to identify violations.
50
+ For each type name that incorrectly omits words from its table name,
51
+ provide a refactoring entry with the correct name that preserves all components.
52
+ `,
53
+ },
54
+ ];
55
+ };
@@ -0,0 +1,90 @@
1
+ import { IAgenticaHistoryJson } from "@agentica/core";
2
+ import { AutoBeOpenApi } from "@autobe/interface";
3
+ import { StringUtil } from "@autobe/utils";
4
+ import { v7 } from "uuid";
5
+
6
+ import { AutoBeState } from "../../../context/AutoBeState";
7
+ import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHistories";
8
+
9
+ export const transformInterfaceSchemaReviewHistories = (props: {
10
+ state: AutoBeState;
11
+ systemPrompt: string;
12
+ instruction: string;
13
+ operations: AutoBeOpenApi.IOperation[];
14
+ everySchemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
15
+ reviewSchemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
16
+ }): Array<
17
+ IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
18
+ > => {
19
+ return [
20
+ {
21
+ type: "systemMessage",
22
+ id: v7(),
23
+ created_at: new Date().toISOString(),
24
+ text: props.systemPrompt,
25
+ },
26
+ ...transformInterfaceAssetHistories(props.state),
27
+ {
28
+ type: "assistantMessage",
29
+ id: v7(),
30
+ created_at: new Date().toISOString(),
31
+ text: StringUtil.trim`
32
+ ## API Design Instructions
33
+
34
+ The following API-specific instructions were extracted from
35
+ the user's requirements. These focus on API interface design aspects
36
+ relevant to the review task.
37
+
38
+ Follow these instructions when reviewing and fixing schemas.
39
+ Carefully distinguish between:
40
+ - Suggestions or recommendations (consider these as guidance)
41
+ - Direct specifications or explicit commands (these must be followed exactly)
42
+
43
+ When instructions contain direct specifications or explicit design decisions,
44
+ follow them precisely even if you believe you have better alternatives.
45
+
46
+ ${props.instruction}
47
+
48
+ ## Schemas (Complete Set for Reference)
49
+
50
+ Here is the COMPLETE set of all schemas in the system for
51
+ reference context:
52
+
53
+ \`\`\`json
54
+ ${JSON.stringify(props.everySchemas)}
55
+ \`\`\`
56
+ `,
57
+ },
58
+ {
59
+ id: v7(),
60
+ type: "assistantMessage",
61
+ created_at: new Date().toISOString(),
62
+ text: StringUtil.trim`
63
+ ## Schemas Needing Review
64
+
65
+ From the complete schema set above, here are the SPECIFIC schemas that need review:
66
+
67
+ \`\`\`json
68
+ ${JSON.stringify(props.reviewSchemas)}
69
+ \`\`\`
70
+
71
+ IMPORTANT: Only these ${Object.keys(props.reviewSchemas).length} schemas
72
+ need review and potential modification. The other schemas in
73
+ the full set are provided for reference only.
74
+
75
+ ## Operations (Filtered for Target Schemas)
76
+
77
+ Here are the API operations that directly use the schemas under review.
78
+ These operations reference at least one of the target schemas via
79
+ requestBody.typeName or responseBody.typeName.
80
+
81
+ This FILTERED list helps you understand the exact usage context for
82
+ the schemas you're reviewing:
83
+
84
+ \`\`\`json
85
+ ${JSON.stringify(props.operations)}
86
+ \`\`\`
87
+ `,
88
+ },
89
+ ];
90
+ };