@autobe/agent 0.24.2 → 0.25.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 (297) hide show
  1. package/lib/AutoBeAgent.js +11 -1
  2. package/lib/AutoBeAgent.js.map +1 -1
  3. package/lib/AutoBeMockAgent.js +1 -0
  4. package/lib/AutoBeMockAgent.js.map +1 -1
  5. package/lib/constants/AutoBeSystemPromptConstant.d.ts +21 -21
  6. package/lib/context/IAutoBeApplication.d.ts +101 -6
  7. package/lib/context/IAutoBeApplicationProps.d.ts +6 -2
  8. package/lib/factory/createAgenticaHistory.js +1 -1
  9. package/lib/factory/createAgenticaHistory.js.map +1 -1
  10. package/lib/factory/createAutoBeApplication.js +80 -90
  11. package/lib/factory/createAutoBeApplication.js.map +1 -1
  12. package/lib/factory/createAutoBeContext.js +6 -5
  13. package/lib/factory/createAutoBeContext.js.map +1 -1
  14. package/lib/index.mjs +3914 -2594
  15. package/lib/index.mjs.map +1 -1
  16. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +5 -1
  17. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
  18. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.d.ts +1 -1
  19. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +18 -3
  20. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  21. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +5 -1
  22. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +19 -7
  23. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  24. package/lib/orchestrate/analyze/orchestrateAnalyze.js +3 -2
  25. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  26. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.d.ts +1 -1
  27. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +2 -2
  28. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  29. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +1 -0
  30. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -2
  31. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  32. package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +1 -1
  33. package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
  34. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +36 -23
  35. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
  36. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.d.ts +22 -42
  37. package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
  38. package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
  39. package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js +2 -1
  40. package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
  41. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +5 -1
  42. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +20 -7
  43. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  44. package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.d.ts +3 -0
  45. package/lib/orchestrate/interface/histories/{transformInterfacePrerequisiteHistories.js → transformInterfaceCommonPrerequisiteHistories.js} +4 -4
  46. package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.js.map +1 -0
  47. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.d.ts +6 -1
  48. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +31 -23
  49. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  50. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.d.ts +6 -1
  51. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +22 -6
  52. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  53. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +1 -1
  54. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
  55. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.d.ts +4 -1
  56. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +27 -6
  57. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  58. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.d.ts +5 -1
  59. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +21 -5
  60. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  61. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +1 -1
  62. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  63. package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.d.ts +3 -0
  64. package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js +102 -0
  65. package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js.map +1 -0
  66. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +5 -1
  67. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +20 -4
  68. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  69. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
  70. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  71. package/lib/orchestrate/interface/orchestrateInterface.js +45 -11
  72. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  73. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +1 -1
  74. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +277 -37
  75. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  76. package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +4 -1
  77. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +69 -70
  78. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  79. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.d.ts +6 -1
  80. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +28 -13
  81. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  82. package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +4 -1
  83. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +11 -8
  84. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  85. package/lib/orchestrate/interface/orchestrateInterfaceOperations.d.ts +5 -1
  86. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +36 -21
  87. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  88. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +260 -29
  89. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  90. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.d.ts +5 -0
  91. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +713 -0
  92. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -0
  93. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.d.ts +5 -1
  94. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +83 -53
  95. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  96. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js +41 -7
  97. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
  98. package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +0 -38
  99. package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +6 -10
  100. package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.d.ts +52 -0
  101. package/lib/orchestrate/{common/structures/IAutoBeCommonCorrectDateApplication.js → interface/structures/IAutoBeInterfacePrerequisitesApplication.js} +1 -1
  102. package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.js.map +1 -0
  103. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +0 -33
  104. package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +6 -2
  105. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +105 -5
  106. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
  107. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +20 -1
  108. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
  109. package/lib/orchestrate/interface/utils/OperationValidator.d.ts +3 -4
  110. package/lib/orchestrate/interface/utils/OperationValidator.js +1 -1
  111. package/lib/orchestrate/interface/utils/OperationValidator.js.map +1 -1
  112. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.d.ts +4 -1
  113. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +19 -8
  114. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  115. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
  116. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  117. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.d.ts +6 -1
  118. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +20 -6
  119. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  120. package/lib/orchestrate/prisma/orchestratePrisma.js +3 -3
  121. package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  122. package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -1
  123. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +6 -3
  124. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  125. package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +1 -1
  126. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +12 -6
  127. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  128. package/lib/orchestrate/{common/histories/transformCommonCorrectDateHistories.d.ts → realize/histories/transformRealizeCorrectCastingHistories.d.ts} +1 -2
  129. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +32 -0
  130. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -0
  131. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +14 -22
  132. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  133. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +6 -6
  134. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +8 -2
  135. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  136. package/lib/orchestrate/realize/internal/compileRealizeFiles.js +1 -2
  137. package/lib/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
  138. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.d.ts +2 -1
  139. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js +119 -42
  140. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +1 -1
  141. package/lib/orchestrate/realize/orchestrateRealize.js +82 -52
  142. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  143. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +128 -88
  144. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  145. package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -1
  146. package/lib/orchestrate/realize/orchestrateRealizeWrite.js +117 -54
  147. package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  148. package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +52 -26
  149. package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +44 -34
  150. package/lib/orchestrate/realize/utils/InternalFileSystem.js +1 -1
  151. package/lib/orchestrate/realize/utils/InternalFileSystem.js.map +1 -1
  152. package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -5
  153. package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
  154. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +8 -3
  155. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +44 -17
  156. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
  157. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +4 -1
  158. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js +24 -9
  159. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -1
  160. package/lib/orchestrate/realize/utils/printErrorHints.d.ts +8 -0
  161. package/lib/orchestrate/realize/utils/printErrorHints.js +48 -0
  162. package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -0
  163. package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +1 -0
  164. package/lib/orchestrate/realize/utils/replaceImportStatements.js +93 -53
  165. package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  166. package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +5 -1
  167. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +11 -7
  168. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  169. package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +1 -1
  170. package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
  171. package/lib/orchestrate/test/histories/transformTestScenarioHistories.d.ts +7 -1
  172. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +35 -96
  173. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  174. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.d.ts +6 -3
  175. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +33 -77
  176. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
  177. package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +5 -1
  178. package/lib/orchestrate/test/histories/transformTestWriteHistories.js +111 -94
  179. package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  180. package/lib/orchestrate/test/orchestrateTest.js +20 -14
  181. package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
  182. package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +4 -1
  183. package/lib/orchestrate/test/orchestrateTestCorrect.js +81 -50
  184. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  185. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +31 -13
  186. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
  187. package/lib/orchestrate/test/orchestrateTestScenario.d.ts +1 -1
  188. package/lib/orchestrate/test/orchestrateTestScenario.js +18 -7
  189. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  190. package/lib/orchestrate/test/orchestrateTestScenarioReview.d.ts +5 -1
  191. package/lib/orchestrate/test/orchestrateTestScenarioReview.js +20 -12
  192. package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
  193. package/lib/orchestrate/test/orchestrateTestWrite.d.ts +4 -1
  194. package/lib/orchestrate/test/orchestrateTestWrite.js +46 -25
  195. package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  196. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +9 -5
  197. package/lib/orchestrate/test/structures/IAutoBeTestCorrectInvalidRequestApplication.d.ts +8 -2
  198. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +11 -7
  199. package/lib/orchestrate/test/utils/getPrerequisites.d.ts +5 -0
  200. package/lib/orchestrate/test/utils/getPrerequisites.js +36 -0
  201. package/lib/orchestrate/test/utils/getPrerequisites.js.map +1 -0
  202. package/lib/orchestrate/test/utils/getReferenceIds.js +1 -1
  203. package/lib/orchestrate/test/utils/getReferenceIds.js.map +1 -1
  204. package/package.json +5 -5
  205. package/src/AutoBeAgent.ts +17 -1
  206. package/src/AutoBeMockAgent.ts +1 -0
  207. package/src/constants/AutoBeSystemPromptConstant.ts +21 -21
  208. package/src/context/IAutoBeApplication.ts +101 -6
  209. package/src/context/IAutoBeApplicationProps.ts +6 -2
  210. package/src/factory/createAgenticaHistory.ts +11 -5
  211. package/src/factory/createAutoBeContext.ts +6 -5
  212. package/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts +5 -1
  213. package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +16 -0
  214. package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +22 -7
  215. package/src/orchestrate/analyze/orchestrateAnalyze.ts +3 -2
  216. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +2 -1
  217. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +3 -2
  218. package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +2 -2
  219. package/src/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.ts +25 -45
  220. package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +2 -1
  221. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +23 -9
  222. package/src/orchestrate/interface/histories/{transformInterfacePrerequisiteHistories.ts → transformInterfaceCommonPrerequisiteHistories.ts} +1 -1
  223. package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +33 -24
  224. package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +26 -9
  225. package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +30 -6
  226. package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +24 -7
  227. package/src/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.ts +118 -0
  228. package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +23 -6
  229. package/src/orchestrate/interface/orchestrateInterface.ts +65 -20
  230. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +22 -12
  231. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +34 -47
  232. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +40 -28
  233. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +9 -3
  234. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +51 -35
  235. package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +274 -0
  236. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +52 -33
  237. package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +1 -1
  238. package/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.ts +0 -39
  239. package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +6 -10
  240. package/src/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.ts +58 -0
  241. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +0 -34
  242. package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +92 -4
  243. package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +19 -1
  244. package/src/orchestrate/interface/utils/OperationValidator.ts +9 -7
  245. package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +20 -6
  246. package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +24 -9
  247. package/src/orchestrate/prisma/orchestratePrisma.ts +7 -3
  248. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +5 -1
  249. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +15 -10
  250. package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +44 -0
  251. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -24
  252. package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +6 -6
  253. package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +6 -4
  254. package/src/orchestrate/realize/internal/compileRealizeFiles.ts +1 -5
  255. package/src/orchestrate/realize/orchestRateRealizeCorrectCasting.ts +102 -16
  256. package/src/orchestrate/realize/orchestrateRealize.ts +121 -81
  257. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +50 -7
  258. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +14 -4
  259. package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +54 -29
  260. package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +46 -35
  261. package/src/orchestrate/realize/utils/InternalFileSystem.ts +1 -1
  262. package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -5
  263. package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +54 -22
  264. package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +28 -16
  265. package/src/orchestrate/realize/utils/printErrorHints.ts +55 -0
  266. package/src/orchestrate/realize/utils/replaceImportStatements.ts +99 -97
  267. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +14 -7
  268. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +50 -115
  269. package/src/orchestrate/test/histories/transformTestScenarioReviewHistories.ts +41 -111
  270. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +35 -12
  271. package/src/orchestrate/test/orchestrateTest.ts +19 -13
  272. package/src/orchestrate/test/orchestrateTestCorrect.ts +71 -51
  273. package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +13 -1
  274. package/src/orchestrate/test/orchestrateTestScenario.ts +27 -17
  275. package/src/orchestrate/test/orchestrateTestScenarioReview.ts +32 -19
  276. package/src/orchestrate/test/orchestrateTestWrite.ts +20 -10
  277. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +9 -228
  278. package/src/orchestrate/test/structures/IAutoBeTestCorrectInvalidRequestApplication.ts +8 -2
  279. package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +11 -78
  280. package/src/orchestrate/test/utils/getPrerequisites.ts +51 -0
  281. package/src/orchestrate/test/utils/getReferenceIds.ts +2 -1
  282. package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js +0 -48
  283. package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js.map +0 -1
  284. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.d.ts +0 -35
  285. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.js.map +0 -1
  286. package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.d.ts +0 -3
  287. package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js.map +0 -1
  288. package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.d.ts +0 -6
  289. package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js +0 -22
  290. package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js.map +0 -1
  291. package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.d.ts +0 -4
  292. package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js +0 -540
  293. package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js.map +0 -1
  294. package/src/orchestrate/common/histories/transformCommonCorrectDateHistories.ts +0 -60
  295. package/src/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.ts +0 -40
  296. package/src/orchestrate/interface/utils/OpenApiEndpointComparator.ts +0 -23
  297. package/src/orchestrate/realize/orchestrateRealizeCorrectDate.ts +0 -372
