@autobe/agent 0.20.0 → 0.22.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 (320) hide show
  1. package/lib/agent/src/AutoBeAgent.js +2 -2
  2. package/lib/agent/src/AutoBeAgent.js.map +1 -1
  3. package/lib/agent/src/AutoBeMockAgent.js +1 -0
  4. package/lib/agent/src/AutoBeMockAgent.js.map +1 -1
  5. package/lib/agent/src/constants/AutoBeConfigConstant.d.ts +3 -0
  6. package/lib/agent/src/{orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js → constants/AutoBeConfigConstant.js} +1 -1
  7. package/lib/agent/src/constants/AutoBeConfigConstant.js.map +1 -0
  8. package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +27 -26
  9. package/lib/agent/src/constants/AutoBeSystemPromptConstant.js.map +1 -1
  10. package/lib/agent/src/context/AutoBeContext.d.ts +3 -2
  11. package/lib/agent/src/context/AutoBeTokenUsageComponent.js +4 -3
  12. package/lib/agent/src/context/AutoBeTokenUsageComponent.js.map +1 -1
  13. package/lib/agent/src/factory/consentFunctionCall.js +4 -4
  14. package/lib/agent/src/factory/consentFunctionCall.js.map +1 -1
  15. package/lib/agent/src/factory/createAutoBeContext.js +16 -11
  16. package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
  17. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
  18. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
  19. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
  20. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  21. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +1 -1
  22. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  23. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +6 -6
  24. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +50 -8
  25. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  26. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +4 -4
  27. package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
  28. package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
  29. package/lib/agent/src/orchestrate/facade/transformFacadeStateMessage.js +1 -1
  30. package/lib/agent/src/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
  31. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +19 -1
  32. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  33. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
  34. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  35. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
  36. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  37. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
  38. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +33 -0
  39. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -0
  40. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
  41. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  42. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
  43. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  44. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
  45. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  46. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
  47. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  48. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
  49. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
  50. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  51. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +5 -1
  52. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
  53. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +16 -10
  54. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  55. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
  56. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +3731 -228
  57. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  58. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js +5 -3
  59. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  60. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
  61. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +365 -0
  62. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -0
  63. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +43 -63
  64. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  65. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +244 -176
  66. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  67. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +3466 -103
  68. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  69. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
  70. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +3672 -358
  71. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
  72. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
  73. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js +3 -0
  74. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js.map +1 -0
  75. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
  76. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -101
  77. package/lib/agent/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
  78. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
  79. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.js +1385 -0
  80. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -0
  81. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
  82. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.js +78 -0
  83. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.js.map +1 -0
  84. package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
  85. package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js +81 -0
  86. package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js.map +1 -0
  87. package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js.map +1 -1
  88. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +1 -1
  89. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  90. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +1 -1
  91. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
  92. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +2 -2
  93. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  94. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
  95. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  96. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
  97. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +2 -2
  98. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  99. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +1 -1
  100. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
  101. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +2 -2
  102. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  103. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
  104. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +22 -7
  105. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  106. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
  107. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +13 -29
  108. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  109. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
  110. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js +2 -8
  111. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
  112. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +6 -49
  113. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
  114. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +4 -2
  115. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  116. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +5 -3
  117. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  118. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
  119. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +206 -118
  120. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  121. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
  122. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js +2 -2
  123. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
  124. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
  125. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +24 -39
  126. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  127. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
  128. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
  129. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
  130. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
  131. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js +3 -0
  132. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js.map +1 -0
  133. package/{src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.ts → lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts} +3 -10
  134. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js +3 -0
  135. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js.map +1 -0
  136. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +40 -24
  137. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
  138. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +86 -0
  139. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -0
  140. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
  141. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js +55 -0
  142. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -0
  143. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
  144. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js +20 -0
  145. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -0
  146. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
  147. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js +73 -0
  148. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -0
  149. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
  150. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js +63 -69
  151. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  152. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js +15 -14
  153. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
  154. package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js +1 -1
  155. package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
  156. package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
  157. package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js +19 -0
  158. package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js.map +1 -0
  159. package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
  160. package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js +2 -0
  161. package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
  162. package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
  163. package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js +21 -0
  164. package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js.map +1 -0
  165. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.d.ts +4 -2
  166. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +40 -25
  167. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  168. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +5 -4
  169. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  170. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
  171. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +137 -96
  172. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  173. package/lib/agent/src/orchestrate/test/orchestrateTest.js +6 -0
  174. package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
  175. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
  176. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +126 -72
  177. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  178. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +54 -48
  179. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  180. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +122 -43
  181. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  182. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
  183. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
  184. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js +3 -0
  185. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js.map +1 -0
  186. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
  187. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
  188. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
  189. package/lib/agent/src/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
  190. package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js +28 -0
  191. package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js.map +1 -0
  192. package/lib/agent/src/structures/IAutoBeConfig.d.ts +2 -0
  193. package/lib/constants/AutoBeConfigConstant.d.ts +3 -0
  194. package/lib/constants/AutoBeSystemPromptConstant.d.ts +27 -26
  195. package/lib/context/AutoBeContext.d.ts +3 -2
  196. package/lib/index.mjs +13778 -3055
  197. package/lib/index.mjs.map +1 -1
  198. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
  199. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
  200. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
  201. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
  202. package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
  203. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
  204. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
  205. package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
  206. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
  207. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -101
  208. package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
  209. package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
  210. package/lib/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
  211. package/lib/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
  212. package/lib/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
  213. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
  214. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
  215. package/lib/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
  216. package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
  217. package/lib/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
  218. package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
  219. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
  220. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
  221. package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
  222. package/lib/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
  223. package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts +36 -0
  224. package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +40 -24
  225. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
  226. package/lib/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
  227. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
  228. package/lib/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
  229. package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
  230. package/lib/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
  231. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
  232. package/lib/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
  233. package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +4 -2
  234. package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
  235. package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
  236. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
  237. package/lib/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
  238. package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
  239. package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
  240. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
  241. package/lib/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
  242. package/lib/structures/IAutoBeConfig.d.ts +2 -0
  243. package/package.json +6 -6
  244. package/src/AutoBeAgent.ts +2 -0
  245. package/src/AutoBeMockAgent.ts +1 -0
  246. package/src/constants/AutoBeConfigConstant.ts +3 -0
  247. package/src/constants/AutoBeSystemPromptConstant.ts +27 -26
  248. package/src/context/AutoBeContext.ts +3 -0
  249. package/src/context/AutoBeTokenUsageComponent.ts +3 -3
  250. package/src/factory/consentFunctionCall.ts +2 -0
  251. package/src/factory/createAutoBeContext.ts +145 -135
  252. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +6 -0
  253. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +4 -0
  254. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +19 -1
  255. package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +39 -0
  256. package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +1 -4
  257. package/src/orchestrate/interface/orchestrateInterface.ts +15 -4
  258. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +13 -5
  259. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +58 -19
  260. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +5 -1
  261. package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +95 -0
  262. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +11 -11
  263. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +7 -3
  264. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +33 -91
  265. package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +72 -95
  266. package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.ts +65 -0
  267. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +0 -39
  268. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +50 -104
  269. package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +31 -27
  270. package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +171 -0
  271. package/src/orchestrate/interface/utils/JsonSchemaNamingConvention.ts +83 -0
  272. package/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.ts +90 -0
  273. package/src/orchestrate/interface/utils/validateAuthorizationSchema.ts +2 -2
  274. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +1 -2
  275. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +30 -15
  276. package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +27 -49
  277. package/src/orchestrate/realize/internal/compileRealizeFiles.ts +4 -11
  278. package/src/orchestrate/realize/orchestrateRealize.ts +19 -75
  279. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +1 -1
  280. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +114 -25
  281. package/src/orchestrate/realize/orchestrateRealizeScenario.ts +9 -5
  282. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +11 -15
  283. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +17 -0
  284. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +20 -0
  285. package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +40 -74
  286. package/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.ts +9 -0
  287. package/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.ts +45 -0
  288. package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +43 -27
  289. package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +97 -0
  290. package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +64 -0
  291. package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +29 -0
  292. package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +82 -0
  293. package/src/orchestrate/realize/utils/replaceImportStatements.ts +101 -111
  294. package/src/orchestrate/test/compile/completeTestCode.ts +15 -26
  295. package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +3 -0
  296. package/src/orchestrate/test/compile/getTestImportStatements.ts +25 -0
  297. package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +6 -1
  298. package/src/orchestrate/test/compile/getTestTemplateCode.ts +25 -0
  299. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +48 -36
  300. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +6 -5
  301. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +43 -4
  302. package/src/orchestrate/test/orchestrateTest.ts +6 -0
  303. package/src/orchestrate/test/orchestrateTestCorrect.ts +46 -11
  304. package/src/orchestrate/test/orchestrateTestScenario.ts +52 -48
  305. package/src/orchestrate/test/orchestrateTestWrite.ts +24 -6
  306. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +49 -46
  307. package/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.ts +8 -0
  308. package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +28 -1
  309. package/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.ts +1 -0
  310. package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +14 -0
  311. package/src/orchestrate/test/utils/getReferenceIds.ts +25 -0
  312. package/src/structures/IAutoBeConfig.ts +3 -0
  313. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
  314. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js.map +0 -1
  315. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
  316. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js +0 -75
  317. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js.map +0 -1
  318. package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
  319. package/lib/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
  320. package/src/orchestrate/test/histories/transformTestHistories.ts +0 -78
