@autobe/agent 0.20.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/lib/agent/src/AutoBeAgent.js +2 -2
  2. package/lib/agent/src/AutoBeAgent.js.map +1 -1
  3. package/lib/agent/src/AutoBeMockAgent.js +1 -0
  4. package/lib/agent/src/AutoBeMockAgent.js.map +1 -1
  5. package/lib/agent/src/constants/AutoBeConfigConstant.d.ts +3 -0
  6. package/lib/agent/src/{orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js → constants/AutoBeConfigConstant.js} +1 -1
  7. package/lib/agent/src/constants/AutoBeConfigConstant.js.map +1 -0
  8. package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +27 -26
  9. package/lib/agent/src/constants/AutoBeSystemPromptConstant.js.map +1 -1
  10. package/lib/agent/src/context/AutoBeContext.d.ts +3 -2
  11. package/lib/agent/src/context/AutoBeTokenUsageComponent.js +4 -3
  12. package/lib/agent/src/context/AutoBeTokenUsageComponent.js.map +1 -1
  13. package/lib/agent/src/factory/consentFunctionCall.js +4 -4
  14. package/lib/agent/src/factory/consentFunctionCall.js.map +1 -1
  15. package/lib/agent/src/factory/createAutoBeContext.js +16 -11
  16. package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
  17. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
  18. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
  19. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
  20. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  21. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +1 -1
  22. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  23. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +6 -6
  24. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +50 -8
  25. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  26. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +4 -4
  27. package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
  28. package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
  29. package/lib/agent/src/orchestrate/facade/transformFacadeStateMessage.js +1 -1
  30. package/lib/agent/src/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
  31. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +19 -1
  32. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  33. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
  34. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  35. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
  36. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  37. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
  38. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +33 -0
  39. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -0
  40. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
  41. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  42. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
  43. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  44. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
  45. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  46. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
  47. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  48. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
  49. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
  50. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  51. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +5 -1
  52. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
  53. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +16 -10
  54. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  55. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
  56. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +3731 -228
  57. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  58. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js +5 -3
  59. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  60. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
  61. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +365 -0
  62. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -0
  63. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +43 -63
  64. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  65. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +244 -176
  66. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  67. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +3466 -103
  68. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  69. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
  70. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +3672 -358
  71. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
  72. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
  73. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js +3 -0
  74. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js.map +1 -0
  75. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
  76. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -101
  77. package/lib/agent/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
  78. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
  79. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.js +1385 -0
  80. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -0
  81. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
  82. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.js +78 -0
  83. package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.js.map +1 -0
  84. package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
  85. package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js +81 -0
  86. package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js.map +1 -0
  87. package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js.map +1 -1
  88. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +1 -1
  89. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  90. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +1 -1
  91. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
  92. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +2 -2
  93. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  94. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
  95. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  96. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
  97. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +2 -2
  98. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  99. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +1 -1
  100. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
  101. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +2 -2
  102. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  103. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
  104. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +22 -7
  105. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  106. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
  107. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +13 -29
  108. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  109. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
  110. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js +2 -8
  111. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
  112. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +6 -49
  113. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
  114. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +4 -2
  115. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  116. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +5 -3
  117. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  118. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
  119. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +206 -118
  120. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  121. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
  122. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js +2 -2
  123. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
  124. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
  125. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +24 -39
  126. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  127. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
  128. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
  129. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
  130. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
  131. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js +3 -0
  132. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js.map +1 -0
  133. package/{src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.ts → lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts} +3 -10
  134. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js +3 -0
  135. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js.map +1 -0
  136. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +40 -24
  137. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
  138. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +86 -0
  139. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -0
  140. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
  141. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js +55 -0
  142. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -0
  143. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
  144. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js +20 -0
  145. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -0
  146. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
  147. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js +73 -0
  148. package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -0
  149. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
  150. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js +63 -69
  151. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  152. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js +15 -14
  153. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
  154. package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js +1 -1
  155. package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
  156. package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
  157. package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js +19 -0
  158. package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js.map +1 -0
  159. package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
  160. package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js +2 -0
  161. package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
  162. package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
  163. package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js +21 -0
  164. package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js.map +1 -0
  165. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.d.ts +4 -2
  166. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +40 -25
  167. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  168. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +5 -4
  169. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  170. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
  171. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +137 -96
  172. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  173. package/lib/agent/src/orchestrate/test/orchestrateTest.js +6 -0
  174. package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
  175. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
  176. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +126 -72
  177. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  178. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +54 -48
  179. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  180. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +122 -43
  181. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  182. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
  183. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
  184. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js +3 -0
  185. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js.map +1 -0
  186. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
  187. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
  188. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
  189. package/lib/agent/src/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
  190. package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js +28 -0
  191. package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js.map +1 -0
  192. package/lib/agent/src/structures/IAutoBeConfig.d.ts +2 -0
  193. package/lib/constants/AutoBeConfigConstant.d.ts +3 -0
  194. package/lib/constants/AutoBeSystemPromptConstant.d.ts +27 -26
  195. package/lib/context/AutoBeContext.d.ts +3 -2
  196. package/lib/index.mjs +13778 -3055
  197. package/lib/index.mjs.map +1 -1
  198. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
  199. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
  200. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
  201. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
  202. package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
  203. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
  204. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
  205. package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
  206. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
  207. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -101
  208. package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
  209. package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
  210. package/lib/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
  211. package/lib/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
  212. package/lib/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
  213. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
  214. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
  215. package/lib/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
  216. package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
  217. package/lib/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
  218. package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
  219. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
  220. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
  221. package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
  222. package/lib/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
  223. package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts +36 -0
  224. package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +40 -24
  225. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
  226. package/lib/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
  227. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
  228. package/lib/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
  229. package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
  230. package/lib/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
  231. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
  232. package/lib/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
  233. package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +4 -2
  234. package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
  235. package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
  236. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
  237. package/lib/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
  238. package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
  239. package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
  240. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
  241. package/lib/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
  242. package/lib/structures/IAutoBeConfig.d.ts +2 -0
  243. package/package.json +6 -6
  244. package/src/AutoBeAgent.ts +2 -0
  245. package/src/AutoBeMockAgent.ts +1 -0
  246. package/src/constants/AutoBeConfigConstant.ts +3 -0
  247. package/src/constants/AutoBeSystemPromptConstant.ts +27 -26
  248. package/src/context/AutoBeContext.ts +3 -0
  249. package/src/context/AutoBeTokenUsageComponent.ts +3 -3
  250. package/src/factory/consentFunctionCall.ts +2 -0
  251. package/src/factory/createAutoBeContext.ts +145 -135
  252. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +6 -0
  253. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +4 -0
  254. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +19 -1
  255. package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +39 -0
  256. package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +1 -4
  257. package/src/orchestrate/interface/orchestrateInterface.ts +15 -4
  258. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +13 -5
  259. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +58 -19
  260. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +5 -1
  261. package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +95 -0
  262. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +11 -11
  263. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +7 -3
  264. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +33 -91
  265. package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +72 -95
  266. package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.ts +65 -0
  267. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +0 -39
  268. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +50 -104
  269. package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +31 -27
  270. package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +171 -0
  271. package/src/orchestrate/interface/utils/JsonSchemaNamingConvention.ts +83 -0
  272. package/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.ts +90 -0
  273. package/src/orchestrate/interface/utils/validateAuthorizationSchema.ts +2 -2
  274. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +1 -2
  275. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +30 -15
  276. package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +27 -49
  277. package/src/orchestrate/realize/internal/compileRealizeFiles.ts +4 -11
  278. package/src/orchestrate/realize/orchestrateRealize.ts +19 -75
  279. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +1 -1
  280. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +114 -25
  281. package/src/orchestrate/realize/orchestrateRealizeScenario.ts +9 -5
  282. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +11 -15
  283. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +17 -0
  284. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +20 -0
  285. package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +40 -74
  286. package/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.ts +9 -0
  287. package/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.ts +45 -0
  288. package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +43 -27
  289. package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +97 -0
  290. package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +64 -0
  291. package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +29 -0
  292. package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +82 -0
  293. package/src/orchestrate/realize/utils/replaceImportStatements.ts +101 -111
  294. package/src/orchestrate/test/compile/completeTestCode.ts +15 -26
  295. package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +3 -0
  296. package/src/orchestrate/test/compile/getTestImportStatements.ts +25 -0
  297. package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +6 -1
  298. package/src/orchestrate/test/compile/getTestTemplateCode.ts +25 -0
  299. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +48 -36
  300. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +6 -5
  301. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +43 -4
  302. package/src/orchestrate/test/orchestrateTest.ts +6 -0
  303. package/src/orchestrate/test/orchestrateTestCorrect.ts +46 -11
  304. package/src/orchestrate/test/orchestrateTestScenario.ts +52 -48
  305. package/src/orchestrate/test/orchestrateTestWrite.ts +24 -6
  306. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +49 -46
  307. package/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.ts +8 -0
  308. package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +28 -1
  309. package/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.ts +1 -0
  310. package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +14 -0
  311. package/src/orchestrate/test/utils/getReferenceIds.ts +25 -0
  312. package/src/structures/IAutoBeConfig.ts +3 -0
  313. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
  314. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js.map +0 -1
  315. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
  316. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js +0 -75
  317. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js.map +0 -1
  318. package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
  319. package/lib/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
  320. package/src/orchestrate/test/histories/transformTestHistories.ts +0 -78
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  IAgenticaVendor,
3
3
  IMicroAgenticaHistoryJson,
