@autobe/agent 0.21.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 (291) 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/constants/AutoBeConfigConstant.d.ts +3 -0
  4. package/lib/agent/src/{orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js → constants/AutoBeConfigConstant.js} +1 -1
  5. package/lib/agent/src/constants/AutoBeConfigConstant.js.map +1 -0
  6. package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +27 -27
  7. package/lib/agent/src/context/AutoBeContext.d.ts +1 -0
  8. package/lib/agent/src/context/AutoBeTokenUsageComponent.js +4 -3
  9. package/lib/agent/src/context/AutoBeTokenUsageComponent.js.map +1 -1
  10. package/lib/agent/src/factory/consentFunctionCall.js +4 -4
  11. package/lib/agent/src/factory/consentFunctionCall.js.map +1 -1
  12. package/lib/agent/src/factory/createAutoBeContext.js +13 -10
  13. package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
  14. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
  15. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
  16. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
  17. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  18. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +1 -1
  19. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  20. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +6 -6
  21. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +50 -8
  22. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  23. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +4 -4
  24. package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
  25. package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
  26. package/lib/agent/src/orchestrate/facade/transformFacadeStateMessage.js +1 -1
  27. package/lib/agent/src/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
  28. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +19 -1
  29. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  30. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
  31. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  32. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
  33. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  34. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +2 -2
  35. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
  36. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
  37. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  38. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
  39. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  40. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
  41. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  42. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
  43. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  44. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
  45. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
  46. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  47. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +5 -1
  48. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
  49. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +16 -10
  50. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  51. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
  52. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +3731 -228
  53. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  54. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js +2 -2
  55. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +2 -2
  56. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +43 -63
  57. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  58. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +1261 -1628
  59. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  60. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +3466 -103
  61. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  62. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
  63. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +3672 -358
  64. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
  65. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
  66. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -141
  67. package/lib/agent/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
  68. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
  69. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.js +1385 -0
  70. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -0
  71. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
  72. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.js +78 -0
  73. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.js.map +1 -0
  74. package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
  75. package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js +81 -0
  76. package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js.map +1 -0
  77. package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js.map +1 -1
  78. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +1 -1
  79. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  80. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +1 -1
  81. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
  82. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +2 -2
  83. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  84. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
  85. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  86. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
  87. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +2 -2
  88. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  89. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +1 -1
  90. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
  91. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +2 -2
  92. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  93. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
  94. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +22 -7
  95. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  96. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
  97. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +13 -29
  98. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  99. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
  100. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js +2 -8
  101. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
  102. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +6 -49
  103. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
  104. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +4 -2
  105. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  106. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +5 -3
  107. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  108. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
  109. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +206 -118
  110. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  111. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
  112. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
  113. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
  114. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +24 -39
  115. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  116. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
  117. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
  118. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
  119. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
  120. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js +3 -0
  121. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js.map +1 -0
  122. package/{src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.ts → lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts} +2 -13
  123. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js +3 -0
  124. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js.map +1 -0
  125. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +33 -22
  126. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
  127. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +86 -0
  128. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -0
  129. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
  130. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js +55 -0
  131. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -0
  132. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
  133. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js +20 -0
  134. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -0
  135. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
  136. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js +73 -0
  137. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -0
  138. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
  139. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js +63 -69
  140. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  141. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js +15 -14
  142. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
  143. package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js +1 -1
  144. package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
  145. package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
  146. package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js +19 -0
  147. package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js.map +1 -0
  148. package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
  149. package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js +2 -0
  150. package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
  151. package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
  152. package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js +21 -0
  153. package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js.map +1 -0
  154. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.d.ts +2 -2
  155. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +16 -17
  156. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  157. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +5 -4
  158. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  159. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +21 -2
  160. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  161. package/lib/agent/src/orchestrate/test/orchestrateTest.js +6 -0
  162. package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
  163. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
  164. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +126 -72
  165. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  166. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +46 -40
  167. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  168. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +121 -42
  169. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  170. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
  171. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
  172. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js +3 -0
  173. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js.map +1 -0
  174. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
  175. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
  176. package/lib/agent/src/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
  177. package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js +28 -0
  178. package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js.map +1 -0
  179. package/lib/agent/src/structures/IAutoBeConfig.d.ts +2 -0
  180. package/lib/constants/AutoBeConfigConstant.d.ts +3 -0
  181. package/lib/constants/AutoBeSystemPromptConstant.d.ts +27 -27
  182. package/lib/context/AutoBeContext.d.ts +1 -0
  183. package/lib/index.mjs +13805 -3871
  184. package/lib/index.mjs.map +1 -1
  185. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
  186. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
  187. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
  188. package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
  189. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
  190. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
  191. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -141
  192. package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
  193. package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
  194. package/lib/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
  195. package/lib/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
  196. package/lib/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
  197. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
  198. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
  199. package/lib/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
  200. package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
  201. package/lib/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
  202. package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
  203. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
  204. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
  205. package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
  206. package/lib/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
  207. package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts +36 -0
  208. package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +33 -22
  209. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
  210. package/lib/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
  211. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
  212. package/lib/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
  213. package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
  214. package/lib/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
  215. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
  216. package/lib/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
  217. package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +2 -2
  218. package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
  219. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
  220. package/lib/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
  221. package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
  222. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
  223. package/lib/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
  224. package/lib/structures/IAutoBeConfig.d.ts +2 -0
  225. package/package.json +5 -5
  226. package/src/AutoBeAgent.ts +2 -0
  227. package/src/constants/AutoBeConfigConstant.ts +3 -0
  228. package/src/constants/AutoBeSystemPromptConstant.ts +27 -27
  229. package/src/context/AutoBeContext.ts +1 -0
  230. package/src/context/AutoBeTokenUsageComponent.ts +3 -3
  231. package/src/factory/consentFunctionCall.ts +2 -0
  232. package/src/factory/createAutoBeContext.ts +145 -136
  233. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +6 -0
  234. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +4 -0
  235. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +19 -1
  236. package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +1 -4
  237. package/src/orchestrate/interface/orchestrateInterface.ts +15 -4
  238. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +13 -5
  239. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +58 -19
  240. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +11 -11
  241. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +13 -117
  242. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +33 -91
  243. package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +72 -95
  244. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +0 -39
  245. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +50 -146
  246. package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +31 -27
  247. package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +171 -0
  248. package/src/orchestrate/interface/utils/JsonSchemaNamingConvention.ts +83 -0
  249. package/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.ts +90 -0
  250. package/src/orchestrate/interface/utils/validateAuthorizationSchema.ts +2 -2
  251. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +1 -2
  252. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +30 -15
  253. package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +27 -49
  254. package/src/orchestrate/realize/internal/compileRealizeFiles.ts +4 -11
  255. package/src/orchestrate/realize/orchestrateRealize.ts +19 -75
  256. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +1 -1
  257. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +114 -25
  258. package/src/orchestrate/realize/orchestrateRealizeScenario.ts +2 -2
  259. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +11 -15
  260. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +17 -0
  261. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +20 -0
  262. package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +40 -74
  263. package/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.ts +9 -0
  264. package/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.ts +45 -0
  265. package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +33 -22
  266. package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +97 -0
  267. package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +64 -0
  268. package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +29 -0
  269. package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +82 -0
  270. package/src/orchestrate/realize/utils/replaceImportStatements.ts +101 -111
  271. package/src/orchestrate/test/compile/completeTestCode.ts +15 -26
  272. package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +1 -0
  273. package/src/orchestrate/test/compile/getTestImportStatements.ts +25 -0
  274. package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +6 -1
  275. package/src/orchestrate/test/compile/getTestTemplateCode.ts +25 -0
  276. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +26 -26
  277. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +6 -5
  278. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +19 -0
  279. package/src/orchestrate/test/orchestrateTest.ts +6 -0
  280. package/src/orchestrate/test/orchestrateTestCorrect.ts +46 -15
  281. package/src/orchestrate/test/orchestrateTestScenario.ts +52 -48
  282. package/src/orchestrate/test/orchestrateTestWrite.ts +23 -5
  283. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +49 -46
  284. package/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.ts +8 -0
  285. package/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.ts +1 -0
  286. package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +14 -0
  287. package/src/orchestrate/test/utils/getReferenceIds.ts +25 -0
  288. package/src/structures/IAutoBeConfig.ts +3 -0
  289. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
  290. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js.map +0 -1
  291. package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