@@ -3,6 +3,7 @@ import { AutoBeOpenApi } from "@autobe/interface";
3
3
  import {
4
4
  ILlmApplication,
5
5
  ILlmSchema,
6
+ IValidation,
6
7
  OpenApiTypeChecker,
7
8
  } from "@samchon/openapi";
8
9
  import { OpenApiV3_1Emender } from "@samchon/openapi/lib/converters/OpenApiV3_1Emender";
@@ -14,22 +15,25 @@ import { AutoBeContext } from "../../context/AutoBeContext";
14
15
  import { assertSchemaModel } from "../../context/assertSchemaModel";
15
16
  import { transformInterfaceComplementHistories } from "./histories/transformInterfaceComplementHistories";
16
17
  import { IAutoBeInterfaceComplementApplication } from "./structures/IAutoBeInterfaceComplementApplication";
18
+ import { JsonSchemaFactory } from "./utils/JsonSchemaFactory";
19
+ import { JsonSchemaNamingConvention } from "./utils/JsonSchemaNamingConvention";
20
+ import { fulfillJsonSchemaErrorMessages } from "./utils/fulfillJsonSchemaErrorMessages";
21
+ import { validateAuthorizationSchema } from "./utils/validateAuthorizationSchema";
17
22
 
18
23
  export function orchestrateInterfaceComplement<Model extends ILlmSchema.Model>(
19
24
  ctx: AutoBeContext<Model>,
20
25
  document: AutoBeOpenApi.IDocument,
21
- life: number = 8,
22
26
  ): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