4
+ MicroAgentica,
4
5
  MicroAgenticaHistory,
5
6
  } from "@agentica/core";
6
7
  import {
@@ -29,6 +30,7 @@ export interface AutoBeContext<Model extends ILlmSchema.Model> {
29
30
  model: Model;
30
31
  vendor: IAgenticaVendor;
31
32
  locale: string;
33
+ retry: number;
32
34
 
33
35
  // accessors
34
36
  compilerListener: IAutoBeCompilerListener;
@@ -49,6 +51,7 @@ export interface AutoBeContext<Model extends ILlmSchema.Model> {
49
51
  // factories
50
52
  conversate(
51
53
  props: AutoBeContext.IConversate<Model>,
54
+ closure?: (agent: MicroAgentica<Model>) => void,
52
55
  ): Promise<AutoBeContext.IResult<Model>>;
53
56
  }
54
57
  export namespace AutoBeContext {
@@ -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,151 +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) => {
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
- });
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);
121
129
 
122
- const histories: MicroAgenticaHistory<Model>[] = await agent.conversate(
123
- next.message,
124
- );
125
- const tokenUsage: IAutoBeTokenUsageJson.IComponent = agent
126
- .getTokenUsage()
127
- .toJSON().aggregate;
128
- props
129
- .usage()
130
- .record(tokenUsage, [
131
- STAGES.find((stage) => next.source.startsWith(stage)) ?? "analyze",
132
- ]);
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
+ ]);
133
141
 
