@autobe/agent 0.21.0 → 0.22.1

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 (301) 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 +3468 -105
  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 +3674 -360
  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/JsonSchemaValidator.d.ts +10 -0
  75. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaValidator.js +59 -0
  76. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -0
  77. package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
  78. package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js +81 -0
  79. package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js.map +1 -0
  80. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +1 -1
  81. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  82. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +1 -1
  83. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
  84. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +2 -2
  85. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  86. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
  87. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  88. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
  89. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +2 -2
  90. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  91. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +1 -1
  92. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
  93. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +2 -2
  94. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  95. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
  96. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +22 -7
  97. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  98. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
  99. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +13 -29
  100. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  101. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
  102. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js +2 -8
  103. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
  104. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +6 -49
  105. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
  106. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +4 -2
  107. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  108. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +5 -3
  109. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  110. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
  111. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +206 -118
  112. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  113. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
  114. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
  115. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
  116. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +24 -39
  117. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  118. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
  119. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
  120. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
  121. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
  122. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js +3 -0
  123. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js.map +1 -0
  124. package/{src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.ts → lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts} +2 -13
  125. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js +3 -0
  126. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js.map +1 -0
  127. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +33 -22
  128. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
  129. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +86 -0
  130. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -0
  131. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
  132. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js +55 -0
  133. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -0
  134. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
  135. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js +20 -0
  136. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -0
  137. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
  138. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js +73 -0
  139. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -0
  140. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
  141. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js +63 -69
  142. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  143. package/lib/agent/src/orchestrate/test/compile/completeTestCode.d.ts +3 -1
  144. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js +25 -18
  145. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
  146. package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js +5 -1
  147. package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
  148. package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
  149. package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js +19 -0
  150. package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js.map +1 -0
  151. package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
  152. package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js +2 -0
  153. package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
  154. package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
  155. package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js +21 -0
  156. package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js.map +1 -0
  157. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.d.ts +2 -2
  158. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +16 -17
  159. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  160. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +5 -4
  161. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  162. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +21 -2
  163. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  164. package/lib/agent/src/orchestrate/test/orchestrateTest.js +6 -0
  165. package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
  166. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
  167. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +123 -75
  168. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  169. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +46 -40
  170. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  171. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +117 -45
  172. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  173. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
  174. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
  175. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js +3 -0
  176. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js.map +1 -0
  177. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
  178. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
  179. package/lib/agent/src/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
  180. package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js +28 -0
  181. package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js.map +1 -0
  182. package/lib/agent/src/structures/IAutoBeConfig.d.ts +2 -0
  183. package/lib/constants/AutoBeConfigConstant.d.ts +3 -0
  184. package/lib/constants/AutoBeSystemPromptConstant.d.ts +27 -27
  185. package/lib/context/AutoBeContext.d.ts +1 -0
  186. package/lib/index.mjs +13871 -3912
  187. package/lib/index.mjs.map +1 -1
  188. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
  189. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
  190. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
  191. package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
  192. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
  193. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
  194. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -141
  195. package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
  196. package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
  197. package/lib/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
  198. package/lib/orchestrate/interface/utils/JsonSchemaValidator.d.ts +10 -0
  199. package/lib/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
  200. package/lib/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
  201. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
  202. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
  203. package/lib/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
  204. package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
  205. package/lib/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
  206. package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
  207. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
  208. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
  209. package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
  210. package/lib/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
  211. package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts +36 -0
  212. package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +33 -22
  213. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
  214. package/lib/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
  215. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
  216. package/lib/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
  217. package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
  218. package/lib/orchestrate/test/compile/completeTestCode.d.ts +3 -1
  219. package/lib/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
  220. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
  221. package/lib/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
  222. package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +2 -2
  223. package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
  224. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
  225. package/lib/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
  226. package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
  227. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
  228. package/lib/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
  229. package/lib/structures/IAutoBeConfig.d.ts +2 -0
  230. package/package.json +6 -6
  231. package/src/AutoBeAgent.ts +2 -0
  232. package/src/constants/AutoBeConfigConstant.ts +3 -0
  233. package/src/constants/AutoBeSystemPromptConstant.ts +27 -27
  234. package/src/context/AutoBeContext.ts +1 -0
  235. package/src/context/AutoBeTokenUsageComponent.ts +3 -3
  236. package/src/factory/consentFunctionCall.ts +2 -0
  237. package/src/factory/createAutoBeContext.ts +145 -136
  238. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +6 -0
  239. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +4 -0
  240. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +19 -1
  241. package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +1 -4
  242. package/src/orchestrate/interface/orchestrateInterface.ts +15 -4
  243. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +13 -5
  244. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +58 -19
  245. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +11 -11
  246. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +13 -117
  247. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +35 -93
  248. package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +74 -97
  249. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +0 -39
  250. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +50 -146
  251. package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +31 -27
  252. package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +171 -0
  253. package/src/orchestrate/interface/utils/JsonSchemaNamingConvention.ts +83 -0
  254. package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +66 -0
  255. package/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.ts +90 -0
  256. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +1 -2
  257. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +30 -15
  258. package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +27 -49
  259. package/src/orchestrate/realize/internal/compileRealizeFiles.ts +4 -11
  260. package/src/orchestrate/realize/orchestrateRealize.ts +19 -75
  261. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +1 -1
  262. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +114 -25
  263. package/src/orchestrate/realize/orchestrateRealizeScenario.ts +2 -2
  264. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +11 -15
  265. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +17 -0
  266. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +20 -0
  267. package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +40 -74
  268. package/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.ts +9 -0
  269. package/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.ts +45 -0
  270. package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +33 -22
  271. package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +97 -0
  272. package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +64 -0
  273. package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +29 -0
  274. package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +82 -0
  275. package/src/orchestrate/realize/utils/replaceImportStatements.ts +101 -111
  276. package/src/orchestrate/test/compile/completeTestCode.ts +18 -31
  277. package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +12 -0
  278. package/src/orchestrate/test/compile/getTestImportStatements.ts +25 -0
  279. package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +6 -1
  280. package/src/orchestrate/test/compile/getTestTemplateCode.ts +25 -0
  281. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +26 -26
  282. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +6 -5
  283. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +19 -0
  284. package/src/orchestrate/test/orchestrateTest.ts +6 -0
  285. package/src/orchestrate/test/orchestrateTestCorrect.ts +44 -20
  286. package/src/orchestrate/test/orchestrateTestScenario.ts +52 -48
  287. package/src/orchestrate/test/orchestrateTestWrite.ts +20 -10
  288. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +49 -46
  289. package/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.ts +8 -0
  290. package/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.ts +1 -0
  291. package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +14 -0
  292. package/src/orchestrate/test/utils/getReferenceIds.ts +25 -0
  293. package/src/structures/IAutoBeConfig.ts +3 -0
  294. package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.d.ts +0 -7
  295. package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js +0 -35
  296. package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js.map +0 -1
  297. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
  298. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js.map +0 -1
  299. package/lib/orchestrate/interface/utils/validateAuthorizationSchema.d.ts +0 -7
  300. package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
  301. package/src/orchestrate/interface/utils/validateAuthorizationSchema.ts +0 -41