@@ -0,0 +1,274 @@
1
+ import { IAgenticaController } from "@agentica/core";
2
+ import { AutoBeOpenApi, AutoBeProgressEventBase } from "@autobe/interface";
3
+ import { AutoBeInterfacePrerequisite } from "@autobe/interface/src/histories/contents/AutoBeInterfacePrerequisite";
4
+ import { AutoBeOpenApiEndpointComparator } from "@autobe/utils";
5
+ import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
6
+ import { HashMap, IPointer, Pair } from "tstl";
7
+ import typia from "typia";
8
+ import { v7 } from "uuid";
9
+
10
+ import { AutoBeConfigConstant } from "../../constants/AutoBeConfigConstant";
11
+ import { AutoBeContext } from "../../context/AutoBeContext";
12
+ import { assertSchemaModel } from "../../context/assertSchemaModel";
13
+ import { divideArray } from "../../utils/divideArray";
14
+ import { executeCachedBatch } from "../../utils/executeCachedBatch";
15
+ import { transformInterfacePrerequisitesHistories } from "./histories/transformInterfacePrerequisitesHistories";
16
+ import { IAutoBeInterfacePrerequisitesApplication } from "./structures/IAutoBeInterfacePrerequisitesApplication";
17
+
18
+ export async function orchestrateInterfacePrerequisites<
19
+ Model extends ILlmSchema.Model,
20
+ >(
21
+ ctx: AutoBeContext<Model>,
22
+ document: AutoBeOpenApi.IDocument,
23
+ capacity: number = AutoBeConfigConstant.INTERFACE_CAPACITY,
24
+ ): Promise<AutoBeInterfacePrerequisite[]> {
25
+ const operations: AutoBeOpenApi.IOperation[] =
26
+ document.operations.filter((op) => op.authorizationType === null) ?? [];
27
+ const progress: AutoBeProgressEventBase = {
28
+ total: operations.length,
29
+ completed: 0,
30
+ };
31
+ const prerequisiteOperations: AutoBeOpenApi.IOperation[] =
32
+ document.operations.filter(
33
+ (op) => op.authorizationType === null && op.method === "post",
34
+ );
35
+
36
+ const dict: HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IOperation> =
37
+ new HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IOperation>(
38
+ prerequisiteOperations.map(
39
+ (op) => new Pair({ path: op.path, method: op.method }, op),
40
+ ),
41
+ AutoBeOpenApiEndpointComparator.hashCode,
42
+ AutoBeOpenApiEndpointComparator.equals,
43
+ );
44
+
45
+ const prerequisitesNotFound: string = [
46
+ `You have to select one of the endpoints below`,
47
+ "",
48
+ " method | path ",
49
+ "--------|------",
50
+ ...prerequisiteOperations
51
+ .map((op) => `\`${op.method}\` | \`${op.path}\``)
52
+ .join("\n"),
53
+ ].join("\n");
54
+
55
+ const exclude: AutoBeInterfacePrerequisite[] = [];
56
+ let include: AutoBeOpenApi.IOperation[] = [...operations];
57
+ let trial: number = 0;
58
+
59
+ do {
60
+ const matrix: AutoBeOpenApi.IOperation[][] = divideArray({
61
+ array: include,
62
+ capacity: capacity ?? AutoBeConfigConstant.INTERFACE_CAPACITY,
63
+ });
64
+
65
+ await executeCachedBatch(
66
+ matrix.map((ops) => async (promptCacheKey) => {
67
+ const row: AutoBeInterfacePrerequisite[] = await divideAndConquer(ctx, {
68
+ dict: dict,
69
+ document,
70
+ includes: ops,
71
+ progress,
72
+ promptCacheKey,
73
+ prerequisitesNotFound,
74
+ });
75
+ exclude.push(...row);
76
+ return row;
77
+ }),
78
+ );
79
+ include = include.filter((op) => {
80
+ if (
81
+ exclude.some(
82
+ (el) =>
83
+ el.endpoint.method === op.method && el.endpoint.path === op.path,
84
+ )
85
+ ) {
86
+ return false;
87
+ }
88
+ return true;
89
+ });
90
+ } while (include.length > 0 && ++trial < ctx.retry);
91
+ return exclude;
92
+ }
93
+
94
+ async function divideAndConquer<Model extends ILlmSchema.Model>(
95
+ ctx: AutoBeContext<Model>,
96
+ props: {
97
+ dict: HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IOperation>;
98
+ document: AutoBeOpenApi.IDocument;
99
+ includes: AutoBeOpenApi.IOperation[];
100
+ progress: AutoBeProgressEventBase;
101
+ promptCacheKey: string;
102
+ prerequisitesNotFound: string;
103
+ },
104
+ ): Promise<AutoBeInterfacePrerequisite[]> {
105
+ const pointer: IPointer<AutoBeInterfacePrerequisite[] | null> = {
106
+ value: null,
107
+ };
108
+
109
+ try {
110
+ const { tokenUsage } = await ctx.conversate({
111
+ source: "interfacePrerequisites",
112
+ controller: createController({
113
+ model: ctx.model,
114
+ document: props.document,
115
+ dict: props.dict,
116
+ includes: props.includes,
117
+ prerequisitesNotFound: props.prerequisitesNotFound,
118
+ build: (next) => {
119
+ pointer.value = next;
120
+ },
121
+ }),
122
+ histories: transformInterfacePrerequisitesHistories(
123
+ props.document,
124
+ props.includes,
125
+ ),
126
+ enforceFunctionCall: true,
127
+ promptCacheKey: props.promptCacheKey,
128
+ message: "Create prerequisite for the given operations",
129
+ });
130
+ if (pointer.value === null) return [];
131
+
132
+ props.progress.completed += pointer.value.length;
133
+ ctx.dispatch({
134
+ type: "interfacePrerequisites",
135
+ id: v7(),
136
+ created_at: new Date().toISOString(),
137
+ tokenUsage,
138
+ operations: pointer.value,
139
+ total: props.progress.total,
140
+ completed: props.progress.completed,
141
+ step: ctx.state().prisma?.step ?? 0,
142
+ });
143
+ return pointer.value;
144
+ } catch {
145
+ props.progress.completed += props.includes.length;
146
+ return [];
147
+ }
148
+ }
149
+
150
+ function createController<Model extends ILlmSchema.Model>(props: {
151
+ model: Model;
152
+ document: AutoBeOpenApi.IDocument;
153
+ dict: HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IOperation>;
154
+ includes: AutoBeOpenApi.IOperation[];
155
+ prerequisitesNotFound: string;
156
+ build: (next: AutoBeInterfacePrerequisite[]) => void;
157
+ }): IAgenticaController.IClass<Model> {
158
+ assertSchemaModel(props.model);
159
+
160
+ const validate = (
161
+ next: unknown,
162
+ ): IValidation<IAutoBeInterfacePrerequisitesApplication.IProps> => {
163
+ const result: IValidation<IAutoBeInterfacePrerequisitesApplication.IProps> =
164
+ typia.validate<IAutoBeInterfacePrerequisitesApplication.IProps>(next);
165
+ if (result.success === false) return result;
166
+
167
+ const operations: AutoBeInterfacePrerequisite[] = result.data.operations;
168
+ const filteredOperations: AutoBeInterfacePrerequisite[] = [];
169
+ const errors: IValidation.IError[] = [];
170
+
171
+ props.includes.forEach((el) => {
172
+ // Find the matched operation in the includes
173
+ const matched: AutoBeInterfacePrerequisite | undefined = operations.find(
174
+ (op) =>
175
+ op.endpoint.method === el.method && op.endpoint.path === el.path,
176
+ );
177
+
178
+ // Remove duplicate operations in Prerequisites
179
+ if (matched) {
180
+ const prerequisites: Map<string, AutoBeOpenApi.IPrerequisite> =
181
+ new Map();
182
+ matched.prerequisites.forEach((op) => {
183
+ if (
184
+ prerequisites.get(op.endpoint.method + op.endpoint.path) !==
185
+ undefined
186
+ ) {
187
+ return;
188
+ }
189
+ prerequisites.set(op.endpoint.method + op.endpoint.path, op);
190
+ });
191
+ matched.prerequisites = Array.from(prerequisites.values());
192
+ filteredOperations.push(matched);
193
+ }
194
+ });
195
+
196
+ filteredOperations.forEach((op, i) => {
197
+ op.prerequisites.forEach((p, j) => {
198
+ if (props.dict.has(p.endpoint) === false) {
199
+ errors.push({
200
+ value: p.endpoint,
201
+ path: `$input.operations[${i}].prerequisites[${j}].endpoint`,
202
+ expected: "AutoBeOpenApi.IEndpoint",
203
+ description: props.prerequisitesNotFound,
204
+ });
205
+ }
206
+
207
+ if (
208
+ p.endpoint.method === op.endpoint.method &&
209
+ p.endpoint.path === op.endpoint.path
210
+ ) {
211
+ errors.push({
212
+ value: p.endpoint,
213
+ path: `$input.operations[${i}].prerequisites[${j}].endpoint`,
214
+ expected: "AutoBeOpenApi.IEndpoint",
215
+ description: "Self-reference is not allowed.",
216
+ });
217
+ }
218
+ });
219
+ });
220
+
221
+ return errors.length === 0
222
+ ? {
223
+ ...result,
224
+ data: {
225
+ ...result.data,
226
+ operations: filteredOperations,
227
+ },
228
+ }
229
+ : {
230
+ success: false,
231
+ data: {
232
+ ...result.data,
233
+ operations: filteredOperations,
234
+ },
235
+ errors,
236
+ };
237
+ };
238
+
239
+ const application: ILlmApplication<Model> = collection[
240
+ props.model === "chatgpt" ? "chatgpt" : "claude"
241
+ ](
242
+ validate,
243
+ ) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
244
+
245
+ return {
246
+ protocol: "class",
247
+ name: "interface",
248
+ application,
249
+ execute: {
250
+ makePrerequisite: (next) => {
251
+ props.build(next.operations);
252
+ },
253
+ } satisfies IAutoBeInterfacePrerequisitesApplication,
254
+ };
255
+ }
256
+
257
+ const collection = {
258
+ chatgpt: (validate: Validator) =>
259
+ typia.llm.application<IAutoBeInterfacePrerequisitesApplication, "chatgpt">({
260
+ validate: {
261
+ makePrerequisite: validate,
262
+ },
263
+ }),
264
+ claude: (validate: Validator) =>
265
+ typia.llm.application<IAutoBeInterfacePrerequisitesApplication, "claude">({
266
+ validate: {
267
+ makePrerequisite: validate,
268
+ },
269
+ }),
270
+ };
271
+
272
+ type Validator = (
273
+ input: unknown,
274
+ ) => IValidation<IAutoBeInterfacePrerequisitesApplication.IProps>;
@@ -27,15 +27,18 @@ export async function orchestrateInterfaceSchemas<
27
27
  Model extends ILlmSchema.Model,
