@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
@@ -2,9 +2,10 @@ import {
2
2
  AutoBeAssistantMessageHistory,
3
3
  AutoBeInterfaceAuthorization,
4
4
  AutoBeInterfaceCompleteEvent,
5
- AutoBeInterfaceGroupsEvent,
5
+ AutoBeInterfaceGroupEvent,
6
6
  AutoBeInterfaceHistory,
7
7
  AutoBeOpenApi,
8
+ AutoBeProgressEventBase,
8
9
  } from "@autobe/interface";
9
10
  import { AutoBeInterfacePrerequisite } from "@autobe/interface/src/histories/contents/AutoBeInterfacePrerequisite";
10
11
  import {
@@ -16,17 +17,20 @@ import { ILlmSchema } from "@samchon/openapi";
16
17
  import { HashMap, Pair } from "tstl";
17
18
  import { v7 } from "uuid";
18
19
 
20
+ import { AutoBeConfigConstant } from "../../constants/AutoBeConfigConstant";
21
+ import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
19
22
  import { AutoBeContext } from "../../context/AutoBeContext";
20
- import { IAutoBeFacadeApplicationProps } from "../../context/IAutoBeFacadeApplicationProps";
21
23
  import { predicateStateMessage } from "../../utils/predicateStateMessage";
24
+ import { IAutoBeFacadeApplicationProps } from "../facade/histories/IAutoBeFacadeApplicationProps";
22
25
  import { orchestrateInterfaceAuthorizations } from "./orchestrateInterfaceAuthorizations";
23
26
  import { orchestrateInterfaceComplement } from "./orchestrateInterfaceComplement";
24
27
  import { orchestrateInterfaceEndpoints } from "./orchestrateInterfaceEndpoints";
25
28
  import { orchestrateInterfaceGroups } from "./orchestrateInterfaceGroups";
26
29
  import { orchestrateInterfaceOperations } from "./orchestrateInterfaceOperations";
27
30
  import { orchestrateInterfacePrerequisites } from "./orchestrateInterfacePrerequisites";
31
+ import { orchestrateInterfaceSchemaRename } from "./orchestrateInterfaceSchemaRename";
32
+ import { orchestrateInterfaceSchemaReview } from "./orchestrateInterfaceSchemaReview";
28
33
  import { orchestrateInterfaceSchemas } from "./orchestrateInterfaceSchemas";
29
- import { orchestrateInterfaceSchemasReview } from "./orchestrateInterfaceSchemasReview";
30
34
  import { JsonSchemaFactory } from "./utils/JsonSchemaFactory";
31
35
 
32
36
  export const orchestrateInterface =
@@ -57,7 +61,7 @@ export const orchestrateInterface =
57
61
  });
58
62
 
59
63
  // ENDPOINTS