134
- if (
135
- true === next.enforceFunctionCall &&
136
- false ===
137
- histories.some((h) => h.type === "execute" && h.success === true)
138
- ) {
139
- const failure = () => {
140
- throw new Error(
141
- `Failed to function calling in the ${next.source} step`,
142
- );
143
- };
144
- const last: MicroAgenticaHistory<Model> | undefined = histories.at(-1);
145
142
  if (
146
- last?.type === "assistantMessage" &&
147
- last.text.trim().length !== 0
143
+ true === next.enforceFunctionCall &&
144
+ false ===
145
+ histories.some((h) => h.type === "execute" && h.success === true)
148
146
  ) {
149
- const consent: string | null = await consentFunctionCall({
150
- source: next.source,
151
- dispatch: (e) => {
152
- props.dispatch(e).catch(() => {});
153
- },
154
- config: props.config,
155
- vendor: props.vendor,
156
- assistantMessage: last.text,
157
- });
158
- if (consent !== null) {
159
- const newHistories: MicroAgenticaHistory<Model>[] =
160
- await agent.conversate(consent);
161
- const newTokenUsage: IAutoBeTokenUsageJson.IComponent = agent
162
- .getTokenUsage()
163
- .toJSON().aggregate;
164
- props
165
- .usage()
166
- .record(
167
- AutoBeTokenUsageComponent.minus(
168
- new AutoBeTokenUsageComponent(newTokenUsage),
169
- new AutoBeTokenUsageComponent(tokenUsage),
170
- ),
171
- [
172
- STAGES.find((stage) => next.source.startsWith(stage)) ??
173
- "analyze",
174
- ],
175
- );
176
- if (
177
- newHistories.some(
178
- (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
+ )
179
189
  )
180
- )
181
- return {
182
- histories: newHistories,
183
- tokenUsage: newTokenUsage,
184
- };
190
+ return {
191
+ histories: newHistories,
192
+ tokenUsage: newTokenUsage,
193
+ };
194
+ }
185
195
  }
196
+ failure();
186
197
  }