23
- return step(ctx, document, life);
27
+ return step(ctx, document, 8);
24
28
  }
25
29
 
26
30
  async function step<Model extends ILlmSchema.Model>(
27
31
  ctx: AutoBeContext<Model>,
28
32
  document: AutoBeOpenApi.IDocument,
29
- retry: number,
33
+ life: number,
30
34
  ): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
31
35
  const missed: string[] = getMissed(document);
32
- if (missed.length === 0 || retry <= 0) {
36
+ if (missed.length === 0 || life <= 0) {
33
37
  return document.components.schemas;
34
38
  }
35
39
 
@@ -83,6 +87,7 @@ async function step<Model extends ILlmSchema.Model>(
83
87
  ...pointer.value,
84
88
  ...document.components.schemas,
85
89
  };
90
+ JsonSchemaNamingConvention.schemas(document.operations, newSchemas);
86
91
  return step(
87
92
  ctx,
88
93
  {
@@ -92,7 +97,7 @@ async function step<Model extends ILlmSchema.Model>(
92
97
  schemas: newSchemas,
93
98
  },
94
99
  },
95
- retry - 1,
100
+ life - 1,
96
101
  );
97
102
  }
98
103
 
@@ -124,9 +129,39 @@ function createController<Model extends ILlmSchema.Model>(props: {
124
129
  ) => void;
125
130
  }): IAgenticaController.IClass<Model> {
126
131
  assertSchemaModel(props.model);
132
+
133
+ const validate = (
134
+ next: unknown,
135
+ ): IValidation<IAutoBeInterfaceComplementApplication.IProps> => {
136
+ JsonSchemaFactory.fix("schemas", next);
137
+
138
+ const result: IValidation<IAutoBeInterfaceComplementApplication.IProps> =
139
+ typia.validate<IAutoBeInterfaceComplementApplication.IProps>(next);
140
+ if (result.success === false) {
141
+ fulfillJsonSchemaErrorMessages(result.errors);
142
+ return result;
143
+ }
144
+
145
+ const errors: IValidation.IError[] = [];
146
+ validateAuthorizationSchema({
147
+ errors,
148
+ schemas: result.data.schemas,
149
+ path: "$input.schemas",
150
+ });
151
+ if (errors.length !== 0)
152
+ return {
153
+ success: false,
154
+ errors,
155
+ data: next,
156
+ };
157
+ return result;
158
+ };
159
+
127
160
  const application: ILlmApplication<Model> = collection[
128
- props.model
129
- ] satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
161
+ props.model === "chatgpt" ? "chatgpt" : "claude"
162
+ ](
163
+ validate,
164
+ ) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
130
165
  return {
131
166
  protocol: "class",
132
167
  name: "interface",
@@ -139,17 +174,21 @@ function createController<Model extends ILlmSchema.Model>(props: {
139
174
  };
140
175
  }
141
176
 
142
- const claude = typia.llm.application<
143
- IAutoBeInterfaceComplementApplication,
144
- "claude"
145
- >();
146
177
  const collection = {
147
- chatgpt: typia.llm.application<
148
- IAutoBeInterfaceComplementApplication,
149
- "chatgpt"
150
- >(),
151
- claude,
152
- llama: claude,
153
- deepseek: claude,
154
- "3.1": claude,
178
+ chatgpt: (validate: Validator) =>
179
+ typia.llm.application<IAutoBeInterfaceComplementApplication, "chatgpt">({
180
+ validate: {
181
+ complementComponents: validate,
182
+ },
183
+ }),
184
+ claude: (validate: Validator) =>
185
+ typia.llm.application<IAutoBeInterfaceComplementApplication, "claude">({
186
+ validate: {
187
+ complementComponents: validate,
188
+ },
189
+ }),
155
190
  };
191
+
192
+ type Validator = (
193
+ input: unknown,
194
+ ) => IValidation<IAutoBeInterfaceComplementApplication.IProps>;
@@ -14,6 +14,7 @@ import { AutoBeContext } from "../../context/AutoBeContext";
14
14
  import { assertSchemaModel } from "../../context/assertSchemaModel";
15
15
  import { executeCachedBatch } from "../../utils/executeCachedBatch";
16
16
  import { transformInterfaceEndpointHistories } from "./histories/transformInterfaceEndpointHistories";
17
+ import { orchestrateInterfaceEndpointsReview } from "./orchestrateInterfaceEndpointsReview";
17
18
  import { IAutoBeInterfaceEndpointApplication } from "./structures/IAutoBeInterfaceEndpointApplication";
18
19
  import { OpenApiEndpointComparator } from "./utils/OpenApiEndpointComparator";
19
20
 
@@ -37,11 +38,14 @@ export async function orchestrateInterfaceEndpoints<
37
38
  ),