@@ -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)
@@ -5,7 +5,7 @@ import {
5
5
  AutoBePrisma,
6
6
  AutoBeProgressEventBase,
7
7
  } from "@autobe/interface";
8
- import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
8
+ import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
9
9
  import { IPointer } from "tstl";
10
10
  import typia from "typia";
11
11
  import { v7 } from "uuid";
@@ -42,7 +42,7 @@ export async function orchestrateInterfaceOperationsReview<
42
42
  });
43
43
  if (pointer.value === null) {
44
44
  console.error("Failed to review operations.");
45
- progress.completed += operations.length;
45
+ ++progress.completed;
46
46
  return [];
47
47
  }
48
48
 
@@ -57,8 +57,8 @@ export async function orchestrateInterfaceOperationsReview<
57
57
  type: "interfaceOperationsReview",
58
58
  id: v7(),
59
59
  operations: content,
60
- review: pointer.value.review,
61
- plan: pointer.value.plan,
60
+ review: pointer.value.think.review,
61
+ plan: pointer.value.think.plan,
62
62
  content,
63
63
  tokenUsage,
64
64
  created_at: new Date().toISOString(),
@@ -79,99 +79,9 @@ function createReviewController<Model extends ILlmSchema.Model>(props: {
79
79
  prismaSchemas: AutoBePrisma.IFile[];
80
80
  build: (reviews: IAutoBeInterfaceOperationsReviewApplication.IProps) => void;
81
81
  }): IAgenticaController.IClass<Model> {
82
- const validate = (
83
- next: unknown,
84
- ): IValidation<IAutoBeInterfaceOperationsReviewApplication.IProps> => {
85
- const result: IValidation<IAutoBeInterfaceOperationsReviewApplication.IProps> =
86
- typia.validate<IAutoBeInterfaceOperationsReviewApplication.IProps>(next);
87
- if (result.success === false) return result;
88
- const errors: IValidation.IError[] = [];
89
-
90
- const models: AutoBePrisma.IModel[] = props.prismaSchemas.flatMap(
91
- (schema) => schema.models,
92
- );
93
-
94
- result.data.content.forEach((op, index) => {
95
- // Check if summary or description mentions soft delete
96
- const mentionsSoftDelete =
97
- (op.summary && /soft[\s-]?delet/i.test(op.summary)) ||
98
- (op.description && /soft[\s-]?delet/i.test(op.description));
99
-
100
- if (op.method === "delete") {
101
- const model = models.find((model) => model.name === op.model_name);
102
-
103
- if (mentionsSoftDelete) {
104
- // If soft delete is mentioned but no soft_delete_column is specified
105
- if (!op.soft_delete_column) {
106
- // Check if any soft-delete capable column exists in the model
107
- const hasSoftDeleteCapableColumn = model?.plainFields.some(
108
- (field) =>
109
- /delete|deleted|deleted_at|deletedAt|is_deleted|isDeleted/i.test(
110
- field.name,
111
- ),
112
- );
113
-
114
- if (hasSoftDeleteCapableColumn) {
115
- errors.push({
116
- expected: `Soft delete column to be specified or summary/description to not mention soft delete`,
117
- value: "null",
118
- description: `Mismatch: Operation mentions soft delete but soft_delete_column is not specified, while model has soft-delete capable columns`,
119
- path: `$input.content[${index}].soft_delete_column`,
120
- });
121
- } else {
122
- errors.push({
123
- expected: `Summary/description to not mention soft delete when model lacks soft-delete capability`,
124
- value: `${op.summary || ""} ${op.description || ""}`,
125
- description: `Mismatch: Operation mentions soft delete but model '${op.model_name}' has no soft-delete capable columns`,
126
- path: `$input.content[${index}].summary || $input.content[${index}].description`,
127
- });
128
- }
129
- } else {
130
- // If soft_delete_column is specified, check if it exists in the model
131
- const column = model?.plainFields.find(
132
- (el) => el.name === op.soft_delete_column,
133
- );
134
-
135
- if (!column) {
136
- errors.push({
137
- expected: `Field '${op.soft_delete_column}' to exist in model or operation to not mention soft delete`,
138
- value: "undefined",
139
- description: `Mismatch: Either the field '${op.soft_delete_column}' should exist in model '${op.model_name}', or the operation should not mention soft delete`,
140
- path: `$input.content[${index}].soft_delete_column || $input.content[${index}].summary || $input.content[${index}].description`,
141
- });
142
- }
143
- }
144
- }
145
-
146
- // Also check if soft_delete_column is specified without mentioning soft delete
147
- if (op.soft_delete_column && !mentionsSoftDelete) {
148
- errors.push({
149
- expected: `Consistency between soft_delete_column and operation description`,
150
- value: `soft_delete_column: ${op.soft_delete_column}`,
151
- description: `Mismatch: soft_delete_column is specified but soft delete is not mentioned in summary/description`,
152
- path: `$input.content[${index}]`,
153
- });
154
- }
155
- }
156
- });
157
-
158
- // not implemented
159
- if (errors.length !== 0) {
160
- console.log(JSON.stringify(errors, null, 2));
161
- return {
162
- success: false,
163
- errors,
164
- data: next,
165
- };
166
- }
167
- return result;
168
- };
169
-
170
82
  const application: ILlmApplication<Model> = collection[
171
83
  props.model === "chatgpt" ? "chatgpt" : "claude"
172
- ](
173
- validate,
174
- ) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
84
+ ] satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
175
85
 