@@ -30,6 +30,7 @@ export interface AutoBeContext<Model extends ILlmSchema.Model> {
30
30
  model: Model;
31
31
  vendor: IAgenticaVendor;
32
32
  locale: string;
33
+ retry: number;
33
34
 
34
35
  // accessors
35
36
  compilerListener: IAutoBeCompilerListener;
@@ -95,10 +95,10 @@ export class AutoBeTokenUsageComponent
95
95
  accepted_prediction: 0,
96
96
  rejected_prediction: 0,
97
97
  };
98
- return;
98
+ } else {
99
+ this.input = props.input;
100
+ this.output = props.output;
99
101
  }
100
- this.input = props.input;
101
- this.output = props.output;
102
102
  }
103
103
 
104
104
  /**
@@ -12,6 +12,7 @@ import { IPointer } from "tstl";
12
12
  import typia from "typia";
13
13
  import { v7 } from "uuid";
14
14
 
15
+ import { AutoBeConfigConstant } from "../constants/AutoBeConfigConstant";
15
16
  import { AutoBeSystemPromptConstant } from "../constants/AutoBeSystemPromptConstant";
16
17
  import { IAutoBeConfig } from "../structures/IAutoBeConfig";
17
18
  import { IAutoBeVendor } from "../structures/IAutoBeVendor";
@@ -31,6 +32,7 @@ export const consentFunctionCall = async (props: {
31
32
  vendor: props.vendor,
32
33
  config: {
33
34
  ...(props.config ?? []),
35
+ retry: props.config?.retry ?? AutoBeConfigConstant.DEFAULT_RETRY,
34
36
  executor: {
35
37
  describe: null,
36
38
  },
@@ -27,6 +27,7 @@ import { ILlmSchema } from "@samchon/openapi";
27
27
  import typia from "typia";
28
28
  import { v7 } from "uuid";
29
29
 
30
+ import { AutoBeConfigConstant } from "../constants/AutoBeConfigConstant";
30
31
  import { AutoBeContext } from "../context/AutoBeContext";
31
32
  import { AutoBeState } from "../context/AutoBeState";
32
33
  import { AutoBeTokenUsage } from "../context/AutoBeTokenUsage";
@@ -47,152 +48,160 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
47
48
  histories: () => AutoBeHistory[];
48
49
  usage: () => AutoBeTokenUsage;
49
50
  dispatch: (event: AutoBeEvent) => Promise<void>;
50
- }): AutoBeContext<Model> => ({
51
- model: props.model,
52
- vendor: props.vendor,
53
- locale: props.config.locale ?? "en-US",
54
- compilerListener: props.compilerListener,
55
- compiler: props.compiler,
56
- files: props.files,
57
- histories: props.histories,
58
- state: props.state,
59
- usage: props.usage,
60
- dispatch: createDispatch(props),
61
- assistantMessage: (message) => {
62
- props.histories().push(message);
63
- setTimeout(() => props.dispatch(message).catch(() => {}));
64
- return message;
65
- },
66
- conversate: async (next, closure) => {
67
- const execute = async (): Promise<AutoBeContext.IResult<Model>> => {
68
- const agent: MicroAgentica<Model> = new MicroAgentica<Model>({
69
- model: props.model,
70
- vendor: props.vendor,
71
- config: {
72
- ...(props.config ?? {}),
73
- executor: {
74
- describe: null,
51
+ }): AutoBeContext<Model> => {
52
+ const retry: number =
53
+ props.config?.retry ?? AutoBeConfigConstant.DEFAULT_RETRY;
54
+ const locale: string = props.config.locale ?? "en-US";
55
+ return {
56
+ model: props.model,
57
+ vendor: props.vendor,
58
+ retry,
59
+ locale,
60
+ compilerListener: props.compilerListener,
61
+ compiler: props.compiler,
62
+ files: props.files,
63
+ histories: props.histories,
64
+ state: props.state,
65
+ usage: props.usage,
66
+ dispatch: createDispatch(props),
67
+ assistantMessage: (message) => {
68
+ props.histories().push(message);
69
+ setTimeout(() => props.dispatch(message).catch(() => {}));
70
+ return message;
71
+ },
72
+ conversate: async (next, closure) => {
73
+ const execute = async (): Promise<AutoBeContext.IResult<Model>> => {
74
+ const agent: MicroAgentica<Model> = new MicroAgentica<Model>({
75
+ model: props.model,
76
+ vendor: props.vendor,
77
+ config: {
78
+ ...(props.config ?? {}),
79
+ retry: props.config?.retry ?? AutoBeConfigConstant.DEFAULT_RETRY,
80
+ executor: {
81
+ describe: null,
82
+ },
75
83
  },
76
- },
77
- histories: next.histories,
78
- controllers: [next.controller],
79
- });
80
- agent.on("request", async (event) => {
81
- if (next.enforceFunctionCall === true && event.body.tools)
82
- event.body.tool_choice = "required";
83
- if (event.body.parallel_tool_calls !== undefined)
84
- delete event.body.parallel_tool_calls;
85
- if (next.promptCacheKey)
86
- event.body.prompt_cache_key = next.promptCacheKey;
87
- await props.dispatch({
88
- ...event,
89
- type: "vendorRequest",
90
- source: next.source,
84
+ histories: next.histories,
85
+ controllers: [next.controller],
91
86
  });
92
- });
93
- agent.on("response", (event) => {
94
- void props
95
- .dispatch({
96
- ...event,
97
- type: "vendorResponse",
98
- source: next.source,
99
- })
100
- .catch(() => {});
101
- });
102
- agent.on("jsonParseError", (event) => {
103
- void props
104
- .dispatch({
87
+ agent.on("request", async (event) => {
88
+ if (next.enforceFunctionCall === true && event.body.tools)
89
+ event.body.tool_choice = "required";
90
+ if (event.body.parallel_tool_calls !== undefined)
91
+ delete event.body.parallel_tool_calls;
92
+ if (next.promptCacheKey)
93
+ event.body.prompt_cache_key = next.promptCacheKey;
94
+ await props.dispatch({
105
95
  ...event,
96
+ type: "vendorRequest",
106
97
  source: next.source,
107
- })
108
- .catch(() => {});
109
- });
110
- agent.on("validate", (event) => {
111
- void props
112
- .dispatch({
113
- type: "jsonValidateError",
114
- id: v7(),
115
- source: next.source,
116
- result: event.result,
117
- created_at: event.created_at,
118
- })
119
- .catch(() => {});
120
- });
121
- if (closure) closure(agent);
98
+ });
99
+ });
100
+ agent.on("response", (event) => {
101
+ void props
102
+ .dispatch({
103
+ ...event,
104
+ type: "vendorResponse",
105
+ source: next.source,
106
+ })
107
+ .catch(() => {});
108
+ });
109
+ agent.on("jsonParseError", (event) => {
110
+ void props
111
+ .dispatch({
112
+ ...event,
113
+ source: next.source,
114
+ })
115
+ .catch(() => {});
116
+ });
117
+ agent.on("validate", (event) => {
118
+ void props
119
+ .dispatch({
120
+ type: "jsonValidateError",
121
+ id: v7(),
122
+ source: next.source,
123
+ result: event.result,
124
+ created_at: event.created_at,
125
+ })
126
+ .catch(() => {});
127
+ });
128
+ if (closure) closure(agent);
122
129
 
123
- const histories: MicroAgenticaHistory<Model>[] = await agent.conversate(
124
- next.message,
125
- );
126
- const tokenUsage: IAutoBeTokenUsageJson.IComponent = agent
127
- .getTokenUsage()
128
- .toJSON().aggregate;
129
- props
130
- .usage()
131
- .record(tokenUsage, [
132
- STAGES.find((stage) => next.source.startsWith(stage)) ?? "analyze",
133
- ]);
130
+ const histories: MicroAgenticaHistory<Model>[] = await agent.conversate(
131
+ next.message,
132
+ );
133
+ const tokenUsage: IAutoBeTokenUsageJson.IComponent = agent
134
+ .getTokenUsage()
135
+ .toJSON().aggregate;
136
+ props
137
+ .usage()
138
+ .record(tokenUsage, [
139
+ STAGES.find((stage) => next.source.startsWith(stage)) ?? "analyze",
140
+ ]);
134
141
 
135
- if (
136
- true === next.enforceFunctionCall &&
137
- false ===
138
- histories.some((h) => h.type === "execute" && h.success === true)
139
- ) {
140
- const failure = () => {
141
- throw new Error(
142
- `Failed to function calling in the ${next.source} step`,
143
- );
144
- };
145
- const last: MicroAgenticaHistory<Model> | undefined = histories.at(-1);
146
142
  if (
147
- last?.type === "assistantMessage" &&
148
- last.text.trim().length !== 0
143
+ true === next.enforceFunctionCall &&
144
+ false ===
145
+ histories.some((h) => h.type === "execute" && h.success === true)
149
146
  ) {
150
- const consent: string | null = await consentFunctionCall({
151
- source: next.source,
152
- dispatch: (e) => {
153
- props.dispatch(e).catch(() => {});
154
- },
155
- config: props.config,
156
- vendor: props.vendor,
157
- assistantMessage: last.text,
158
- });
159
- if (consent !== null) {
160
- const newHistories: MicroAgenticaHistory<Model>[] =
161
- await agent.conversate(consent);
162
- const newTokenUsage: IAutoBeTokenUsageJson.IComponent = agent
163
- .getTokenUsage()
164
- .toJSON().aggregate;
165
- props
166
- .usage()
167
- .record(
168
- AutoBeTokenUsageComponent.minus(
169
- new AutoBeTokenUsageComponent(newTokenUsage),
170
- new AutoBeTokenUsageComponent(tokenUsage),
171
- ),
172
- [
173
- STAGES.find((stage) => next.source.startsWith(stage)) ??
174
- "analyze",
175
- ],
176
- );
177
- if (
178
- newHistories.some(
179
- (h) => h.type === "execute" && h.success === true,
147
+ const failure = () => {
148
+ throw new Error(
149
+ `Failed to function calling in the ${next.source} step`,
150
+ );
151
+ };
152
+ const last: MicroAgenticaHistory<Model> | undefined =
153
+ histories.at(-1);
154
+ if (
155
+ last?.type === "assistantMessage" &&
156
+ last.text.trim().length !== 0
157
+ ) {
158
+ const consent: string | null = await consentFunctionCall({
159
+ source: next.source,
160
+ dispatch: (e) => {
161
+ props.dispatch(e).catch(() => {});
162
+ },
163
+ config: props.config,
164
+ vendor: props.vendor,
165
+ assistantMessage: last.text,
166
+ });
167
+ if (consent !== null) {
168
+ const newHistories: MicroAgenticaHistory<Model>[] =
169
+ await agent.conversate(consent);
170
+ const newTokenUsage: IAutoBeTokenUsageJson.IComponent = agent
171
+ .getTokenUsage()
172
+ .toJSON().aggregate;
173
+ props
174
+ .usage()
175
+ .record(
176
+ AutoBeTokenUsageComponent.minus(
177
+ new AutoBeTokenUsageComponent(newTokenUsage),
178
+ new AutoBeTokenUsageComponent(tokenUsage),
179
+ ),
180
+ [
181
+ STAGES.find((stage) => next.source.startsWith(stage)) ??
182
+ "analyze",
183
+ ],
184
+ );
185
+ if (
186
+ newHistories.some(
187
+ (h) => h.type === "execute" && h.success === true,
188
+ )
180
189
  )
181
- )
182
- return {
183
- histories: newHistories,
184
- tokenUsage: newTokenUsage,
185
- };
190
+ return {
191
+ histories: newHistories,
192
+ tokenUsage: newTokenUsage,
193
+ };
194
+ }
186
195
  }
196
+ failure();
187
197
  }
188
- failure();
189
- }
190
- return { histories, tokenUsage };
191
- };
192
- if (next.enforceFunctionCall === true) return forceRetry(execute);
193
- else return execute();
194
- },
195
- });
198
+ return { histories, tokenUsage };
199
+ };
200
+ if (next.enforceFunctionCall === true) return forceRetry(execute, retry);
201
+ else return execute();
202
+ },
203
+ };
204
+ };
196
205
 
197
206
  const createDispatch = (props: {
198
207
  state: () => AutoBeState;
@@ -330,7 +339,7 @@ const transformAndDispatch = <
330
339
 
331
340
  const forceRetry = async <T>(
332
341
  task: () => Promise<T>,
333
- count: number = 3,
342
+ count: number,
334
343
  ): Promise<T> => {
335
344
  let error: unknown = undefined;
336
345
  for (let i: number = 0; i < count; ++i)
@@ -26,6 +26,8 @@ export interface IAutoBeAnalyzeReviewApplication {
26
26
  export namespace IAutoBeAnalyzeReviewApplication {
27
27
  export interface IProps {
28
28
  /**
29
+ * Step 1 (CoT: Review Phase) - Enhancement Criteria
30
+ *
29
31
  * The enhancement criteria and guidelines that the agent must follow.
30
32
  *
31
33
  * This includes:
@@ -52,6 +54,8 @@ export namespace IAutoBeAnalyzeReviewApplication {
52
54
  review: string;
53
55
 
54
56
  /**
57
+ * Step 2 (CoT: Plan Phase) - Original Document Plan
58
+ *
55
59
  * The document plan that was used to create the content.
56
60
  *
57
61
  * This helps the reviewer understand:
@@ -67,6 +71,8 @@ export namespace IAutoBeAnalyzeReviewApplication {
67
71
  plan: string;
68
72
 
69
73
  /**
74
+ * Step 3 (CoT: Content Phase) - Complete Document Content
75
+ *
70
76
  * The actual markdown document content that incorporates review feedback.
71
77
  *
72
78
  * This field contains a COMPLETE MARKDOWN DOCUMENT that has already
@@ -15,6 +15,8 @@ export interface IAutoBeAnalyzeWriteApplication {
15
15
  export namespace IAutoBeAnalyzeWriteApplication {
16
16
  export interface IProps {
17
17
  /**
18
+ * Step 1 (CoT: Plan Phase) - Document Planning Structure
19
+ *
18
20
  * The document planning structure that outlines what needs to be written.
19
21
  *
20
22
  * This includes:
@@ -40,6 +42,8 @@ export namespace IAutoBeAnalyzeWriteApplication {
40
42
  plan: string;
41
43
 
42
44
  /**
45
+ * Step 2 (CoT: Write Phase) - Document Content Creation
46
+ *
43
47
  * The initial content or context for the document being written.
44
48
  *
45
49
  * This may include:
@@ -1,5 +1,5 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
- import { AutoBeAnalyzeRole } from "@autobe/interface";
2
+ import { AutoBeAnalyzeHistory, AutoBeAnalyzeRole } from "@autobe/interface";
3
3
  import { StringUtil } from "@autobe/utils";
4
4
  import { v7 } from "uuid";
5
5
 
@@ -13,6 +13,7 @@ export const transformInterfaceAuthorizationsHistories = (
13
13
  ): Array<
14
14
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
15
15
  > => {
16
+ const analyze: AutoBeAnalyzeHistory = state.analyze!;
16
17
  return [
17
18
  {
18
19
  type: "systemMessage",
@@ -21,6 +22,23 @@ export const transformInterfaceAuthorizationsHistories = (
21
22
  text: AutoBeSystemPromptConstant.INTERFACE_AUTHORIZATION,
22
23
  },
23
24
  ...transformInterfaceAssetHistories(state),
25
+ {
26
+ type: "systemMessage",
27
+ id: v7(),
28
+ created_at: new Date().toISOString(),
29
+ text: StringUtil.trim`
30
+ ## Service Prefix
31
+ - Original: ${analyze.prefix}
32
+ - PascalCase for DTOs: ${analyze.prefix
33
+ .split(/[-_]/)
34
+ .map((p) => p.charAt(0).toUpperCase() + p.slice(1))
35
+ .join("")}
36
+ - Expected DTO pattern: I${analyze.prefix
37
+ .split(/[-_]/)
38
+ .map((p) => p.charAt(0).toUpperCase() + p.slice(1))
39
+ .join("")}{EntityName}
40
+ `,
41
+ },
24
42
  {
25
43
  type: "assistantMessage",
26
44
  id: v7(),
@@ -10,10 +10,7 @@ import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHisto
10
10
  export const transformInterfaceSchemasReviewHistories = (
11
11
  state: AutoBeState,
12
12
  operations: AutoBeOpenApi.IOperation[],
13
- schemaDescriptive: Record<
14
- string,
15
- AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>
16
- >,
13
+ schemaDescriptive: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>,
17
14
  ): Array<
18
15
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
19
16
  > => {
@@ -20,6 +20,7 @@ import { orchestrateInterfaceEndpoints } from "./orchestrateInterfaceEndpoints";
20
20
  import { orchestrateInterfaceGroups } from "./orchestrateInterfaceGroups";
21
21
  import { orchestrateInterfaceOperations } from "./orchestrateInterfaceOperations";
22
22
  import { orchestrateInterfaceSchemas } from "./orchestrateInterfaceSchemas";
23
+ import { orchestrateInterfaceSchemasReview } from "./orchestrateInterfaceSchemasReview";
23
24
 
24
25
  export const orchestrateInterface =
25
26
  <Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>) =>
@@ -94,10 +95,20 @@ export const orchestrateInterface =
94
95
  schemas: await orchestrateInterfaceSchemas(ctx, operations),
95
96
  },
96
97
  };
97
- Object.assign(
98
- document.components.schemas,
99
- await orchestrateInterfaceComplement(ctx, document),
100
- );
98
+
99
+ const complementedSchemas: Record<
100
+ string,
101
+ AutoBeOpenApi.IJsonSchemaDescriptive
102
+ > = await orchestrateInterfaceComplement(ctx, document);
103
+ Object.assign(document.components.schemas, complementedSchemas);
104
+
105
+ const schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
106
+ await orchestrateInterfaceSchemasReview(
107
+ ctx,
108
+ operations,
109
+ document.components.schemas,
110
+ );
111
+ Object.assign(document.components.schemas, schemas);
101
112
 
102
113
  // DO COMPILE
103
114
  return ctx.dispatch({
@@ -61,7 +61,7 @@ async function process<Model extends ILlmSchema.Model>(
61
61
  histories: transformInterfaceAuthorizationsHistories(ctx.state(), role),
62
62
  controller: createController({
63
63
  model: ctx.model,
64
- role: role.name,
64
+ role,
65
65
  build: (next) => {
66
66
  pointer.value = next;
67
67
  },
@@ -87,7 +87,7 @@ async function process<Model extends ILlmSchema.Model>(
87
87
 
88
88
  function createController<Model extends ILlmSchema.Model>(props: {
89
89
  model: Model;
90
- role: string;
90
+ role: AutoBeAnalyzeRole;
91
91
  build: (next: IAutoBeInterfaceAuthorizationsApplication.IProps) => void;
92
92
  }): IAgenticaController.IClass<Model> {
93
93
  assertSchemaModel(props.model);
@@ -99,11 +99,18 @@ function createController<Model extends ILlmSchema.Model>(props: {
99
99
  typia.validate<IAutoBeInterfaceAuthorizationsApplication.IProps>(next);
100
100
  if (result.success === false) return result;
101
101
 
102
+ // remove login operation for guest role
103
+ if (props.role.kind === "guest") {
104
+ result.data.operations = result.data.operations.filter(
105
+ (op) => op.authorizationType !== "login",
106
+ );
107
+ }
108
+
102
109
  const errors: IValidation.IError[] = [];
103
110
  result.data.operations.forEach((op, i) => {
104
111
  // validate authorizationRole
105
112
  if (op.authorizationRole !== null) {
106
- op.authorizationRole = props.role;
113
+ op.authorizationRole = props.role.name;
107
114
  }
108
115
 
109
116
  // validate responseBody.typeName -> must be ~.IAuthorized
@@ -148,7 +155,8 @@ function createController<Model extends ILlmSchema.Model>(props: {
148
155
  .filter((v) => v !== null),
149
156
  );
150
157
  for (const type of typia.misc.literals<AuthorizationType>())
151
- if (authorizationTypes.has(type) === false)
158
+ if (props.role.kind === "guest" && type === "login") continue;
159
+ else if (authorizationTypes.has(type) === false)
152
160
  errors.push({
153
161
  path: "$input.operations[].authorizationType",
154
162
  expected: StringUtil.trim`{
@@ -160,7 +168,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
160
168
  There must be an operation that has defined AutoBeOpenApi.IOperation.authorizationType := "${type}"
161
169
  for the "${props.role}" role's authorization activity; "${type}".
162
170
 
163
- However, none of the operations have the AutoBeOpenApi.IOperation.authorizationType := "${type}"
171
+ However, none of the operations have the AutoBeOpenApi.IOperation.authorizationType := "${type}"
164
172
  value, so that the "${props.role}" cannot perform the authorization ${type} activity.
165
173
 
166
174
  Please make that operation at the next function calling. You have to do it.
@@ -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 { JsonSchemaValidator } from "./utils/JsonSchemaValidator";
21
+ import { fulfillJsonSchemaErrorMessages } from "./utils/fulfillJsonSchemaErrorMessages";
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
+ JsonSchemaValidator.validate({
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>;