@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
@@ -86,7 +86,11 @@ export namespace IAutoBeInterfaceOperationApplication {
86
86
  * }
87
87
  * ```
88
88
  */
89
- export interface IOperation extends AutoBeOpenApi.IEndpoint {
89
+ export interface IOperation
90
+ extends Omit<
91
+ AutoBeOpenApi.IEndpoint,
92
+ "authorizationActor" | "prerequisites"
93
+ > {
90
94
  /**
91
95
  * Specification of the API operation.
92
96
  *
@@ -341,58 +345,58 @@ export namespace IAutoBeInterfaceOperationApplication {
341
345
  name: string & CamelCasePattern;
342
346
 
343
347
  /**
344
- * Authorization roles required to access this API operation.
348
+ * Authorization actors required to access this API operation.
345
349
  *
346
- * This field specifies which user roles are allowed to access this
347
- * endpoint. Multiple roles can be specified to allow different types of
350
+ * This field specifies which user actors are allowed to access this
351
+ * endpoint. Multiple actors can be specified to allow different types of
348
352
  * users to access the same endpoint.
349
353
  *
350
- * ## ⚠️ CRITICAL: Role Multiplication Effect
354
+ * ## ⚠️ CRITICAL: Actor Multiplication Effect
351
355
  *
352
- * **EACH ROLE IN THIS ARRAY GENERATES A SEPARATE ENDPOINT**
356
+ * **EACH ACTOR IN THIS ARRAY GENERATES A SEPARATE ENDPOINT**
353
357
  *
354
358
  * - If you specify `["admin", "moderator", "member"]`, this creates 3
355
359
  * separate endpoints
356
- * - Total generated endpoints = operations × average roles.length
357
- * - Example: 100 operations with 3 roles each = 300 actual endpoints
360
+ * - Total generated endpoints = operations × average actors.length
361
+ * - Example: 100 operations with 3 actors each = 300 actual endpoints
358
362
  *
359
363
  * ## 🔴 AVOID OVER-GENERATION
360
364
  *
361
- * **DO NOT create role-specific endpoints when a public endpoint would
365
+ * **DO NOT create actor-specific endpoints when a public endpoint would
362
366
  * suffice:**
363
367
  *
364
368
  * - ❌ BAD: Separate GET endpoints for admin, member, moderator to view the
365
369
  * same public data
366
- * - ✅ GOOD: Single public endpoint `[]` with role-based filtering in business
370
+ * - ✅ GOOD: Single public endpoint `[]` with actor-based filtering in business
367
371
  * logic
368
372
  *
369
- * **DO NOT enumerate all possible roles when the Prisma schema uses a
373
+ * **DO NOT enumerate all possible actors when the Prisma schema uses a
370
374
  * single User table:**
371
375
  *
372
376
  * - If Prisma has a User table with role/permission fields, you likely only
373
377
  * need `["user"]`
374
378
  * - Avoid listing `["admin", "seller", "buyer", "moderator", ...]`
375
379
  * unnecessarily
376
- * - The actual role checking happens in business logic, not at the endpoint
380
+ * - The actual actor checking happens in business logic, not at the endpoint
377
381
  * level
378
382
  *
379
383
  * ## Naming Convention
380
384
  *
381
- * DO: Use camelCase for all role names.
385
+ * DO: Use camelCase for all actor names.
382
386
  *
383
387
  * ## Important Guidelines
384
388
  *
385
389
  * - Set to empty array `[]` for public endpoints that require no
386
390
  * authentication
387
- * - Set to array with role strings for role-restricted endpoints
388
- * - **MINIMIZE the number of roles per endpoint to prevent explosion**
389
- * - Consider if the endpoint can be public with role-based filtering instead
390
- * - The role names match exactly with the user type/role defined in the
391
+ * - Set to array with actor strings for actor-restricted endpoints
392
+ * - **MINIMIZE the number of actors per endpoint to prevent explosion**
393
+ * - Consider if the endpoint can be public with actor-based filtering instead
394
+ * - The actor names match exactly with the user type/actor defined in the
391
395
  * database
392
396
  * - This will be used by the Realize Agent to generate appropriate decorator
393
397
  * and authorization logic in the provider functions
394
398
  * - The controller will apply the corresponding authentication decorator
395
- * based on these roles
399
+ * based on these actors
396
400
  *
397
401
  * ## Examples
398
402
  *
@@ -410,17 +414,17 @@ export namespace IAutoBeInterfaceOperationApplication {
410
414
  *
411
415
  * 1. **Start with public `[]` for all read operations** unless sensitive data
412
416
  * is involved
413
- * 2. **Use single role `["user"]` for authenticated operations** and handle
417
+ * 2. **Use single actor `["user"]` for authenticated operations** and handle
414
418
  * permissions in business logic
415
- * 3. **Only use multiple roles when absolutely necessary** for different
419
+ * 3. **Only use multiple actors when absolutely necessary** for different
416
420
  * business logic paths
417
- * 4. **Remember: Fewer roles = Fewer endpoints = Better performance and
421
+ * 4. **Remember: Fewer actors = Fewer endpoints = Better performance and
418
422
  * maintainability**
419
423
  *
420
424
  * Note: The actual authentication/authorization implementation will be
421
425
  * handled by decorators at the controller level, and the provider function
422
426
  * will receive the authenticated user object with the appropriate type.
423
427
  */
424
- authorizationRoles: Array<string & CamelCasePattern & tags.MinLength<1>>;
428
+ authorizationActors: Array<string & CamelCasePattern & tags.MinLength<1>>;
425
429
  }
426
430
  }
@@ -18,8 +18,8 @@ export interface IAutoBeInterfaceOperationsReviewApplication {
18
18
  * process containing review findings and improvement plans, plus the final
19
19
  * production-ready operations with all critical issues resolved.
20
20
  *
21
- * @param input Properties containing the thinking process (review & plan)
22
- * and the enhanced operations content
21
+ * @param input Properties containing the thinking process (review & plan) and
22
+ * the enhanced operations content
23
23
  */
24
24
  reviewOperations(
25
25
  input: IAutoBeInterfaceOperationsReviewApplication.IProps,
@@ -32,7 +32,7 @@ export namespace IAutoBeInterfaceOperationsReviewApplication {
32
32
  *
33
33
  * Contains both the input operations to be reviewed and the outputs generated
34
34
  * by the Interface Operations Review Agent, which will be published as part
35
- * of the AutoBeInterfaceOperationsReviewEvent.
35
+ * of the AutoBeInterfaceOperationReviewEvent.
36
36
  */
37
37
  export interface IProps {
38
38
  /**
@@ -70,10 +70,10 @@ export namespace IAutoBeInterfaceOperationsReviewApplication {
70
70
  /**
71
71
  * Structured thinking process for comprehensive API operation review.
72
72
  *
73
- * Combines analytical review findings with actionable improvement planning
74
- * to guide the systematic enhancement of API operations. This thinking
75
- * structure ensures all aspects of API quality are evaluated and addressed
76
- * before producing the final operations.
73
+ * Combines analytical review findings with actionable improvement planning to
74
+ * guide the systematic enhancement of API operations. This thinking structure
75
+ * ensures all aspects of API quality are evaluated and addressed before
76
+ * producing the final operations.
77
77
  */
78
78
  export interface IThink {
79
79
  /**
@@ -0,0 +1,108 @@
1
+ import { AutoBeOpenApi } from "@autobe/interface";
2
+
3
+ export interface IAutoBeInterfaceSchemaContentReviewApplication {
4
+ /**
5
+ * Reviews and validates DTO content completeness and consistency in OpenAPI
6
+ * schemas.
7
+ *
8
+ * This specialized content review function focuses exclusively on ensuring
9
+ * DTOs accurately and completely represent their business entities. It
10
+ * validates field completeness, type accuracy, required field settings, and
11
+ * documentation quality.
12
+ *
13
+ * The review process validates and corrects:
14
+ *
15
+ * - Field completeness against Prisma schema
16
+ * - Data type accuracy (Prisma to OpenAPI type mappings)
17
+ * - Required field arrays matching Prisma nullability
18
+ * - Description quality and comprehensiveness
19
+ * - Consistency across DTO variants (IEntity, ICreate, IUpdate, ISummary)
20
+ * - Missing variant detection and creation
21
+ *
22
+ * @param props Content review results including completeness issues found,
23
+ * fixes applied, and modified schemas
24
+ */
25
+ review: (
26
+ props: IAutoBeInterfaceSchemaContentReviewApplication.IProps,
27
+ ) => void;
28
+ }
29
+
30
+ export namespace IAutoBeInterfaceSchemaContentReviewApplication {
31
+ /**
32
+ * Output structure for the content review function.
33
+ *
34
+ * Contains the content analysis, completeness fixes, and schemas modified for
35
+ * content quality during the validation process.
36
+ */
37
+ export interface IProps {
38
+ /** Content analysis and completeness planning information. */
39
+ think: IThink;
40
+
41
+ /**
42
+ * Modified schemas resulting from content and completeness fixes.
43
+ *
44
+ * Contains ONLY the schemas that were modified for content reasons during
45
+ * review. This includes both modified existing schemas and newly created
46
+ * variant schemas.
47
+ *
48
+ * Content modifications include:
49
+ *
50
+ * - Adding missing fields from Prisma schema
51
+ * - Correcting data type mappings
52
+ * - Fixing required field arrays
53
+ * - Enhancing or adding descriptions
54
+ * - Creating missing variant types (ISummary, IUpdate, etc.)
55
+ * - Ensuring cross-variant consistency
56
+ *
57
+ * Return empty object {} when all content is already complete and accurate,
58
+ * requiring no modifications.
59
+ */
60
+ content: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
61
+ }
62
+
63
+ export interface IThink {
64
+ /**
65
+ * Content completeness and quality findings from the review process.
66
+ *
67
+ * Documents all content issues discovered during validation, categorized by
68
+ * type: field completeness, type accuracy, required fields, descriptions,
69
+ * variant consistency, and missing variants. Each issue includes the
70
+ * affected schema and specific problem identified.
71
+ *
72
+ * Common issues documented:
73
+ *
74
+ * - Field Completeness: Missing fields that exist in Prisma schema
75
+ * - Type Accuracy: Incorrect type mappings (e.g., Decimal as string)
76
+ * - Required Fields: Misaligned with Prisma nullable settings
77
+ * - Description Quality: Missing or inadequate descriptions
78
+ * - Variant Consistency: Same field with different types across variants
79
+ * - Missing Variants: Required DTO variants not present
80
+ *
81
+ * Should state "No content or completeness issues found." when all schemas
82
+ * have complete and accurate content.
83
+ */
84
+ review: string;
85
+
86
+ /**
87
+ * Content corrections and completeness fixes applied during review.
88
+ *
89
+ * Lists all content modifications implemented, organized by fix type:
90
+ * fields added, types corrected, required arrays fixed, descriptions
91
+ * enhanced, consistency fixes, and variants created. Documents both field-
92
+ * level changes and schema-level additions.
93
+ *
94
+ * Typical fixes documented:
95
+ *
96
+ * - Fields added to match Prisma schema
97
+ * - Type mappings corrected (Int→integer, Decimal→number)
98
+ * - Required arrays aligned with nullability
99
+ * - Descriptions added or enhanced for clarity
100
+ * - Variant consistency issues resolved
101
+ * - Missing variants created with appropriate fields
102
+ *
103
+ * Should state "No content issues require fixes. All DTOs are complete and
104
+ * consistent." when no content modifications were necessary.
105
+ */
106
+ plan: string;
107
+ }
108
+ }
@@ -0,0 +1,104 @@
1
+ import { AutoBeOpenApi } from "@autobe/interface";
2
+
3
+ export interface IAutoBeInterfaceSchemaRelationReviewApplication {
4
+ /**
5
+ * Reviews and validates DTO relations and structural patterns in OpenAPI
6
+ * schemas.
7
+ *
8
+ * This specialized relation review function focuses exclusively on data
9
+ * relations, foreign key transformations, and structural integrity. It
10
+ * ensures proper modeling of business domains while preventing circular
11
+ * references and enabling efficient code generation.
12
+ *
13
+ * The review process validates and corrects:
14
+ *
15
+ * - Relation classifications (Composition vs Association vs Aggregation)
16
+ * - Foreign key to object transformations in response DTOs
17
+ * - Actor reversal violations (e.g., User containing articles array)
18
+ * - Inline object extractions to named types with $ref
19
+ * - IInvert pattern applications for alternative perspectives
20
+ *
21
+ * @param props Relation review results including violations found, fixes
22
+ * applied, and modified schemas
23
+ */
24
+ review: (
25
+ props: IAutoBeInterfaceSchemaRelationReviewApplication.IProps,
26
+ ) => void;
27
+ }
28
+
29
+ export namespace IAutoBeInterfaceSchemaRelationReviewApplication {
30
+ /**
31
+ * Output structure for the relation review function.
32
+ *
33
+ * Contains the relation analysis, structural fixes, and schemas modified for
34
+ * proper relations during the validation process.
35
+ */
36
+ export interface IProps {
37
+ /** Relation analysis and structural planning information. */
38
+ think: IThink;
39
+
40
+ /**
41
+ * Modified schemas resulting from relation and structural fixes.
42
+ *
43
+ * Contains ONLY the schemas that were modified for relation or structural
44
+ * reasons during review. This includes both modified existing schemas and
45
+ * newly created schemas (extracted types, IInvert types).
46
+ *
47
+ * Relation modifications include:
48
+ *
49
+ * - Extracting inline objects to named types with $ref
50
+ * - Transforming foreign keys to object references
51
+ * - Removing incorrect reverse relations
52
+ * - Creating new IInvert types for alternative views
53
+ * - Correcting relation types (composition/association/aggregation)
54
+ *
55
+ * Return empty object {} when all relations are already correct and no
56
+ * structural fixes were needed.
57
+ */
58
+ content: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
59
+ }
60
+
61
+ export interface IThink {
62
+ /**
63
+ * Relation and structural violation findings from the review process.
64
+ *
65
+ * Documents all relation issues discovered during validation, categorized
66
+ * by severity and type. Each violation includes the affected schema,
67
+ * specific relation problem, and theoretical justification.
68
+ *
69
+ * Common violations documented:
70
+ *
71
+ * - CRITICAL: Inline object types instead of named types with $ref
72
+ * - CRITICAL: Actor reversal violations (User.articles[], Seller.sales[])
73
+ * - HIGH: Raw foreign keys instead of object references
74
+ * - HIGH: Wrong relation types (event-driven data as composition)
75
+ * - MEDIUM: Missing IInvert types for independent child views
76
+ * - LOW: Naming convention violations (plural instead of singular)
77
+ *
78
+ * Should state "No relation or structure issues found." when all schemas
79
+ * have correct relations.
80
+ */
81
+ review: string;
82
+
83
+ /**
84
+ * Relation corrections and structural fixes applied during review.
85
+ *
86
+ * Lists all relation modifications implemented, organized by fix type and
87
+ * impact. Documents both schemas modified and new schemas created during
88
+ * the fix process.
89
+ *
90
+ * Typical fixes documented:
91
+ *
92
+ * - Inline objects extracted to named types
93
+ * - Foreign keys transformed to object references
94
+ * - Actor reversal arrays removed with API endpoint suggestions
95
+ * - IInvert types created with parent context
96
+ * - Relation types corrected based on lifecycle analysis
97
+ * - Naming conventions standardized
98
+ *
99
+ * Should state "No relation issues require fixes. All relations are
100
+ * properly structured." when no modifications were necessary.
101
+ */
102
+ plan: string;
103
+ }
104
+ }
@@ -0,0 +1,45 @@
1
+ import { AutoBeInterfaceSchemaRefactor } from "@autobe/interface";
2
+
3
+ export interface IAutoBeInterfaceSchemaRenameApplication {
4
+ /**
5
+ * Analyze DTO type names and identify naming violations.
6
+ *
7
+ * This method examines existing DTO type names to detect violations of the
8
+ * CRITICAL naming rule: ALL words from the Prisma table name MUST be
9
+ * preserved in the DTO type name. Omitting intermediate words breaks
10
+ * type-to-table traceability and causes system failures.
11
+ *
12
+ * The method receives a list of Prisma table names and current DTO type
13
+ * names, then identifies which type names incorrectly omit service prefixes
14
+ * or intermediate components from their corresponding table names.
15
+ *
16
+ * @param props Properties containing refactoring operations to fix naming
17
+ * violations.
18
+ */
19
+ rename(props: IAutoBeInterfaceSchemaRenameApplication.IProps): void;
20
+ }
21
+ export namespace IAutoBeInterfaceSchemaRenameApplication {
22
+ export interface IProps {
23
+ /**
24
+ * List of refactoring operations to rename incorrectly named DTO types.
25
+ *
26
+ * Each refactor specifies:
27
+ *
28
+ * - `from`: The current INCORRECT type name (e.g., "ISale", "IBbsComment")
29
+ * - `to`: The CORRECT type name with all components preserved (e.g.,
30
+ * "IShoppingSale", "IBbsArticleComment")
31
+ *
32
+ * IMPORTANT: Only include type names that violate the naming rules. If a
33
+ * type name correctly preserves all components from the table name, do NOT
34
+ * include it in the refactors list.
35
+ *
36
+ * The orchestrator will automatically handle:
37
+ *
38
+ * - Renaming the base type (e.g., ISale → IShoppingSale)
39
+ * - Renaming all variants (e.g., ISale.ICreate → IShoppingSale.ICreate)
40
+ * - Renaming page types (e.g., IPageISale → IPageIShoppingSale)
41
+ * - Updating all $ref references throughout the OpenAPI document
42
+ */
43
+ refactors: AutoBeInterfaceSchemaRefactor[];
44
+ }
45
+ }
@@ -0,0 +1,99 @@
1
+ import { AutoBeOpenApi } from "@autobe/interface";
2
+
3
+ export interface IAutoBeInterfaceSchemaSecurityReviewApplication {
4
+ /**
5
+ * Reviews and validates OpenAPI schema definitions for security compliance.
6
+ *
7
+ * This specialized security review function focuses exclusively on
8
+ * authentication boundaries, data protection, and system integrity. It
9
+ * enforces strict security policies to prevent authentication bypass, data
10
+ * exposure, and unauthorized access.
11
+ *
12
+ * The review process identifies and removes:
13
+ *
14
+ * - Authentication context fields in request DTOs (e.g., bbs_member_id)
15
+ * - Password and token fields in response DTOs
16
+ * - System-managed fields in request DTOs
17
+ * - Phantom fields that don't exist in Prisma schema
18
+ *
19
+ * @param props Security review results including violations found, fixes
20
+ * applied, and modified schemas
21
+ */
22
+ review: (
23
+ props: IAutoBeInterfaceSchemaSecurityReviewApplication.IProps,
24
+ ) => void;
25
+ }
26
+
27
+ export namespace IAutoBeInterfaceSchemaSecurityReviewApplication {
28
+ /**
29
+ * Output structure for the security review function.
30
+ *
31
+ * Contains the security analysis, remediation actions, and schemas modified
32
+ * for security compliance during the validation process.
33
+ */
34
+ export interface IProps {
35
+ /** Security analysis and remediation planning information. */
36
+ think: IThink;
37
+
38
+ /**
39
+ * Modified schemas resulting from security fixes.
40
+ *
41
+ * Contains ONLY the schemas that were modified for security reasons during
42
+ * review. This focused output enables precise tracking of security-related
43
+ * changes.
44
+ *
45
+ * Security modifications include:
46
+ *
47
+ * - Removing authentication context fields (user_id, session_id, etc.)
48
+ * - Removing password/token fields from responses
49
+ * - Removing system-managed fields from requests
50
+ * - Removing phantom fields not in Prisma schema
51
+ *
52
+ * Return empty object {} when all schemas are already secure and no
53
+ * security fixes were needed.
54
+ */
55
+ content: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
56
+ }
57
+
58
+ export interface IThink {
59
+ /**
60
+ * Security violation findings from the review process.
61
+ *
62
+ * Documents all security issues discovered during validation, categorized
63
+ * by severity level (CRITICAL, HIGH, MEDIUM, LOW). Each violation includes
64
+ * the affected schema name, field name, and specific security rule
65
+ * violated.
66
+ *
67
+ * Common violations documented:
68
+ *
69
+ * - CRITICAL: Authentication context in requests (bbs_member_id, session_id)
70
+ * - CRITICAL: Password/token exposure in responses
71
+ * - CRITICAL: Phantom fields not existing in Prisma schema
72
+ * - HIGH: System-managed fields in requests
73
+ * - HIGH: Immutable ownership fields in updates
74
+ *
75
+ * Should state "No security violations found." when all schemas pass
76
+ * security validation.
77
+ */
78
+ review: string;
79
+
80
+ /**
81
+ * Security remediation actions applied to fix identified violations.
82
+ *
83
+ * Lists all security fixes implemented during the review process, organized
84
+ * by fix type and priority. Each fix documents which field was removed or
85
+ * modified and from which schema.
86
+ *
87
+ * Typical fixes documented:
88
+ *
89
+ * - Authentication context fields removed from request DTOs
90
+ * - Sensitive data removed from response DTOs
91
+ * - Phantom fields deleted to match Prisma schema
92
+ * - System fields removed from client-controllable DTOs
93
+ *
94
+ * Should state "No security issues require fixes. All schemas are secure."
95
+ * when no security modifications were necessary.
96
+ */
97
+ plan: string;
98
+ }
99
+ }
@@ -1,6 +1,6 @@
1
1
  import { AutoBeOpenApi, AutoBePrisma } from "@autobe/interface";
2
2
  import { AutoBeOpenApiTypeChecker, StringUtil } from "@autobe/utils";
3
- import { OpenApiTypeChecker } from "@samchon/openapi";
3
+ import { OpenApi, OpenApiTypeChecker } from "@samchon/openapi";
4
4
  import typia, { tags } from "typia";
5
5
 
6
6
  export namespace JsonSchemaFactory {
@@ -53,6 +53,7 @@ export namespace JsonSchemaFactory {
53
53
  application: AutoBePrisma.IApplication;
54
54
  }): void => {
55
55
  removeUnused(props.document);
56
+ removeDuplicated(props.document);
56
57
  fixTimestamps(props);
57
58
  };
58
59
 
@@ -84,6 +85,47 @@ export namespace JsonSchemaFactory {
84
85
  if (used.has(key) === false) delete document.components.schemas[key];
85
86
  };
86
87
 
88
+ const removeDuplicated = (document: AutoBeOpenApi.IDocument): void => {
89
+ // gather duplicated schemas
90
+ const correct: Map<string, string> = new Map();
91
+ for (const key of Object.keys(document.components.schemas)) {
92
+ if (key.includes(".") === false) continue;
93
+ const dotRemoved: string = key.replace(".", "");
94
+ if (document.components.schemas[dotRemoved] === undefined) continue;
95
+ correct.set(dotRemoved, key);
96
+ }
97
+
98
+ // fix operations' references
99
+ for (const op of document.operations) {
100
+ if (op.requestBody && correct.has(op.requestBody.typeName))
101
+ op.requestBody.typeName = correct.get(op.requestBody.typeName)!;
102
+ if (op.responseBody && correct.has(op.responseBody.typeName))
103
+ op.responseBody.typeName = correct.get(op.responseBody.typeName)!;
104
+ }
105
+
106
+ // fix schemas' references
107
+ const $refChangers: Map<OpenApi.IJsonSchema, () => void> = new Map();
108
+ for (const value of Object.values(document.components.schemas))
109
+ OpenApiTypeChecker.visit({
110
+ components: { schemas: document.components.schemas },
111
+ schema: value,
112
+ closure: (next) => {
113
+ if (OpenApiTypeChecker.isReference(next) === false) return;
114
+ const x: string = next.$ref.split("/").pop()!;
115
+ const y: string | undefined = correct.get(x);
116
+ if (y === undefined) return;
117
+ $refChangers.set(
118
+ next,
119
+ () => (next.$ref = `#/components/schemas/${y}`),
120
+ );
121
+ },
122
+ });
123
+ for (const fn of $refChangers.values()) fn();
124
+
125
+ // remove duplicated schemas
126
+ for (const key of correct.keys()) delete document.components.schemas[key];
127
+ };
128
+
87
129
  const fixTimestamps = (props: {
88
130
  document: AutoBeOpenApi.IDocument;
89
131
  application: AutoBePrisma.IApplication;
@@ -220,8 +262,8 @@ namespace IPage {
220
262
  * refresh tokens along with their expiration information.
221
263
  *
222
264
  * This token structure is automatically included in API schemas when the system
223
- * detects authorization roles in the requirements analysis phase. It provides a
224
- * standard format for JWT-based authentication across the generated backend
265
+ * detects authorization actors in the requirements analysis phase. It provides
266
+ * a standard format for JWT-based authentication across the generated backend
225
267
  * applications.
226
268
  */
227
269
  interface IAuthorizationToken {