176
86
  return {
177
87
  protocol: "class",
@@ -186,26 +96,12 @@ function createReviewController<Model extends ILlmSchema.Model>(props: {
186
96
  }
187
97
 
188
98
  const collection = {
189
- chatgpt: (validate: Validator) =>
190
- typia.llm.application<
191
- IAutoBeInterfaceOperationsReviewApplication,
192
- "chatgpt"
193
- >({
194
- validate: {
195
- reviewOperations: validate,
196
- },
197
- }),
198
- claude: (validate: Validator) =>
199
- typia.llm.application<
200
- IAutoBeInterfaceOperationsReviewApplication,
201
- "claude"
202
- >({
203
- validate: {
204
- reviewOperations: validate,
205
- },
206
- }),
99
+ chatgpt: typia.llm.application<
100
+ IAutoBeInterfaceOperationsReviewApplication,
101
+ "chatgpt"
102
+ >(),
103
+ claude: typia.llm.application<
104
+ IAutoBeInterfaceOperationsReviewApplication,
105
+ "claude"
106
+ >(),
207
107
  };
208
-
209
- type Validator = (
210
- input: unknown,
211
- ) => IValidation<IAutoBeInterfaceOperationsReviewApplication.IProps>;
@@ -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;
@@ -12,8 +12,13 @@ import { v7 } from "uuid";
12
12
 
13
13
  import { AutoBeContext } from "../../context/AutoBeContext";
14
14
  import { assertSchemaModel } from "../../context/assertSchemaModel";
15
+ import { divideArray } from "../../utils/divideArray";
16
+ import { executeCachedBatch } from "../../utils/executeCachedBatch";
15
17
  import { transformInterfaceSchemasReviewHistories } from "./histories/transformInterfaceSchemasReviewHistories";
16
18
  import { IAutoBeInterfaceSchemasReviewApplication } from "./structures/IAutobeInterfaceSchemasReviewApplication";
19
+ import { JsonSchemaFactory } from "./utils/JsonSchemaFactory";
20
+ import { JsonSchemaNamingConvention } from "./utils/JsonSchemaNamingConvention";
21
+ import { fulfillJsonSchemaErrorMessages } from "./utils/fulfillJsonSchemaErrorMessages";
17
22
  import { validateAuthorizationSchema } from "./utils/validateAuthorizationSchema";
18
23
 
19
24
  export async function orchestrateInterfaceSchemasReview<
@@ -21,11 +26,53 @@ export async function orchestrateInterfaceSchemasReview<
21
26
  >(
22
27
  ctx: AutoBeContext<Model>,
23
28
  operations: AutoBeOpenApi.IOperation[],
24
- schemas: Record<
25
- string,
26
- AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>
27
- >,
29
+ schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>,
30
+ ): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
31
+ const a = Object.entries(schemas).map(([key, schema]) => {
32
+ return { [key]: schema };
33
+ });
34
+
35
+ const matrix: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>[][] =
36
+ divideArray({
37
+ array: a,
38
+ capacity: 8,
39
+ });
40
+ const progress: IProgress = {
41
+ total: matrix.length,
42
+ completed: 0,
43
+ };
44
+
45
+ const x: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {};
46
+ for (const y of await executeCachedBatch(
47
+ matrix.map((it) => async (promptCacheKey) => {
48
+ const row: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
49
+ await divideAndConquer(ctx, operations, it, progress, promptCacheKey);
50
+ return row;
51
+ }),
52
+ )) {
53
+ JsonSchemaNamingConvention.schemas(operations, x, y);
54
+ Object.assign(x, y);
55
+ }
56
+ return x;
57
+ }
58
+
59
+ async function divideAndConquer<Model extends ILlmSchema.Model>(
60
+ ctx: AutoBeContext<Model>,
61
+ operations: AutoBeOpenApi.IOperation[],
62
+ schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>[],
63
+ progress: AutoBeProgressEventBase,
64
+ promptCacheKey: string,
65
+ ): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
66
+ const schema = schemas.reduce((acc, cur) => Object.assign(acc, cur), {});
67
+ return step(ctx, operations, schema, progress, promptCacheKey);
68
+ }
69
+
70
+ export async function step<Model extends ILlmSchema.Model>(
71
+ ctx: AutoBeContext<Model>,
72
+ operations: AutoBeOpenApi.IOperation[],
73
+ schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>,
28
74
  progress: AutoBeProgressEventBase,
75
+ promptCacheKey: string,
29
76
  ): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