38
39
  )
39
40
  ).flat();
40
- return new HashSet(
41
+
42
+ const deduplicated: AutoBeOpenApi.IEndpoint[] = new HashSet(
41
43
  endpoints,
42
44
  OpenApiEndpointComparator.hashCode,
43
45
  OpenApiEndpointComparator.equals,
44
46
  ).toJSON();
47
+
48
+ return orchestrateInterfaceEndpointsReview(ctx, deduplicated);
45
49
  }
46
50
 
47
51
  async function process<Model extends ILlmSchema.Model>(
@@ -0,0 +1,95 @@
1
+ import { IAgenticaController } from "@agentica/core";
2
+ import { AutoBeOpenApi } from "@autobe/interface";
3
+ import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
4
+ import { IPointer } from "tstl";
5
+ import typia from "typia";
6
+ import { v7 } from "uuid";
7
+
8
+ import { AutoBeContext } from "../../context/AutoBeContext";
9
+ import { assertSchemaModel } from "../../context/assertSchemaModel";
10
+ import { transformInterfaceEndpointsReviewHistories } from "./histories/transformInterfaceEndpointsReviewHistories";
11
+ import { IAutoBeInterfaceEndpointsReviewApplication } from "./structures/IAutoBeInterfaceEndpointsReviewApplication";
12
+
13
+ export async function orchestrateInterfaceEndpointsReview<
14
+ Model extends ILlmSchema.Model,
15
+ >(
16
+ ctx: AutoBeContext<Model>,
17
+ endpoints: AutoBeOpenApi.IEndpoint[],
18
+ message: string = `Review the generated endpoints`,
19
+ ): Promise<AutoBeOpenApi.IEndpoint[]> {
20
+ const pointer: IPointer<IAutoBeInterfaceEndpointsReviewApplication.IProps | null> =
21
+ {
22
+ value: null,
23
+ };
24
+
25
+ const { tokenUsage } = await ctx.conversate({
26
+ source: "interfaceEndpointsReview",
27
+ histories: transformInterfaceEndpointsReviewHistories(
28
+ ctx.state(),
29
+ endpoints,
30
+ ),
31
+ controller: createController({
32
+ model: ctx.model,
33
+ build: (props) => {
34
+ pointer.value = props;
35
+ },
36
+ }),
37
+ enforceFunctionCall: true,
38
+ message,
39
+ });
40
+
41
+ if (pointer.value === null) {
42
+ return endpoints;
43
+ }
44
+
45
+ const response = pointer.value?.endpoints ?? [];
46
+
47
+ ctx.dispatch({
48
+ id: v7(),
49
+ type: "interfaceEndpointsReview",
50
+ endpoints,
51
+ content: response,
52
+ created_at: new Date().toISOString(),
53
+ review: pointer.value?.review,
54
+ step: ctx.state().analyze?.step ?? 0,
55
+ tokenUsage,
56
+ });
57
+
58
+ return response;
59
+ }
60
+
61
+ export function createController<Model extends ILlmSchema.Model>(props: {
62
+ model: Model;
63
+ build: (props: IAutoBeInterfaceEndpointsReviewApplication.IProps) => void;
64
+ }): IAgenticaController.IClass<Model> {
65
+ assertSchemaModel(props.model);
66
+
67
+ const application: ILlmApplication<Model> = collection[
68
+ props.model
69
+ ] satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
70
+ return {
71
+ protocol: "class",
72
+ name: "interface",
73
+ application,
74
+ execute: {
75
+ reviewEndpoints: (next) => {
76
+ props.build(next);
77
+ },
78
+ } satisfies IAutoBeInterfaceEndpointsReviewApplication,
79
+ };
80
+ }
81
+
82
+ const claude = typia.llm.application<
83
+ IAutoBeInterfaceEndpointsReviewApplication,
84
+ "claude"
85
+ >();
86
+ const collection = {
87
+ chatgpt: typia.llm.application<
88
+ IAutoBeInterfaceEndpointsReviewApplication,
89
+ "chatgpt"
90
+ >(),
91
+ claude,
92
+ llama: claude,
93
+ deepseek: claude,
94
+ "3.1": claude,
95
+ };
@@ -34,21 +34,22 @@ export async function orchestrateInterfaceOperations<
34
34
  capacity,
35
35
  });