187
- failure();
188
- }
189
- return { histories, tokenUsage };
190
- };
191
- if (next.enforceFunctionCall === true) return forceRetry(execute);
192
- else return execute();
193
- },
194
- });
198
+ return { histories, tokenUsage };
199
+ };
200
+ if (next.enforceFunctionCall === true) return forceRetry(execute, retry);
201
+ else return execute();
202
+ },
203
+ };
204
+ };
195
205
 
196
206
  const createDispatch = (props: {
197
207
  state: () => AutoBeState;
@@ -329,7 +339,7 @@ const transformAndDispatch = <
329
339
 
330
340
  const forceRetry = async <T>(
331
341
  task: () => Promise<T>,
332
- count: number = 3,
342
+ count: number,
333
343
  ): Promise<T> => {
334
344
  let error: unknown = undefined;
335
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(),
@@ -0,0 +1,39 @@
1
+ import { IAgenticaHistoryJson } from "@agentica/core";
2
+ import { AutoBeOpenApi } from "@autobe/interface";
3
+ import { v4 } from "uuid";
4
+
5
+ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
6
+ import { AutoBeState } from "../../../context/AutoBeState";
7
+ import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHistories";
8
+
9
+ export const transformInterfaceEndpointsReviewHistories = (
10
+ state: AutoBeState,
11
+ endpoints: AutoBeOpenApi.IEndpoint[],
12
+ ): Array<
13
+ IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
14
+ > => [
15
+ {
16
+ type: "systemMessage",
17
+ id: v4(),
18
+ created_at: new Date().toISOString(),
19
+ text: AutoBeSystemPromptConstant.INTERFACE_ENDPOINT,
20
+ },
21
+ ...transformInterfaceAssetHistories(state),
22
+ {
23
+ id: v4(),
24
+ type: "assistantMessage",
25
+ text: [
26
+ "Below are endpoints generated by your request.",
27
+ "```json",
28
+ JSON.stringify(endpoints),
29
+ "```",
30
+ ].join("\n"),
31
+ created_at: new Date().toISOString(),
32
+ },
33
+ {
34
+ id: v4(),
35
+ type: "systemMessage",
36
+ text: AutoBeSystemPromptConstant.INTERFACE_ENDPOINTS_REVIEW,
37
+ created_at: new Date().toISOString(),
38
+ },
39
+ ];
@@ -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.