28
28
  >(
29
29
  ctx: AutoBeContext<Model>,
30
- operations: AutoBeOpenApi.IOperation[],
31
- capacity: number = AutoBeConfigConstant.INTERFACE_CAPACITY,
30
+ props: {
31
+ operations: AutoBeOpenApi.IOperation[];
32
+ instruction: string;
33
+ capacity?: number;
34
+ },
32
35
  ): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
33
36
  // fix operation type names
34
- JsonSchemaNamingConvention.operations(operations);
37
+ JsonSchemaNamingConvention.operations(props.operations);
35
38
 
36
39
  // gather type names
37
40
  const typeNames: Set<string> = new Set();
38
- for (const op of operations) {
41
+ for (const op of props.operations) {
39
42
  if (op.requestBody !== null) typeNames.add(op.requestBody.typeName);
40
43
  if (op.responseBody !== null) typeNames.add(op.responseBody.typeName);
41
44
  }
@@ -45,7 +48,7 @@ export async function orchestrateInterfaceSchemas<
45
48
  // divide and conquer
46
49
  const matrix: string[][] = divideArray({
47
50
  array: Array.from(typeNames),
48
- capacity,
51
+ capacity: props.capacity ?? AutoBeConfigConstant.INTERFACE_CAPACITY,
49
52
  });
50
53
  const progress: AutoBeProgressEventBase = {
51
54
  total: typeNames.size,
@@ -57,39 +60,48 @@ export async function orchestrateInterfaceSchemas<
57
60
  for (const y of await executeCachedBatch(
58
61
  matrix.map((it) => async (promptCacheKey) => {
59
62
  const row: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
60
- await divideAndConquer(ctx, operations, it, progress, promptCacheKey);
63
+ await divideAndConquer(ctx, {
64
+ instruction: props.instruction,
65
+ operations: props.operations,
66
+ typeNames: it,
67
+ progress,
68
+ promptCacheKey,
69
+ });
61
70
  return row;
62
71
  }),
63
72
  )) {
64
- JsonSchemaNamingConvention.schemas(operations, x, y);
73
+ JsonSchemaNamingConvention.schemas(props.operations, x, y);
65
74
  Object.assign(x, y);
66
75
  }
67
76
  Object.assign(x, presets);
68
- JsonSchemaNamingConvention.schemas(operations, x);
77
+ JsonSchemaNamingConvention.schemas(props.operations, x);
69
78
  JsonSchemaFactory.authorize(x);
70
79
  return x;
71
80
  }
72
81
 
73
82
  async function divideAndConquer<Model extends ILlmSchema.Model>(
74
83
  ctx: AutoBeContext<Model>,
75
- operations: AutoBeOpenApi.IOperation[],
76
- typeNames: string[],
77
- progress: AutoBeProgressEventBase,
78
- promptCacheKey: string,
84
+ props: {
85
+ operations: AutoBeOpenApi.IOperation[];
86
+ typeNames: string[];
87
+ progress: AutoBeProgressEventBase;
88
+ promptCacheKey: string;
89
+ instruction: string;
90
+ },
79
91
  ): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
80
- const remained: Set<string> = new Set(typeNames);
92
+ const remained: Set<string> = new Set(props.typeNames);
81
93
  const schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {};
82
94
  for (let i: number = 0; i < ctx.retry; ++i) {
83
95
  if (remained.size === 0) break;
84
96
  const newbie: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
85
- await process(
86
- ctx,
87
- operations,
88
- schemas,
97
+ await process(ctx, {
98
+ instruction: props.instruction,
99
+ operations: props.operations,
100
+ promptCacheKey: props.promptCacheKey,
101
+ progress: props.progress,
102
+ oldbie: schemas,
89
103
  remained,
90
- progress,
91
- promptCacheKey,
92
- );
104
+ });
93
105
  for (const key of Object.keys(newbie)) {
94
106
  schemas[key] = newbie[key];
95
107
  remained.delete(key);
@@ -100,13 +112,16 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
100
112
 
101
113
  async function process<Model extends ILlmSchema.Model>(
102
114
  ctx: AutoBeContext<Model>,
103
- operations: AutoBeOpenApi.IOperation[],
104
- oldbie: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>,
105
- remained: Set<string>,
106
- progress: AutoBeProgressEventBase,
107
- promptCacheKey: string,
115
+ props: {
116
+ operations: AutoBeOpenApi.IOperation[];
117
+ oldbie: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
118
+ remained: Set<string>;
119
+ progress: AutoBeProgressEventBase;
120
+ promptCacheKey: string;
121
+ instruction: string;
122
+ },
108
123
  ): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
109
- const already: string[] = Object.keys(oldbie);
124
+ const already: string[] = Object.keys(props.oldbie);
110
125
  const pointer: IPointer<Record<
111
126
  string,
112
127
  AutoBeOpenApi.IJsonSchemaDescriptive
@@ -115,7 +130,11 @@ async function process<Model extends ILlmSchema.Model>(
115
130
  };
116
131
  const { tokenUsage } = await ctx.conversate({
117
132
  source: "interfaceSchemas",
118
- histories: transformInterfaceSchemaHistories(ctx.state(), operations),
133
+ histories: transformInterfaceSchemaHistories({
134
+ state: ctx.state(),
135
+ operations: props.operations,
136
+ instruction: props.instruction,
137
+ }),
119
138
  controller: createController({
120
139
  model: ctx.model,
121
140
  build: async (next) => {
@@ -125,7 +144,7 @@ async function process<Model extends ILlmSchema.Model>(
125
144
  pointer,
126
145
  }),
127
146
  enforceFunctionCall: true,
128
- promptCacheKey,
147
+ promptCacheKey: props.promptCacheKey,
129
148
  message: StringUtil.trim`
130
149
  Make type components please.
131
150
 
@@ -134,7 +153,7 @@ async function process<Model extends ILlmSchema.Model>(
134
153
  types are required during making the components, please make them
135
154
  too.
136
155
 
137
- ${Array.from(remained)
156
+ ${Array.from(props.remained)
138
157
  .map((k) => ` - \`${k}\``)
139
158
  .join("\n")}${
140
159
  already.length !== 0
@@ -161,9 +180,9 @@ async function process<Model extends ILlmSchema.Model>(
161
180
  id: v7(),
162
181
  schemas,
163
182
  tokenUsage,
164
- completed: (progress.completed += Object.keys(schemas).length),
165
- total: (progress.total += Object.keys(schemas).filter(
166
- (k) => remained.has(k) === false,
183
+ completed: (props.progress.completed += Object.keys(schemas).length),
184
+ total: (props.progress.total += Object.keys(schemas).filter(
185
+ (k) => props.remained.has(k) === false,
167
186
  ).length),
168
187
  step: ctx.state().prisma?.step ?? 0,
169
188
  created_at: new Date().toISOString(),
@@ -186,7 +205,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
186
205
  const validate = (
187
206
  next: unknown,
188
207
  ): IValidation<IAutoBeInterfaceSchemaApplication.IProps> => {
189
- JsonSchemaFactory.fix("schemas", next);
208
+ JsonSchemaFactory.fixPage("schemas", next);
190
209
 
191
210
  const result: IValidation<IAutoBeInterfaceSchemaApplication.IProps> =
192
211
  typia.validate<IAutoBeInterfaceSchemaApplication.IProps>(next);
@@ -140,7 +140,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
140
140
  const validate = (
141
141
  next: unknown,
142
142
  ): IValidation<IAutoBeInterfaceSchemasReviewApplication.IProps> => {
143
- JsonSchemaFactory.fix("content", next);
143
+ JsonSchemaFactory.fixPage("content", next);
144
144
 
145
145
  const result: IValidation<IAutoBeInterfaceSchemasReviewApplication.IProps> =
146
146
  typia.validate<IAutoBeInterfaceSchemasReviewApplication.IProps>(next);
@@ -20,45 +20,6 @@ export interface IAutoBeInterfaceComplementApplication {
20
20
  }
21
21
  export namespace IAutoBeInterfaceComplementApplication {
22
22
  export interface IProps {
23
- /**
24
- * TypeScript draft code for complement schema definitions.
25
- *
26
- * This property contains TypeScript interface definitions for missing schema
27
- * types that were referenced but not defined in the initial schema generation.
28
- * Similar to the main schema draft, this serves as a preliminary TypeScript
29
- * representation before converting to JSON Schema format.
30
- *
31
- * The draft helps ensure that complementary schemas maintain consistency with
32
- * the existing type system and follow the same conventions as the primary schemas.
33
- *
34
- * This draft typically includes:
35
- * - Missing entity interfaces referenced via $ref
36
- * - Nested object types used within other schemas
37
- * - Shared utility types or enumerations
38
- * - Any transitively referenced types
39
- *
40
- * The final schemas in the `schemas` property should be validated against and
41
- * derived from this TypeScript draft to ensure type safety and consistency
42
- * across the entire API specification.
43
- *
44
- * Example complement draft:
45
- * ```typescript
46
- * interface IUserProfile {
47
- * id: string;
48
- * userId: string;
49
- * displayName: string;
50
- * avatarUrl?: string;
51
- * }
52
- *
53
- * interface IAddress {
54
- * street: string;
55
- * city: string;
56
- * postalCode: string;
57
- * }
58
- * ```
59
- */
60
- draft: string;
61
-
62
23
  /**
63
24
  * A collection of missing schema definitions that need to be added to the
64
25
  * OpenAPI document's `components.schemas` section.
@@ -94,18 +94,14 @@ export namespace IAutoBeInterfaceGroupApplication {
94
94
  name: string & tags.MinLength<1>;
95
95
 
96
96
  /**
97
- * Comprehensive description of the group's scope, schema foundation, and
98
- * purpose.
97
+ * Concise description of the group's core purpose.
99
98
  *
100
- * **Required Content:**
99
+ * **Requirements:**
100
+ * - Keep it brief and focused (50-200 characters)
101
+ * - State the main purpose and key entities
102
+ * - Avoid detailed explanations or mappings
101
103
  *
102
- * 1. Schema Foundation: Identify the Prisma schema elements defining this
103
- * group
104
- * 2. Database Entities: List specific tables and entities from the schema
105
- * 3. Functional Scope: Detail operations and workflows for schema entities
106
- * 4. Schema Relationships: Describe table relationships and dependencies
107
- * 5. Key Operations: Outline main operation types (CRUD, business processes)
108
- * 6. Requirements Mapping: Explain how requirements map to schema entities
104
+ * Example: "Handles shopping-related entities and operations"
109
105
  */
110
106
  description: string & tags.MinLength<1>;
111
107
  }
@@ -0,0 +1,58 @@
1
+ import { AutoBeOpenApi } from "@autobe/interface";
2
+
3
+ /**
4
+ * Interface Prerequisite Agent application for analyzing and generating API
5
+ * operation dependencies.
6
+ *
7
+ * Analyzes Target Operations to determine which Available API Operations must
8
+ * be executed as prerequisites based on resource creation dependencies and
9
+ * existence validations.
10
+ */
11
+ export interface IAutoBeInterfacePrerequisitesApplication {
12
+ /**
13
+ * Generate prerequisites for the provided operations.
14
+ *
15
+ * Analyzes each operation's dependencies and returns the complete list with
16
+ * their required prerequisite chains based on resource relationships.
17
+ */
18
+ makePrerequisite(
19
+ props: IAutoBeInterfacePrerequisitesApplication.IProps,
20
+ ): void;
21
+ }
22
+
23
+ export namespace IAutoBeInterfacePrerequisitesApplication {
24
+ export interface IProps {
25
+ /**
26
+ * Target operations requiring prerequisite analysis.
27
+ *
28
+ * Each operation will be analyzed for dependency requirements and returned
29
+ * with appropriate prerequisites from Available API Operations.
30
+ */
31
+ operations: IOperation[];
32
+ }
33
+
34
+ /**
35
+ * Operation with its analyzed prerequisite dependencies.
36
+ *
37
+ * Represents a single API operation and its complete prerequisite chain
38
+ * needed for successful execution.
39
+ */
40
+ export interface IOperation {
41
+ /**
42
+ * The API endpoint being analyzed.
43
+ *
44
+ * Identifies the specific operation (method + path) that needs
45
+ * prerequisites.
46
+ */
47
+ endpoint: AutoBeOpenApi.IEndpoint;
48
+
49
+ /**
50
+ * Required prerequisite operations.
51
+ *
52
+ * List of API operations that must be successfully executed before this
53
+ * operation can be performed. Based on resource creation dependencies and
54
+ * existence validations from the analysis.
55
+ */
56
+ prerequisites: AutoBeOpenApi.IPrerequisite[];
57
+ }
58
+ }
@@ -24,40 +24,6 @@ export interface IAutoBeInterfaceSchemaApplication {
24
24
  }
25
25
  export namespace IAutoBeInterfaceSchemaApplication {
26
26
  export interface IProps {
27
- /**
28
- * TypeScript draft code for schema definitions.
29
- *
30
- * This property contains TypeScript interface definitions that serve as a
31
- * preliminary draft before generating the final JSON schema components.
32
- * The draft allows for initial design and validation of the schema structure
33
- * using TypeScript's type system before converting to OpenAPI/JSON Schema format.
34
- *
35
- * The draft typically includes:
36
- * - Entity interfaces matching the Prisma models
37
- * - Operation-specific variants (ICreate, IUpdate, etc.)
38
- * - Utility types and enumerations
39
- * - Type relationships and constraints
40
- *
41
- * This TypeScript draft serves as the foundation for the subsequent schema
42
- * generation, ensuring type safety and consistency. The final schemas in the
43
- * `schemas` property should be derived from and validated against this draft.
44
- *
45
- * Example draft structure:
46
- * ```typescript
47
- * interface IUser {
48
- * id: string;
49
- * email: string;
50
- * profile: IUserProfile;
51
- * }
52
- *
53
- * namespace IUser {
54
- * interface ICreate extends Omit<IUser, "id"> {}
55
- * interface IUpdate extends Partial<ICreate> {}
56
- * }
57
- * ```
58
- */
59
- draft: string;
60
-
61
27
  /**
62
28
  * Complete set of schema components for the OpenAPI specification.
63
29
  *