36
36
 
37
+ const progress: AutoBeProgressEventBase = {
38
+ total: matrix.flat().length,
39
+ completed: 0,
40
+ };
41
+ const reviewProgress: AutoBeProgressEventBase = {
42
+ total: matrix.length,
43
+ completed: 0,
44
+ };
37
45
  return (
38
46
  await executeCachedBatch(
39
47
  matrix.map((it) => async (promptCacheKey) => {
40
48
  const row: AutoBeOpenApi.IOperation[] = await divideAndConquer(
41
49
  ctx,
42
50
  it,
43
- 3,
44
- {
45
- total: matrix.length,
46
- completed: 0,
47
- },
48
- {
49
- total: matrix.length,
50
- completed: 0,
51
- },
51
+ progress,
52
+ reviewProgress,
52
53
  promptCacheKey,
53
54
  );
54
55
  return row;
@@ -60,7 +61,6 @@ export async function orchestrateInterfaceOperations<
60
61
  async function divideAndConquer<Model extends ILlmSchema.Model>(
61
62
  ctx: AutoBeContext<Model>,
62
63
  endpoints: AutoBeOpenApi.IEndpoint[],
63
- retry: number,
64
64
  operationsProgress: AutoBeProgressEventBase,
65
65
  operationsReviewProgress: AutoBeProgressEventBase,
66
66
  promptCacheKey: string,
@@ -75,7 +75,7 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
75
75
  OpenApiEndpointComparator.hashCode,
76
76
  OpenApiEndpointComparator.equals,
77
77
  );
78
- for (let i: number = 0; i < retry; ++i) {
78
+ for (let i: number = 0; i < ctx.retry; ++i) {
79
79
  if (remained.empty() === true || unique.size() >= endpoints.length) break;
80
80
  const operations: AutoBeOpenApi.IOperation[] = remained.size()
81
81
  ? await process(ctx, remained, operationsProgress, promptCacheKey)
@@ -2,6 +2,7 @@ import { IAgenticaController } from "@agentica/core";
2
2
  import {
3
3
  AutoBeInterfaceOperationsReviewEvent,
4
4
  AutoBeOpenApi,
5
+ AutoBePrisma,
5
6
  AutoBeProgressEventBase,
6
7
  } from "@autobe/interface";
7
8
  import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
@@ -21,6 +22,7 @@ export async function orchestrateInterfaceOperationsReview<
21
22
  progress: AutoBeProgressEventBase,
22
23
  ): Promise<AutoBeOpenApi.IOperation[]> {
23
24
  try {
25
+ const files: AutoBePrisma.IFile[] = ctx.state().prisma?.result.data.files!;
24
26
  const pointer: IPointer<IAutoBeInterfaceOperationsReviewApplication.IProps | null> =
25
27
  {
26
28
  value: null,
@@ -30,6 +32,7 @@ export async function orchestrateInterfaceOperationsReview<
30
32
  histories: transformInterfaceOperationsReviewHistories(ctx, operations),
31
33
  controller: createReviewController({
32
34
  model: ctx.model,
35
+ prismaSchemas: files,
33
36
  build: (next: IAutoBeInterfaceOperationsReviewApplication.IProps) => {
34
37
  pointer.value = next;
35
38
  },
@@ -39,7 +42,7 @@ export async function orchestrateInterfaceOperationsReview<
39
42
  });
40
43
  if (pointer.value === null) {
41
44
  console.error("Failed to review operations.");
42
- progress.completed += operations.length;
45
+ ++progress.completed;
43
46
  return [];
44
47
  }
45
48
 
@@ -54,8 +57,8 @@ export async function orchestrateInterfaceOperationsReview<
54
57
  type: "interfaceOperationsReview",
55
58
  id: v7(),
56
59
  operations: content,
57
- review: pointer.value.review,
58
- plan: pointer.value.plan,
60
+ review: pointer.value.think.review,
61
+ plan: pointer.value.think.plan,
59
62
  content,
60
63
  tokenUsage,
61
64
  created_at: new Date().toISOString(),
@@ -73,6 +76,7 @@ export async function orchestrateInterfaceOperationsReview<
73
76
 
74
77
  function createReviewController<Model extends ILlmSchema.Model>(props: {
75
78
  model: Model;
79
+ prismaSchemas: AutoBePrisma.IFile[];
76
80
  build: (reviews: IAutoBeInterfaceOperationsReviewApplication.IProps) => void;
77
81
  }): IAgenticaController.IClass<Model> {
78
82
  const application: ILlmApplication<Model> = collection[
@@ -8,7 +8,7 @@ import { StringUtil } from "@autobe/utils";
8
8
  import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
9
9
  import { OpenApiV3_1Emender } from "@samchon/openapi/lib/converters/OpenApiV3_1Emender";
10
10
  import { IPointer } from "tstl";
11
- import typia, { tags } from "typia";
11
+ import typia from "typia";
12
12
  import { v7 } from "uuid";
13
13
 
14
14
  import { AutoBeContext } from "../../context/AutoBeContext";
@@ -16,8 +16,10 @@ import { assertSchemaModel } from "../../context/assertSchemaModel";
16
16
  import { divideArray } from "../../utils/divideArray";
17
17
  import { executeCachedBatch } from "../../utils/executeCachedBatch";
18
18
  import { transformInterfaceSchemaHistories } from "./histories/transformInterfaceSchemaHistories";
19
- import { orchestrateInterfaceSchemasReview } from "./orchestrateInterfaceSchemasReview";
20
19
  import { IAutoBeInterfaceSchemaApplication } from "./structures/IAutoBeInterfaceSchemaApplication";
20
+ import { JsonSchemaFactory } from "./utils/JsonSchemaFactory";
21
+ import { JsonSchemaNamingConvention } from "./utils/JsonSchemaNamingConvention";
22
+ import { fulfillJsonSchemaErrorMessages } from "./utils/fulfillJsonSchemaErrorMessages";
21
23
  import { validateAuthorizationSchema } from "./utils/validateAuthorizationSchema";
22
24
 
23
25
  export async function orchestrateInterfaceSchemas<
@@ -25,13 +27,21 @@ export async function orchestrateInterfaceSchemas<
25
27
  >(
26
28
  ctx: AutoBeContext<Model>,
27
29
  operations: AutoBeOpenApi.IOperation[],
28
- capacity: number = 8,
30
+ capacity: number = 5,
29
31
  ): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
32
+ // fix operation type names
33
+ JsonSchemaNamingConvention.operations(operations);
34
+
35
+ // gather type names
30
36
  const typeNames: Set<string> = new Set();
31
37
  for (const op of operations) {
32
38
  if (op.requestBody !== null) typeNames.add(op.requestBody.typeName);
33
39
  if (op.responseBody !== null) typeNames.add(op.responseBody.typeName);
34
40
  }
41
+ const presets: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
42
+ JsonSchemaFactory.presets(typeNames);
43
+
44
+ // divide and conquer
35
45
  const matrix: string[][] = divideArray({
36
46
  array: Array.from(typeNames),
37
47
  capacity,
@@ -40,43 +50,22 @@ export async function orchestrateInterfaceSchemas<
40
50
  total: typeNames.size,
41
51
  completed: 0,
42
52
  };
43
- const reviewProgress: AutoBeProgressEventBase = {
44
- total: matrix.length,
45
- completed: 0,
53
+ const x: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {
54
+ ...presets,
46
55
  };
47
- const roles: string[] =
48
- ctx.state().analyze?.roles.map((role) => role.name) ?? [];
49
-
50
- const x: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
51
- roles.length > 0
52
- ? {
53
- IAuthorizationToken: authTokenSchema,
54
- }
55
- : {};
56
56
  for (const y of await executeCachedBatch(
57
57
  matrix.map((it) => async (promptCacheKey) => {
58
58
  const row: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
59
- await divideAndConquer(
60
- ctx,
61
- operations,
62
- it,
63
- 3,
64
- progress,
65
- promptCacheKey,
66
- );
67
- const newbie: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
68
- await orchestrateInterfaceSchemasReview(
69
- ctx,
70
- operations,
71
- row,
72
- reviewProgress,
73
- );
74
- return { ...row, ...newbie };
59
+ await divideAndConquer(ctx, operations, it, progress, promptCacheKey);
60
+ return row;
75
61
  }),
76
62
  )) {
63
+ JsonSchemaNamingConvention.schemas(operations, x, y);
77
64
  Object.assign(x, y);
78
65
  }
79
- if (x.IAuthorizationToken) x.IAuthorizationToken = authTokenSchema;
66
+ Object.assign(x, presets);
67
+ JsonSchemaNamingConvention.schemas(operations, x);
68
+ JsonSchemaFactory.authorize(x);
80
69
  return x;
81
70
  }
82
71
 
@@ -84,13 +73,12 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
84
73
  ctx: AutoBeContext<Model>,
85
74
  operations: AutoBeOpenApi.IOperation[],
86
75
  typeNames: string[],
87
- retry: number,
88
76
  progress: AutoBeProgressEventBase,
89
77
  promptCacheKey: string,
90
78
  ): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
91
79
  const remained: Set<string> = new Set(typeNames);
92
80
  const schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {};
93
- for (let i: number = 0; i < retry; ++i) {
81
+ for (let i: number = 0; i < ctx.retry; ++i) {
94
82
  if (remained.size === 0) break;
95
83
  const newbie: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
96
84
  await process(
@@ -162,12 +150,11 @@ async function process<Model extends ILlmSchema.Model>(
162
150
  });
163
151
  if (pointer.value === null) throw new Error("Failed to create components.");
164
152
 
165
- const schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
166
- (
167
- OpenApiV3_1Emender.convertComponents({
168
- schemas: pointer.value,
169
- }) as AutoBeOpenApi.IComponents
170
- ).schemas ?? {};
153
+ const schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = ((
154
+ OpenApiV3_1Emender.convertComponents({
155
+ schemas: pointer.value,
156
+ }) as AutoBeOpenApi.IComponents
157
+ ).schemas ?? {}) as Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
171
158
  ctx.dispatch({
172
159
  type: "interfaceSchemas",
173
160
  id: v7(),
@@ -198,9 +185,14 @@ function createController<Model extends ILlmSchema.Model>(props: {
198
185
  const validate = (
199
186
  next: unknown,
200
187
  ): IValidation<IAutoBeInterfaceSchemaApplication.IProps> => {
188
+ JsonSchemaFactory.fix("schemas", next);
189
+
201
190
  const result: IValidation<IAutoBeInterfaceSchemaApplication.IProps> =
202
191
  typia.validate<IAutoBeInterfaceSchemaApplication.IProps>(next);
203
- if (result.success === false) return result;
192
+ if (result.success === false) {
193
+ fulfillJsonSchemaErrorMessages(result.errors);
194
+ return result;
195
+ }
204
196
 
205
197
  // Check all IAuthorized types
206
198
  const errors: IValidation.IError[] = [];
@@ -253,53 +245,3 @@ const collection = {
253
245
  type Validator = (
254
246
  input: unknown,
255
247
  ) => IValidation<IAutoBeInterfaceSchemaApplication.IProps>;
256
-
257
- /**
258
- * Authorization token response structure.
259
- *
260
- * This interface defines the structure of the authorization token response
261
- * returned after successful user authentication. It contains both access and
262
- * refresh tokens along with their expiration information.
263
- *
264
- * This token structure is automatically included in API schemas when the system
265
- * detects authorization roles in the requirements analysis phase. It provides a
266
- * standard format for JWT-based authentication across the generated backend
267
- * applications.
268
- */
269
- interface IAuthorizationToken {
270
- /**
271
- * JWT access token for authenticated requests.
272
- *
273
- * This token should be included in the Authorization header for subsequent
274
- * authenticated API requests as `Bearer {token}`.
275
- */
276
- access: string;
277
-
278
- /**
279
- * Refresh token for obtaining new access tokens.
280
- *
281
- * This token can be used to request new access tokens when the current access
282
- * token expires, extending the user's session.
283
- */
284
- refresh: string;
285
-
286
- /**
287
- * Access token expiration timestamp.
288
- *
289
- * ISO 8601 date-time string indicating when the access token will expire and
290
- * can no longer be used for authentication.
291
- */
292
- expired_at: string & tags.Format<"date-time">;
293
-
294
- /**
295
- * Refresh token expiration timestamp.
296
- *
297
- * ISO 8601 date-time string indicating the latest time until which the
298
- * refresh token can be used to obtain new access tokens.
299
- */
300
- refreshable_until: string & tags.Format<"date-time">;
301
- }
302
-
303
- const authTokenSchema: AutoBeOpenApi.IJsonSchemaDescriptive =
304
- typia.json.schema<IAuthorizationToken>().components.schemas!
305
- .IAuthorizationToken as AutoBeOpenApi.IJsonSchemaDescriptive;