30
77
  try {
31
78
  const pointer: IPointer<IAutoBeInterfaceSchemasReviewApplication.IProps | null> =
@@ -46,6 +93,7 @@ export async function orchestrateInterfaceSchemasReview<
46
93
  schemas,
47
94
  ),
48
95
  enforceFunctionCall: true,
96
+ promptCacheKey,
49
97
  message: "Review type schemas.",
50
98
  });
51
99
  if (pointer.value === null) {
@@ -54,18 +102,18 @@ export async function orchestrateInterfaceSchemasReview<
54
102
  return {};
55
103
  }
56
104
 
57
- const content: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
58
- (
59
- OpenApiV3_1Emender.convertComponents({
60
- schemas: pointer.value.content,
61
- }) as AutoBeOpenApi.IComponents
62
- ).schemas ?? {};
105
+ const content: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = ((
106
+ OpenApiV3_1Emender.convertComponents({
107
+ schemas: pointer.value.content,
108
+ }) as AutoBeOpenApi.IComponents
109
+ ).schemas ?? {}) as Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
110
+
63
111
  ctx.dispatch({
64
112
  type: "interfaceSchemasReview",
65
113
  id: v7(),
66
114
  schemas: schemas,
67
- review: pointer.value.review,
68
- plan: pointer.value.plan,
115
+ review: pointer.value.think.review,
116
+ plan: pointer.value.think.plan,
69
117
  content,
70
118
  tokenUsage,
71
119
  step: ctx.state().analyze?.step ?? 0,
@@ -85,19 +133,21 @@ function createController<Model extends ILlmSchema.Model>(props: {
85
133
  model: Model;
86
134
  pointer: IPointer<IAutoBeInterfaceSchemasReviewApplication.IProps | null>;
87
135
  operations: AutoBeOpenApi.IOperation[];
88
- schemas: Record<
89
- string,
90
- AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>
91
- >;
136
+ schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
92
137
  }): IAgenticaController.IClass<Model> {
93
138
  assertSchemaModel(props.model);
94
139
 
95
140
  const validate = (
96
141
  next: unknown,
97
142
  ): IValidation<IAutoBeInterfaceSchemasReviewApplication.IProps> => {
143
+ JsonSchemaFactory.fix("content", next);
144
+
98
145
  const result: IValidation<IAutoBeInterfaceSchemasReviewApplication.IProps> =
99
146
  typia.validate<IAutoBeInterfaceSchemasReviewApplication.IProps>(next);
100
- if (result.success === false) return result;
147
+ if (result.success === false) {
148
+ fulfillJsonSchemaErrorMessages(result.errors);
149
+ return result;
150
+ }
101
151
 
102
152
  const errors: IValidation.IError[] = [];
103
153
  validateAuthorizationSchema({
@@ -105,90 +155,12 @@ function createController<Model extends ILlmSchema.Model>(props: {
105
155
  schemas: result.data.content,
106
156
  path: "$input.content",
107
157
  });
108
-
109
- Object.entries(result.data.content).forEach(
110
- ([tagName, jsonDescriptive]) => {
111
- const index: AutoBeOpenApi.IOperation | undefined =
112
- props.operations.find(
113
- (op) =>
114
- op.responseBody?.typeName === tagName &&
115
- op.method === "patch" &&
116
- op.name === "index",
117
- );
118
-
119
- // The index API should return the `IPage<T>` type.
120
- if (index) {
121
- // First check if the schema has the correct object structure
122
- if (
123
- !("type" in jsonDescriptive) ||
124
- jsonDescriptive.type !== "object"
125
- ) {
126
- errors.push({
127
- path: `$input.content.${tagName}`,
128
- expected: `{ type: "object", properties: { ... } }`,
129
- value: jsonDescriptive,
130
- description: `IPage schema must have type: "object". Found: ${JSON.stringify(jsonDescriptive)}`,
131
- });
132
- } else if (!("properties" in jsonDescriptive)) {
133
- errors.push({
134
- path: `$input.content.${tagName}`,
135
- expected: `Schema with "properties" field`,
136
- value: jsonDescriptive,
137
- description: `IPage schema must have a "properties" field containing "pagination" and "data" properties.`,
138
- });
139
- } else if (
140
- typia.is<AutoBeOpenApi.IJsonSchema.IObject>(jsonDescriptive)
141
- ) {
142
- jsonDescriptive.properties ??= {};
143
-
144
- // Check pagination property
145
- const pagination = jsonDescriptive.properties["pagination"];
146
- if (!pagination || !("$ref" in pagination)) {
147
- errors.push({
148
- path: `$input.content.${tagName}.properties.pagination`,
149
- expected: `{ $ref: "#/components/schemas/IPage.IPagination" }`,
150
- value: pagination,
151
- description: `IPage must have a "pagination" property with $ref to IPage.IPagination.`,
152
- });
153
- }
154
-
155
- // Check data property
156
- const data = jsonDescriptive.properties["data"];
157
- if (!typia.is<AutoBeOpenApi.IJsonSchema.IArray>(data)) {
158
- errors.push({
159
- path: `$input.content.${tagName}.properties.data`,
160
- expected: `AutoBeOpenApi.IJsonSchema.IArray`,
161
- value: data,
162
- description: `The 'data' property must be an array for the index operation.`,
163
- });
164
- } else {
165
- // Check if array items have proper type reference (not 'any')
166
- const arraySchema: AutoBeOpenApi.IJsonSchema.IArray = data;
167
- if (
168
- !arraySchema.items ||
169
- !("$ref" in arraySchema.items) ||
170
- arraySchema.items.$ref === "#/components/schemas/any"
171
- ) {
172
- errors.push({
173
- path: `$input.content.${tagName}.properties.data.items`,
174
- expected: `Reference to a specific type (e.g., $ref to ISummary type)`,
175
- value: arraySchema.items,
176
- description: `The 'data' array must have a specific item type, not 'any[]'. Use a proper type reference like '{Entity}.ISummary' for paginated results.`,
177
- });
178
- }
179
- }
180
- }
181
- }
182
- },
183
- );
184
-
185
158
  if (errors.length !== 0)
186
159
  return {
187
160
  success: false,
188
161
  errors,
189
162
  data: next,
190
163
  };
191
-
192
164
  return result;
193
165
  };
194
166
 
@@ -227,3 +199,8 @@ const collection = {
227
199
  type Validator = (
228
200
  input: unknown,
229
201
  ) => IValidation<IAutoBeInterfaceSchemasReviewApplication.IProps>;
202
+
203
+ export interface IProgress {
204
+ total: number;
205
+ completed: number;
206
+ }
@@ -91,45 +91,6 @@ export namespace IAutoBeInterfaceOperationApplication {
91
91
  AutoBeOpenApi.IOperation,
92
92
  "authorizationRole" | "authorizationType"
93
93
  > {
94
- /**
95
- * Prisma schema models relevant to this operation.
96
- *
97
- * Contains the complete Prisma schema definitions for all entities involved
98
- * in this operation, including their fields, relations, and database
99
- * constraints. This enables comprehensive validation and schema-aware
100
- * operation design.
101
- *
102
- * The schema information serves multiple critical purposes:
103
- *
104
- * - **Field Verification**: Ensures all referenced fields actually exist in
105
- * the database schema and have the correct types
106
- * - **Relationship Validation**: Confirms that entity relationships are
107
- * properly defined and can support the operation's data access patterns
108
- * - **Soft-Delete Detection**: For DELETE operations, identifies whether
109
- * entities have soft-delete fields (deleted_at, is_deleted, etc.) to
110
- * determine if the operation should perform logical deletion instead of
111
- * physical removal
112
- * - **Constraint Awareness**: Understands unique constraints, required
113
- * fields, and default values to generate accurate request/response
114
- * schemas
115
- *
116
- * Example content might include:
117
- *
118
- * ```prisma
119
- * model User {
120
- * id String @id @default(uuid())
121
- * email String @unique
122
- * name String
123
- * deleted_at DateTime? // Indicates soft-delete capability
124
- * posts Post[]
125
- * }
126
- * ```
127
- *
128
- * This schema context ensures operations are fully aligned with the actual
129
- * database structure and business logic requirements.
130
- */
131
- prisma_schemas: string;
132
-
133
94
  /**
134
95
  * Authorization roles required to access this API operation.
135
96
  *