60
- const init: AutoBeInterfaceGroupsEvent = await orchestrateInterfaceGroups(
64
+ const init: AutoBeInterfaceGroupEvent = await orchestrateInterfaceGroups(
61
65
  ctx,
62
66
  {
63
67
  instruction: props.instruction,
@@ -108,7 +112,7 @@ export const orchestrateInterface =
108
112
  const document: AutoBeOpenApi.IDocument = {
109
113
  operations,
110
114
  components: {
111
- authorization: ctx.state().analyze?.roles ?? [],
115
+ authorizations: ctx.state().analyze?.actors ?? [],
112
116
  schemas: await orchestrateInterfaceSchemas(ctx, {
113
117
  instruction: props.instruction,
114
118
  operations,
@@ -116,9 +120,11 @@ export const orchestrateInterface =
116
120
  },
117
121
  };
118
122
 
123
+ const assign = (
124
+ schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>,
125
+ ) => Object.assign(document.components.schemas, schemas);
119
126
  const complement = async () =>
120
- Object.assign(
121
- document.components.schemas,
127
+ assign(
122
128
  await orchestrateInterfaceComplement(ctx, {
123
129
  instruction: props.instruction,
124
130
  document,
@@ -126,16 +132,40 @@ export const orchestrateInterface =
126
132
  );
127
133
  await complement();
128
134
 
129
- Object.assign(
130
- document.components.schemas,
131
- await orchestrateInterfaceSchemasReview(
132
- ctx,
133
- operations,
134
- document.components.schemas,
135
+ const reviewProgress: AutoBeProgressEventBase = {
136
+ completed: 0,
137
+ total: Math.ceil(
138
+ Object.keys(document.components.schemas).length /
139
+ AutoBeConfigConstant.INTERFACE_CAPACITY,
135
140
  ),
136
- );
141
+ };
142
+ for (const config of [
143
+ {
144
+ kind: "security" as const,
145
+ systemPrompt:
146
+ AutoBeSystemPromptConstant.INTERFACE_SCHEMA_SECURITY_REVIEW,
147
+ },
148
+ {
149
+ kind: "relation" as const,
150
+ systemPrompt:
151
+ AutoBeSystemPromptConstant.INTERFACE_SCHEMA_RELATION_REVIEW,
152
+ },
153
+ {
154
+ kind: "content" as const,
155
+ systemPrompt:
156
+ AutoBeSystemPromptConstant.INTERFACE_SCHEMA_CONTENT_REVIEW,
157
+ },
158
+ ])
159
+ assign(
160
+ await orchestrateInterfaceSchemaReview(ctx, config, {
161
+ instruction: props.instruction,
162
+ document,
163
+ progress: reviewProgress,
164
+ }),
165
+ );
137
166
  if (missedOpenApiSchemas(document).length !== 0) await complement();
138
167
 
168
+ await orchestrateInterfaceSchemaRename(ctx, document);
139
169
  JsonSchemaFactory.finalize({
140
170
  document,
141
171
  application: ctx.state().prisma!.result.data,
@@ -161,8 +191,9 @@ export const orchestrateInterface =
161
191
  document,
162
192
  missed: missedOpenApiSchemas(document),
163
193
  authorizations,
164
- created_at: new Date().toISOString(),
165
- elapsed: new Date().getTime() - start.getTime(),
194
+ aggregates: ctx.getCurrentAggregates("interface"),
166
195
  step: ctx.state().analyze?.step ?? 0,
196
+ elapsed: new Date().getTime() - start.getTime(),
197
+ created_at: new Date().toISOString(),
167
198
  } satisfies AutoBeInterfaceCompleteEvent);
168
199
  };
@@ -1,6 +1,6 @@
1
1
  import { IAgenticaController } from "@agentica/core";
2
2
  import {
3
- AutoBeAnalyzeRole,
3
+ AutoBeAnalyzeActor,
4
4
  AutoBeInterfaceAuthorization,
5
5
  AutoBeOpenApi,
6
6
  AutoBeProgressEventBase,
@@ -24,23 +24,23 @@ export async function orchestrateInterfaceAuthorizations<
24
24
  ctx: AutoBeContext<Model>,
25
25
  instruction: string,
26
26
  ): Promise<AutoBeInterfaceAuthorization[]> {
27
- const roles: AutoBeAnalyzeRole[] = ctx.state().analyze?.roles ?? [];
27
+ const actors: AutoBeAnalyzeActor[] = ctx.state().analyze?.actors ?? [];
28
28
  const progress: AutoBeProgressEventBase = {
29
- total: roles.length,
29
+ total: actors.length,
30
30
  completed: 0,
31
31
  };
32
32
  const authorizations: AutoBeInterfaceAuthorization[] =
33
33
  await executeCachedBatch(
34
- roles.map((role) => async (promptCacheKey) => {
34
+ actors.map((a) => async (promptCacheKey) => {
35
35
  const event: AutoBeInterfaceAuthorizationEvent = await process(ctx, {
36
- role,
36
+ actor: a,
37
37
  progress,
38
38
  promptCacheKey,
39
39
  instruction,
40
40
  });
41
41
  ctx.dispatch(event);
42
42
  return {
43
- role: role.name,
43
+ name: a.name,
44
44
  operations: event.operations,
45
45
  };
46
46
  }),
@@ -53,7 +53,7 @@ async function process<Model extends ILlmSchema.Model>(
53
53
  ctx: AutoBeContext<Model>,
54
54
  props: {
55
55
  instruction: string;
56
- role: AutoBeAnalyzeRole;
56
+ actor: AutoBeAnalyzeActor;
57
57
  progress: AutoBeProgressEventBase;
58
58
  promptCacheKey: string;
59
59
  },
@@ -62,16 +62,16 @@ async function process<Model extends ILlmSchema.Model>(
62
62
  {
63
63
  value: null,
64
64
  };
65
- const { tokenUsage } = await ctx.conversate({
65
+ const { metric, tokenUsage } = await ctx.conversate({
66
66
  source: "interfaceAuthorization",
67
67
  histories: transformInterfaceAuthorizationsHistories({
68
68
  state: ctx.state(),
69
69
  instruction: props.instruction,
70
- role: props.role,
70
+ actor: props.actor,
71
71
  }),
72
72
  controller: createController({
73
73
  model: ctx.model,
74
- role: props.role,
74
+ actor: props.actor,
75
75
  build: (next) => {
76
76
  pointer.value = next;
77
77
  },
@@ -88,6 +88,7 @@ async function process<Model extends ILlmSchema.Model>(
88
88
  id: v7(),
89
89
  operations: pointer.value.operations,
90
90
  completed: ++props.progress.completed,
91
+ metric,
91
92
  tokenUsage,
92
93
  created_at: new Date().toISOString(),
93
94
  step: ctx.state().analyze?.step ?? 0,
@@ -97,7 +98,7 @@ async function process<Model extends ILlmSchema.Model>(
97
98
 
98
99
  function createController<Model extends ILlmSchema.Model>(props: {
99
100
  model: Model;
100
- role: AutoBeAnalyzeRole;
101
+ actor: AutoBeAnalyzeActor;
101
102
  build: (next: IAutoBeInterfaceAuthorizationsApplication.IProps) => void;
102
103
  }): IAgenticaController.IClass<Model> {
103
104
  assertSchemaModel(props.model);
@@ -110,7 +111,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
110
111
  if (result.success === false) return result;
111
112
 
112
113
  // remove login operation for guest role
113
- if (props.role.kind === "guest") {
114
+ if (props.actor.kind === "guest") {
114
115
  result.data.operations = result.data.operations.filter(
115
116
  (op) => op.authorizationType !== "login",
116
117
  );
@@ -118,9 +119,9 @@ function createController<Model extends ILlmSchema.Model>(props: {
118
119
 
119
120
  const errors: IValidation.IError[] = [];
120
121
  result.data.operations.forEach((op, i) => {
121
- // validate authorizationRole
122
- if (op.authorizationRole !== null) {
123
- op.authorizationRole = props.role.name;
122
+ // validate authorizationActor
123
+ if (op.authorizationActor !== null) {
124
+ op.authorizationActor = props.actor.name;
124
125
  }
125
126
 
126
127
  // validate responseBody.typeName -> must be ~.IAuthorized
@@ -150,7 +151,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
150
151
  For authentication operations (login, join, refresh), the response body type name must follow the convention "I{RoleName}.IAuthorized".
151
152
 
152
153
  This standardized naming convention ensures consistency across all authentication endpoints and clearly identifies authorization response types.
153
- The Role name should be in PascalCase format (e.g., IUser.IAuthorized, IAdmin.IAuthorized, ISeller.IAuthorized).
154
+ The actor name should be in PascalCase format (e.g., IUser.IAuthorized, IAdmin.IAuthorized, ISeller.IAuthorized).
154
155
  `,
155
156
  });
156
157
  });
@@ -165,7 +166,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
165
166
  .filter((v) => v !== null),
166
167
  );
167
168
  for (const type of typia.misc.literals<AuthorizationType>())
168
- if (props.role.kind === "guest" && type === "login") continue;
169
+ if (props.actor.kind === "guest" && type === "login") continue;
169
170
  else if (authorizationTypes.has(type) === false)
170
171
  errors.push({
171
172
  path: "$input.operations[].authorizationType",
@@ -176,10 +177,10 @@ function createController<Model extends ILlmSchema.Model>(props: {
176
177
  value: `No authorizationType "${type}" found in any operation`,
177
178
  description: StringUtil.trim`
178
179
  There must be an operation that has defined AutoBeOpenApi.IOperation.authorizationType := "${type}"
179
- for the "${props.role}" role's authorization activity; "${type}".
180
+ for the "${props.actor}" role's authorization activity; "${type}".
180
181
 
181
182
  However, none of the operations have the AutoBeOpenApi.IOperation.authorizationType := "${type}"
182
- value, so that the "${props.role}" cannot perform the authorization ${type} activity.
183
+ value, so that the "${props.actor}" cannot perform the authorization ${type} activity.
183
184
 
184
185
  Please make that operation at the next function calling. You have to do it.
185
186
  `,
@@ -50,7 +50,7 @@ async function step<Model extends ILlmSchema.Model>(
50
50
  > | null> = {
51
51
  value: null,
52
52
  };
53
- const { tokenUsage } = await ctx.conversate({
53
+ const { metric, tokenUsage } = await ctx.conversate({
54
54
  source: "interfaceComplement",
55
55
  histories: transformInterfaceComplementHistories({
56
56
  state: ctx.state(),
@@ -86,6 +86,7 @@ async function step<Model extends ILlmSchema.Model>(
86
86
  id: v7(),
87
87
  missed,
88
88
  schemas: pointer.value,
89
+ metric,
89
90
  tokenUsage,
90
91
  step: ctx.state().analyze?.step ?? 0,
91
92
  created_at: new Date().toISOString(),
@@ -1,6 +1,6 @@
1
1
  import { IAgenticaController } from "@agentica/core";
2
2
  import {
3
- AutoBeInterfaceEndpointsEvent,
3
+ AutoBeInterfaceEndpointEvent,
4
4
  AutoBeOpenApi,
5
5
  AutoBeProgressEventBase,
6
6
  } from "@autobe/interface";
@@ -53,7 +53,7 @@ export async function orchestrateInterfaceEndpoints<
53
53
  AutoBeOpenApiEndpointComparator.hashCode,
54
54
  AutoBeOpenApiEndpointComparator.equals,
55
55
  ).toJSON();
56
- return orchestrateInterfaceEndpointsReview(ctx, deduplicated);
56
+ return await orchestrateInterfaceEndpointsReview(ctx, deduplicated);
57
57
  }
58
58
 
59
59
  async function process<Model extends ILlmSchema.Model>(
@@ -71,8 +71,8 @@ async function process<Model extends ILlmSchema.Model>(
71
71
  const pointer: IPointer<AutoBeOpenApi.IEndpoint[] | null> = {
72
72
  value: null,
73
73
  };
74
- const { tokenUsage } = await ctx.conversate({
75
- source: "interfaceEndpoints",
74
+ const { metric, tokenUsage } = await ctx.conversate({
75
+ source: "interfaceEndpoint",
76
76
  histories: transformInterfaceEndpointHistories({
77
77
  state: ctx.state(),
78
78
  group: props.group,
@@ -92,14 +92,15 @@ async function process<Model extends ILlmSchema.Model>(
92
92
  });
93
93
  if (pointer.value === null) throw new Error("Failed to generate endpoints."); // unreachable
94
94
 
95
- const event: AutoBeInterfaceEndpointsEvent = {
96
- type: "interfaceEndpoints",
95
+ const event: AutoBeInterfaceEndpointEvent = {
96
+ type: "interfaceEndpoint",
97
97
  id: v7(),
98
98
  endpoints: new HashSet(
99
99
  pointer.value,
100
100
  AutoBeOpenApiEndpointComparator.hashCode,
101
101
  AutoBeOpenApiEndpointComparator.equals,
102
102
  ).toJSON(),
103
+ metric,
103
104
  tokenUsage,
104
105
  created_at: start.toISOString(),
105
106
  step: ctx.state().analyze?.step ?? 0,
@@ -22,8 +22,8 @@ export async function orchestrateInterfaceEndpointsReview<
22
22
  value: null,
23
23
  };
24
24
 
25
- const { tokenUsage } = await ctx.conversate({
26
- source: "interfaceEndpointsReview",
25
+ const { metric, tokenUsage } = await ctx.conversate({
26
+ source: "interfaceEndpointReview",
27
27
  histories: transformInterfaceEndpointsReviewHistories(
28
28
  ctx.state(),
29
29
  endpoints,
@@ -43,22 +43,21 @@ export async function orchestrateInterfaceEndpointsReview<
43
43
  }
44
44
 
45
45
  const response = pointer.value?.endpoints ?? [];
46
-
47
46
  ctx.dispatch({
48
47
  id: v7(),
49
- type: "interfaceEndpointsReview",
48
+ type: "interfaceEndpointReview",
50
49
  endpoints,
51
50
  content: response,
52
51
  created_at: new Date().toISOString(),
53
52
  review: pointer.value?.review,
54
53
  step: ctx.state().analyze?.step ?? 0,
54
+ metric,
55
55
  tokenUsage,
56
56
  });
57
-
58
57
  return response;
59
58
  }
60
59
 
61
- export function createController<Model extends ILlmSchema.Model>(props: {
60
+ function createController<Model extends ILlmSchema.Model>(props: {
62
61
  model: Model;
63
62
  build: (props: IAutoBeInterfaceEndpointsReviewApplication.IProps) => void;
64
63
  }): IAgenticaController.IClass<Model> {
@@ -1,5 +1,5 @@
1
1
  import { IAgenticaController } from "@agentica/core";
2
- import { AutoBeInterfaceGroupsEvent } from "@autobe/interface";
2
+ import { AutoBeInterfaceGroupEvent } from "@autobe/interface";
3
3
  import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
4
4
  import { IPointer } from "tstl";
5
5
  import typia from "typia";
@@ -18,13 +18,13 @@ export async function orchestrateInterfaceGroups<
18
18
  instruction: string;
19
19
  message?: string;
20
20
  },
21
- ): Promise<AutoBeInterfaceGroupsEvent> {
21
+ ): Promise<AutoBeInterfaceGroupEvent> {
22
22
  const start: Date = new Date();
23
23
  const pointer: IPointer<IAutoBeInterfaceGroupApplication.IProps | null> = {
24
24
  value: null,
25
25
  };
26
- const { tokenUsage } = await ctx.conversate({
27
- source: "interfaceGroups",
26
+ const { metric, tokenUsage } = await ctx.conversate({
27
+ source: "interfaceGroup",
28
28
  histories: transformInterfaceGroupHistories({
29
29
  state: ctx.state(),
30
30
  instruction: props.instruction,
@@ -40,13 +40,14 @@ export async function orchestrateInterfaceGroups<
40
40
  });
41
41
  if (pointer.value === null) throw new Error("Failed to generate groups."); // unreachable
42
42
  return {
43
- type: "interfaceGroups",
43
+ type: "interfaceGroup",
44
44
  id: v7(),
45
45
  created_at: start.toISOString(),
46
46
  groups: pointer.value.groups,
47
+ metric,
47
48
  tokenUsage,
48
49
  step: ctx.state().analyze?.step ?? 0,
49
- } satisfies AutoBeInterfaceGroupsEvent;
50
+ } satisfies AutoBeInterfaceGroupEvent;
50
51
  }
51
52
 
52
53
  function createController<Model extends ILlmSchema.Model>(props: {
@@ -1,6 +1,6 @@
1
1
  import { IAgenticaController } from "@agentica/core";
2
2
  import {
3
- AutoBeInterfaceOperationsEvent,
3
+ AutoBeInterfaceOperationEvent,
4
4
  AutoBeOpenApi,
5
5
  AutoBeProgressEventBase,
6
6
  } from "@autobe/interface";
@@ -119,8 +119,8 @@ async function process<Model extends ILlmSchema.Model>(
119
119
  const pointer: IPointer<AutoBeOpenApi.IOperation[] | null> = {
120
120
  value: null,
121
121
  };
122
- const { tokenUsage } = await ctx.conversate({
123
- source: "interfaceOperations",
122
+ const { metric, tokenUsage } = await ctx.conversate({
123
+ source: "interfaceOperation",
124
124
  histories: transformInterfaceOperationHistories({
125
125
  state: ctx.state(),
126
126
  endpoints: props.endpoints.toJSON(),
@@ -128,11 +128,11 @@ async function process<Model extends ILlmSchema.Model>(
128
128
  }),
129
129
  controller: createController({
130
130
  model: ctx.model,
131
- roles: ctx.state().analyze?.roles.map((it) => it.name) ?? [],
131
+ actors: ctx.state().analyze?.actors.map((it) => it.name) ?? [],
132
132
  build: (operations) => {
133
133
  pointer.value ??= [];
134
134
  const matrix: AutoBeOpenApi.IOperation[][] = operations.map((op) => {
135
- if (op.authorizationRoles.length === 0)
135
+ if (op.authorizationActors.length === 0)
136
136
  return [
137
137
  {
138
138
  ...op,
@@ -141,19 +141,19 @@ async function process<Model extends ILlmSchema.Model>(
141
141
  [prefix, ...op.path.split("/")]
142
142
  .filter((it) => it !== "")
143
143
  .join("/"),
144
- authorizationRole: null,
144
+ authorizationActor: null,
145
145
  authorizationType: null,
146
146
  prerequisites: [],
147
147
  },
148
148
  ];
149
- return op.authorizationRoles.map((role) => ({
149
+ return op.authorizationActors.map((actor) => ({
150
150
  ...op,
151
151
  path:
152
152
  "/" +
153
- [prefix, role, ...op.path.split("/")]
153
+ [prefix, actor, ...op.path.split("/")]
154
154
  .filter((it) => it !== "")
155
155
  .join("/"),
156
- authorizationRole: role,
156
+ authorizationActor: actor,
157
157
  authorizationType: null,
158
158
  prerequisites: [],
159
159
  }));
@@ -163,10 +163,10 @@ async function process<Model extends ILlmSchema.Model>(
163
163
  props.progress.total += operations
164
164
  .map((op) =>
165
165
  props.endpoints.has({ path: op.path, method: op.method })
166
- ? op.authorizationRoles.length === 0
166
+ ? op.authorizationActors.length === 0
167
167
  ? 0
168
- : op.authorizationRoles.length - 1
169
- : op.authorizationRoles.length,
168
+ : op.authorizationActors.length - 1
169
+ : op.authorizationActors.length,
170
170
  )
171
171
  .reduce((a, b) => a + b, 0);
172
172
  },
@@ -178,20 +178,21 @@ async function process<Model extends ILlmSchema.Model>(
178
178
  if (pointer.value === null) throw new Error("Failed to create operations."); // never be happened
179
179
 
180
180
  ctx.dispatch({
181
- type: "interfaceOperations",
181
+ type: "interfaceOperation",
182
182
  id: v7(),
183
183
  operations: pointer.value,
184
+ metric,
184
185
  tokenUsage,
185
186
  ...props.progress,
186
187
  step: ctx.state().analyze?.step ?? 0,
187
188
  created_at: new Date().toISOString(),
188
- } satisfies AutoBeInterfaceOperationsEvent);
189
+ } satisfies AutoBeInterfaceOperationEvent);
189
190
  return pointer.value;
190
191
  }
191
192
 
192
193
  function createController<Model extends ILlmSchema.Model>(props: {
193
194
  model: Model;
194
- roles: string[];
195
+ actors: string[];
195
196
  build: (
196
197
  operations: IAutoBeInterfaceOperationApplication.IOperation[],
197
198
  ) => void;
@@ -216,21 +217,21 @@ function createController<Model extends ILlmSchema.Model>(props: {
216
217
 
217
218
  operations.forEach((op, i) => {
218
219
  // validate roles
219
- if (props.roles.length === 0) op.authorizationRoles = [];
220
- else if (op.authorizationRoles.length !== 0 && props.roles.length !== 0)
221
- op.authorizationRoles.forEach((role, j) => {
222
- if (props.roles.includes(role) === true) return;
220
+ if (props.actors.length === 0) op.authorizationActors = [];
221
+ else if (op.authorizationActors.length !== 0 && props.actors.length !== 0)
222
+ op.authorizationActors.forEach((actor, j) => {
223
+ if (props.actors.includes(actor) === true) return;
223
224
  errors.push({
224
- path: `$input.operations[${i}].authorizationRoles[${j}]`,
225
- expected: `null | ${props.roles.map((str) => JSON.stringify(str)).join(" | ")}`,
225
+ path: `$input.operations[${i}].authorizationActors[${j}]`,
226
+ expected: `null | ${props.actors.map((str) => JSON.stringify(str)).join(" | ")}`,
226
227
  description: StringUtil.trim`
227
- Role "${role}" is not defined in the roles list.
228
+ Actor "${actor}" is not defined in the roles list.
228
229
 
229
230
  Please select one of them below, or do not define (\`null\`):
230
231
 
231
- ${props.roles.map((role) => `- ${role}`).join("\n")}
232
+ ${props.actors.map((role) => `- ${role}`).join("\n")}
232
233
  `,
233
- value: role,
234
+ value: actor,
234
235
  });
235
236
  });
236
237
  });
@@ -1,6 +1,6 @@
1
1
  import { IAgenticaController } from "@agentica/core";
2
2
  import {
3
- AutoBeInterfaceOperationsReviewEvent,
3
+ AutoBeInterfaceOperationReviewEvent,
4
4
  AutoBeOpenApi,
5
5
  AutoBePrisma,
6
6
  AutoBeProgressEventBase,
@@ -28,8 +28,8 @@ export async function orchestrateInterfaceOperationsReview<
28
28
  {
29
29
  value: null,
30
30
  };
31
- const { tokenUsage } = await ctx.conversate({
32
- source: "interfaceOperationsReview",
31
+ const { metric, tokenUsage } = await ctx.conversate({
32
+ source: "interfaceOperationReview",
33
33
  histories: transformInterfaceOperationsReviewHistories(ctx, operations),
34
34
  controller: createReviewController({
35
35
  model: ctx.model,
@@ -54,18 +54,19 @@ export async function orchestrateInterfaceOperationsReview<
54
54
  );
55
55
 
56
56
  ctx.dispatch({
57
- type: "interfaceOperationsReview",
57
+ type: "interfaceOperationReview",
58
58
  id: v7(),
59
59
  operations: content,
60
60
  review: pointer.value.think.review,
61
61
  plan: pointer.value.think.plan,
62
62
  content,
63
+ metric,
63
64
  tokenUsage,
64
65
  created_at: new Date().toISOString(),
65
66
  step: ctx.state().analyze?.step ?? 0,
66
67
  total: progress.total,
67
68
  completed: ++progress.completed,
68
- } satisfies AutoBeInterfaceOperationsReviewEvent);
69
+ } satisfies AutoBeInterfaceOperationReviewEvent);
69
70
  return content;
70
71
  } catch {
71
72
  ++progress.completed;
@@ -107,8 +107,8 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
107
107
  };
108
108
 
109
109
  try {
110
- const { tokenUsage } = await ctx.conversate({
111
- source: "interfacePrerequisites",
110
+ const { metric, tokenUsage } = await ctx.conversate({
111
+ source: "interfacePrerequisite",
112
112
  controller: createController({
113
113
  model: ctx.model,
114
114
  document: props.document,
@@ -131,9 +131,10 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
131
131
 
132
132
  props.progress.completed += pointer.value.length;
133
133
  ctx.dispatch({
134
- type: "interfacePrerequisites",
134
+ type: "interfacePrerequisite",
135
135
  id: v7(),
136
136
  created_at: new Date().toISOString(),
137
+ metric,
137
138
  tokenUsage,
138
139
  operations: pointer.value,
139
140
  total: props.progress.total,