@autobe/agent 0.19.1 → 0.21.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 (259) hide show
  1. package/lib/agent/src/AutoBeAgent.js +3 -2
  2. package/lib/agent/src/AutoBeAgent.js.map +1 -1
  3. package/lib/agent/src/AutoBeMockAgent.js +4 -3
  4. package/lib/agent/src/AutoBeMockAgent.js.map +1 -1
  5. package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +12 -11
  6. package/lib/agent/src/constants/AutoBeSystemPromptConstant.js.map +1 -1
  7. package/lib/agent/src/context/AutoBeContext.d.ts +3 -2
  8. package/lib/agent/src/factory/consentFunctionCall.js +3 -2
  9. package/lib/agent/src/factory/consentFunctionCall.js.map +1 -1
  10. package/lib/agent/src/factory/createAutoBeContext.js +11 -6
  11. package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
  12. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.d.ts +6 -0
  13. package/lib/agent/src/orchestrate/analyze/histories/{transformAnalyzeReviewerHistories.js → transformAnalyzeReviewHistories.js} +24 -29
  14. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -0
  15. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +12 -9
  16. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  17. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +31 -29
  18. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  19. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js +19 -5
  20. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  21. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +7 -1
  22. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +9 -6
  23. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
  24. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +11 -9
  25. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  26. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +6 -4
  27. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +5 -1
  28. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  29. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js +45 -46
  30. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
  31. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +13 -13
  32. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  33. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +31 -30
  34. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  35. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +23 -22
  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/transformInterfaceOperationHistories.js +27 -26
  42. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  43. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +13 -12
  44. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  45. package/lib/agent/src/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js +4 -4
  46. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +11 -10
  47. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  48. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +32 -31
  49. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  50. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +3 -1
  51. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
  52. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +28 -24
  53. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  54. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +2 -0
  55. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  56. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js +11 -5
  57. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  58. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
  59. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +365 -0
  60. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -0
  61. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js +2 -0
  62. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  63. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +80 -54
  64. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  65. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +1635 -1180
  66. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  67. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +30 -24
  68. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  69. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +2 -5
  70. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +178 -0
  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 +38 -0
  76. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +78 -0
  77. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +54 -54
  78. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  79. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +18 -29
  80. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
  81. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +37 -34
  82. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  83. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +38 -25
  84. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  85. package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js +3 -1
  86. package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  87. package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js +2 -0
  88. package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  89. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +3 -0
  90. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  91. package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js +19 -9
  92. package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
  93. package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js +28 -21
  94. package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  95. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +24 -21
  96. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
  97. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +58 -56
  98. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  99. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +17 -13
  100. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  101. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +12 -3
  102. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
  103. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +35 -30
  104. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  105. package/lib/{orchestrate/realize/internal/compile.d.ts → agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts} +1 -1
  106. package/lib/agent/src/orchestrate/realize/internal/{compile.js → compileRealizeFiles.js} +6 -6
  107. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -0
  108. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +26 -12
  109. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
  110. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +9 -3
  111. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  112. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +3 -1
  113. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  114. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +2 -6
  115. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +12 -8
  116. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  117. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +0 -66
  118. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js +2 -2
  119. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
  120. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +3 -6
  121. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +25 -21
  122. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  123. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +2 -2
  124. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +7 -2
  125. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js +13 -10
  126. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
  127. package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js +1 -1
  128. package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
  129. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.d.ts +3 -1
  130. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +44 -27
  131. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  132. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +63 -60
  133. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  134. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
  135. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +118 -96
  136. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  137. package/lib/agent/src/orchestrate/test/orchestrateTest.js +6 -5
  138. package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
  139. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +17 -8
  140. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  141. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +30 -18
  142. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  143. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +18 -18
  144. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  145. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +2 -2
  146. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
  147. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +2 -2
  148. package/lib/agent/src/utils/executeCachedBatch.d.ts +1 -0
  149. package/lib/agent/src/utils/executeCachedBatch.js +23 -0
  150. package/lib/agent/src/utils/executeCachedBatch.js.map +1 -0
  151. package/lib/constants/AutoBeSystemPromptConstant.d.ts +12 -11
  152. package/lib/context/AutoBeContext.d.ts +3 -2
  153. package/lib/index.mjs +3265 -1702
  154. package/lib/index.mjs.map +1 -1
  155. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.d.ts +6 -0
  156. package/lib/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +7 -1
  157. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +6 -4
  158. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
  159. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
  160. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +2 -5
  161. package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
  162. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +38 -0
  163. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +78 -0
  164. package/lib/{agent/src/orchestrate/realize/internal/compile.d.ts → orchestrate/realize/internal/compileRealizeFiles.d.ts} +1 -1
  165. package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +2 -6
  166. package/lib/orchestrate/realize/orchestrateRealizeScenario.d.ts +0 -66
  167. package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +3 -6
  168. package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +2 -2
  169. package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +7 -2
  170. package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +3 -1
  171. package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
  172. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +2 -2
  173. package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
  174. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +2 -2
  175. package/lib/utils/executeCachedBatch.d.ts +1 -0
  176. package/package.json +7 -7
  177. package/src/AutoBeAgent.ts +4 -3
  178. package/src/AutoBeMockAgent.ts +5 -4
  179. package/src/constants/AutoBeSystemPromptConstant.ts +12 -11
  180. package/src/context/AutoBeContext.ts +3 -0
  181. package/src/factory/consentFunctionCall.ts +4 -3
  182. package/src/factory/createAutoBeContext.ts +11 -7
  183. package/src/orchestrate/analyze/histories/{transformAnalyzeReviewerHistories.ts → transformAnalyzeReviewHistories.ts} +23 -30
  184. package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +13 -10
  185. package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +60 -61
  186. package/src/orchestrate/analyze/orchestrateAnalyze.ts +20 -13
  187. package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +20 -9
  188. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +13 -11
  189. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +10 -5
  190. package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +47 -48
  191. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +14 -14
  192. package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +31 -30
  193. package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +20 -19
  194. package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +39 -0
  195. package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +3 -3
  196. package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +23 -22
  197. package/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.ts +12 -11
  198. package/src/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.ts +5 -5
  199. package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +11 -10
  200. package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +31 -30
  201. package/src/orchestrate/interface/orchestrateInterface.ts +4 -2
  202. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +36 -29
  203. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +2 -0
  204. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +18 -10
  205. package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +95 -0
  206. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +2 -0
  207. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +53 -50
  208. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +120 -10
  209. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +47 -23
  210. package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +85 -1
  211. package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.ts +65 -0
  212. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +39 -0
  213. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +82 -1
  214. package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +57 -55
  215. package/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.ts +19 -30
  216. package/src/orchestrate/prisma/histories/transformPrismaReviewHistories.ts +38 -35
  217. package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +36 -23
  218. package/src/orchestrate/prisma/orchestratePrisma.ts +4 -2
  219. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +2 -0
  220. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +3 -0
  221. package/src/orchestrate/prisma/orchestratePrismaReview.ts +26 -13
  222. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +25 -17
  223. package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +24 -21
  224. package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +42 -40
  225. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +17 -13
  226. package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +14 -5
  227. package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +35 -30
  228. package/src/orchestrate/realize/internal/{compile.ts → compileRealizeFiles.ts} +15 -11
  229. package/src/orchestrate/realize/orchestrateRealize.ts +59 -40
  230. package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +19 -10
  231. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +3 -0
  232. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +10 -10
  233. package/src/orchestrate/realize/orchestrateRealizeScenario.ts +7 -77
  234. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +24 -23
  235. package/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.ts +6 -2
  236. package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +10 -5
  237. package/src/orchestrate/test/compile/completeTestCode.ts +17 -13
  238. package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +2 -0
  239. package/src/orchestrate/test/experimental/transformTestCorrectHistories.ast +4 -4
  240. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +50 -37
  241. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +62 -57
  242. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +27 -7
  243. package/src/orchestrate/test/orchestrateTest.ts +7 -9
  244. package/src/orchestrate/test/orchestrateTestCorrect.ts +39 -25
  245. package/src/orchestrate/test/orchestrateTestScenario.ts +28 -21
  246. package/src/orchestrate/test/orchestrateTestWrite.ts +17 -18
  247. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +3 -3
  248. package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +28 -1
  249. package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +2 -2
  250. package/src/utils/executeCachedBatch.ts +15 -0
  251. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +0 -6
  252. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.js.map +0 -1
  253. package/lib/agent/src/orchestrate/realize/internal/compile.js.map +0 -1
  254. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
  255. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js +0 -74
  256. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js.map +0 -1
  257. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +0 -6
  258. package/lib/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
  259. package/src/orchestrate/test/histories/transformTestHistories.ts +0 -77
@@ -1,6 +1,7 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { AutoBeOpenApi } from "@autobe/interface";
3
- import { v4 } from "uuid";
3
+ import { StringUtil } from "@autobe/utils";
4
+ import { v7 } from "uuid";
4
5
 
5
6
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
6
7
  import { AutoBeState } from "../../../context/AutoBeState";
@@ -19,51 +20,51 @@ export const transformInterfaceSchemasReviewHistories = (
19
20
  return [
20
21
  {
21
22
  type: "systemMessage",
22
- id: v4(),
23
+ id: v7(),
23
24
  created_at: new Date().toISOString(),
24
25
  text: AutoBeSystemPromptConstant.INTERFACE_SCHEMA,
25
26
  },
26
27
  ...transformInterfaceAssetHistories(state),
27
28
  {
28
29
  type: "systemMessage",
29
- id: v4(),
30
+ id: v7(),
30
31
  created_at: new Date().toISOString(),
31
32
  text: AutoBeSystemPromptConstant.INTERFACE_SCHEMA_REVIEW,
32
33
  },
33
34
  {
34
35
  type: "assistantMessage",
35
- id: v4(),
36
+ id: v7(),
36
37
  created_at: new Date().toISOString(),
37
- text: [
38
- "The Schema Agent has generated schemas for the following API operations.",
39
- "These operations define what endpoints exist and what request/response types they use:",
40
- "",
41
- "```json",
42
- JSON.stringify(operations),
43
- "```",
44
- "",
45
- "All schema types referenced in these operations (in requestBody and responses) must exist in the schemas.",
46
- ].join("\n"),
38
+ text: StringUtil.trim`
39
+ The Schema Agent has generated schemas for the following API operations.
40
+ These operations define what endpoints exist and what request/response types they use:
41
+
42
+ \`\`\`json
43
+ ${JSON.stringify(operations)}
44
+ \`\`\`
45
+
46
+ All schema types referenced in these operations (in requestBody and responses) must exist in the schemas.
47
+ `,
47
48
  },
48
49
  {
49
- id: v4(),
50
+ id: v7(),
50
51
  type: "assistantMessage",
51
52
  created_at: new Date().toISOString(),
52
- text: [
53
- "Here are the schemas generated by the Schema Agent that need your review:",
54
- "",
55
- "```json",
56
- JSON.stringify(schemaDescriptive),
57
- "```",
58
- "",
59
- "Please review these schemas for:",
60
- "1. Security vulnerabilities (passwords in responses, actor IDs in requests)",
61
- "2. Missing entities or variants referenced by the operations",
62
- "3. Type accuracy and format specifications",
63
- "4. Alignment with Prisma schema and business requirements",
64
- "",
65
- "Fix all critical issues and return the enhanced schemas in the content field.",
66
- ].join("\n"),
53
+ text: StringUtil.trim`
54
+ Here are the schemas generated by the Schema Agent that need your review:
55
+
56
+ \`\`\`json
57
+ ${JSON.stringify(schemaDescriptive)}
58
+ \`\`\`
59
+
60
+ Please review these schemas for:
61
+ 1. Security vulnerabilities (passwords in responses, actor IDs in requests)
62
+ 2. Missing entities or variants referenced by the operations
63
+ 3. Type accuracy and format specifications
64
+ 4. Alignment with Prisma schema and business requirements
65
+
66
+ Fix all critical issues and return the enhanced schemas in the content field.
67
+ `,
67
68
  },
68
69
  ];
69
70
  };
@@ -9,7 +9,7 @@ import {
9
9
  import { AutoBeEndpointComparator } from "@autobe/utils";
10
10
  import { ILlmSchema } from "@samchon/openapi";
11
11
  import { HashMap, Pair } from "tstl";
12
- import { v4 } from "uuid";
12
+ import { v7 } from "uuid";
13
13
 
14
14
  import { AutoBeContext } from "../../context/AutoBeContext";
15
15
  import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
@@ -35,13 +35,14 @@ export const orchestrateInterface =
35
35
  if (predicate !== null)
36
36
  return ctx.assistantMessage({
37
37
  type: "assistantMessage",
38
- id: v4(),
38
+ id: v7(),
39
39
  created_at: start.toISOString(),
40
40
  text: predicate,
41
41
  completed_at: new Date().toISOString(),
42
42
  });
43
43
  ctx.dispatch({
44
44
  type: "interfaceStart",
45
+ id: v7(),
45
46
  created_at: start.toISOString(),
46
47
  reason: props.reason,
47
48
  step: ctx.state().analyze?.step ?? 0,
@@ -101,6 +102,7 @@ export const orchestrateInterface =
101
102
  // DO COMPILE
102
103
  return ctx.dispatch({
103
104
  type: "interfaceComplete",
105
+ id: v7(),
104
106
  document,
105
107
  authorizations,
106
108
  created_at: new Date().toISOString(),
@@ -10,9 +10,11 @@ import { StringUtil } from "@autobe/utils";
10
10
  import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
11
11
  import { IPointer } from "tstl";
12
12
  import typia from "typia";
13
+ import { v7 } from "uuid";
13
14
 
14
15
  import { AutoBeContext } from "../../context/AutoBeContext";
15
16
  import { assertSchemaModel } from "../../context/assertSchemaModel";
17
+ import { executeCachedBatch } from "../../utils/executeCachedBatch";
16
18
  import { transformInterfaceAuthorizationsHistories } from "./histories/transformInterfaceAuthorizationsHistories";
17
19
  import { IAutoBeInterfaceAuthorizationsApplication } from "./structures/IAutoBeInterfaceAuthorizationsApplication";
18
20
 
@@ -24,20 +26,22 @@ export async function orchestrateInterfaceAuthorizations<
24
26
  total: roles.length,
25
27
  completed: 0,
26
28
  };
27
- const authorizations: AutoBeInterfaceAuthorization[] = await Promise.all(
28
- roles.map(async (role) => {
29
- const event: AutoBeInterfaceAuthorizationEvent = await process(
30
- ctx,
31
- role,
32
- progress,
33
- );
34
- ctx.dispatch(event);
35
- return {
36
- role: role.name,
37
- operations: event.operations,
38
- };
39
- }),
40
- );
29
+ const authorizations: AutoBeInterfaceAuthorization[] =
30
+ await executeCachedBatch(
31
+ roles.map((role) => async (promptCacheKey) => {
32
+ const event: AutoBeInterfaceAuthorizationEvent = await process(
33
+ ctx,
34
+ role,
35
+ progress,
36
+ promptCacheKey,
37
+ );
38
+ ctx.dispatch(event);
39
+ return {
40
+ role: role.name,
41
+ operations: event.operations,
42
+ };
43
+ }),
44
+ );
41
45
 
42
46
  return authorizations;
43
47
  }
@@ -46,6 +50,7 @@ async function process<Model extends ILlmSchema.Model>(
46
50
  ctx: AutoBeContext<Model>,
47
51
  role: AutoBeAnalyzeRole,
48
52
  progress: AutoBeProgressEventBase,
53
+ promptCacheKey: string,
49
54
  ): Promise<AutoBeInterfaceAuthorizationEvent> {
50
55
  const pointer: IPointer<IAutoBeInterfaceAuthorizationsApplication.IProps | null> =
51
56
  {
@@ -62,6 +67,7 @@ async function process<Model extends ILlmSchema.Model>(
62
67
  },
63
68
  }),
64
69
  enforceFunctionCall: true,
70
+ promptCacheKey,
65
71
  message: "Create Authorization Operation for the given roles",
66
72
  });
67
73
  if (pointer.value === null)
@@ -69,6 +75,7 @@ async function process<Model extends ILlmSchema.Model>(
69
75
 
70
76
  return {
71
77
  type: "interfaceAuthorization",
78
+ id: v7(),
72
79
  operations: pointer.value.operations,
73
80
  completed: ++progress.completed,
74
81
  tokenUsage,
@@ -107,27 +114,27 @@ function createController<Model extends ILlmSchema.Model>(props: {
107
114
  expected:
108
115
  "Response body with I{RoleName(PascalCase)}.IAuthorized type is required",
109
116
  value: op.responseBody,
110
- description: [
111
- "Response body is required for authentication operations.",
112
- "",
113
- "The responseBody must contain description and typeName fields.",
114
- "typeName must be I{Prefix(PascalCase)}{RoleName(PascalCase)}.IAuthorized",
115
- "description must be a detailed description of the response body.",
116
- ].join("\n"),
117
+ description: StringUtil.trim`
118
+ Response body is required for authentication operations.
119
+
120
+ The responseBody must contain description and typeName fields.
121
+ typeName must be I{Prefix(PascalCase)}{RoleName(PascalCase)}.IAuthorized
122
+ description must be a detailed description of the response body.
123
+ `,
117
124
  });
118
125
  else if (!op.responseBody.typeName.endsWith(".IAuthorized"))
119
126
  errors.push({
120
127
  path: `$input.operations.${i}.responseBody.typeName`,
121
128
  expected: `Type name must be I{RoleName(PascalCase)}.IAuthorized`,
122
129
  value: op.responseBody?.typeName,
123
- description: [
124
- `Wrong response body type name: ${op.responseBody?.typeName}`,
125
- "",
126
- `For authentication operations (login, join, refresh), the response body type name must follow the convention "I{RoleName}.IAuthorized".`,
127
- ``,
128
- `This standardized naming convention ensures consistency across all authentication endpoints and clearly identifies authorization response types.`,
129
- `The Role name should be in PascalCase format (e.g., IUser.IAuthorized, IAdmin.IAuthorized, ISeller.IAuthorized).`,
130
- ].join("\n"),
130
+ description: StringUtil.trim`
131
+ Wrong response body type name: ${op.responseBody?.typeName}
132
+
133
+ For authentication operations (login, join, refresh), the response body type name must follow the convention "I{RoleName}.IAuthorized".
134
+
135
+ This standardized naming convention ensures consistency across all authentication endpoints and clearly identifies authorization response types.
136
+ The Role name should be in PascalCase format (e.g., IUser.IAuthorized, IAdmin.IAuthorized, ISeller.IAuthorized).
137
+ `,
131
138
  });
132
139
  });
133
140
 
@@ -8,6 +8,7 @@ import {
8
8
  import { OpenApiV3_1Emender } from "@samchon/openapi/lib/converters/OpenApiV3_1Emender";
9
9
  import { IPointer } from "tstl";
10
10
  import typia from "typia";
11
+ import { v7 } from "uuid";
11
12
 
12
13
  import { AutoBeContext } from "../../context/AutoBeContext";
13
14
  import { assertSchemaModel } from "../../context/assertSchemaModel";
@@ -70,6 +71,7 @@ async function step<Model extends ILlmSchema.Model>(
70
71
  );
71
72
  ctx.dispatch({
72
73
  type: "interfaceComplement",
74
+ id: v7(),
73
75
  missed,
74
76
  schemas: pointer.value,
75
77
  tokenUsage,
@@ -2,15 +2,19 @@ import { IAgenticaController } from "@agentica/core";
2
2
  import {
3
3
  AutoBeInterfaceEndpointsEvent,
4
4
  AutoBeOpenApi,
5
+ AutoBeProgressEventBase,
5
6
  } from "@autobe/interface";
6
7
  import { AutoBeInterfaceGroup } from "@autobe/interface/src/histories/contents/AutoBeInterfaceGroup";
7
8
  import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
8
9
  import { HashSet, IPointer } from "tstl";
9
10
  import typia from "typia";
11
+ import { v7 } from "uuid";
10
12
 
11
13
  import { AutoBeContext } from "../../context/AutoBeContext";
12
14
  import { assertSchemaModel } from "../../context/assertSchemaModel";
15
+ import { executeCachedBatch } from "../../utils/executeCachedBatch";
13
16
  import { transformInterfaceEndpointHistories } from "./histories/transformInterfaceEndpointHistories";
17
+ import { orchestrateInterfaceEndpointsReview } from "./orchestrateInterfaceEndpointsReview";
14
18
  import { IAutoBeInterfaceEndpointApplication } from "./structures/IAutoBeInterfaceEndpointApplication";
15
19
  import { OpenApiEndpointComparator } from "./utils/OpenApiEndpointComparator";
16
20
 
@@ -22,28 +26,35 @@ export async function orchestrateInterfaceEndpoints<
22
26
  authorizations: AutoBeOpenApi.IOperation[],
23
27
  content: string = `Make endpoints for the given assets`,
24
28
  ): Promise<AutoBeOpenApi.IEndpoint[]> {
25
- const progress: IProgress = {
29
+ const progress: AutoBeProgressEventBase = {
26
30
  total: groups.length,
27
31
  completed: 0,
28
32
  };
29
33
  const endpoints: AutoBeOpenApi.IEndpoint[] = (
30
- await Promise.all(
31
- groups.map((g) => process(ctx, g, content, progress, authorizations)),
34
+ await executeCachedBatch(
35
+ groups.map(
36
+ (g) => (promptCacheKey) =>
37
+ process(ctx, g, content, progress, authorizations, promptCacheKey),
38
+ ),
32
39
  )
33
40
  ).flat();
34
- return new HashSet(
41
+
42
+ const deduplicated: AutoBeOpenApi.IEndpoint[] = new HashSet(
35
43
  endpoints,
36
44
  OpenApiEndpointComparator.hashCode,
37
45
  OpenApiEndpointComparator.equals,
38
46
  ).toJSON();
47
+
48
+ return orchestrateInterfaceEndpointsReview(ctx, deduplicated);
39
49
  }
40
50
 
41
51
  async function process<Model extends ILlmSchema.Model>(
42
52
  ctx: AutoBeContext<Model>,
43
53
  group: AutoBeInterfaceGroup,
44
54
  message: string,
45
- progress: IProgress,
55
+ progress: AutoBeProgressEventBase,
46
56
  authorizations: AutoBeOpenApi.IOperation[],
57
+ promptCacheKey: string,
47
58
  ): Promise<AutoBeOpenApi.IEndpoint[]> {
48
59
  const start: Date = new Date();
49
60
  const pointer: IPointer<AutoBeOpenApi.IEndpoint[] | null> = {
@@ -64,12 +75,14 @@ async function process<Model extends ILlmSchema.Model>(
64
75
  },
65
76
  }),
66
77
  enforceFunctionCall: true,
78
+ promptCacheKey,
67
79
  message,
68
80
  });
69
81
  if (pointer.value === null) throw new Error("Failed to generate endpoints."); // unreachable
70
82
 
71
83
  const event: AutoBeInterfaceEndpointsEvent = {
72
84
  type: "interfaceEndpoints",
85
+ id: v7(),
73
86
  endpoints: new HashSet(
74
87
  pointer.value,
75
88
  OpenApiEndpointComparator.hashCode,
@@ -120,8 +133,3 @@ const collection = {
120
133
  deepseek: claude,
121
134
  "3.1": claude,
122
135
  };
123
-
124
- interface IProgress {
125
- total: number;
126
- completed: number;
127
- }
@@ -0,0 +1,95 @@
1
+ import { IAgenticaController } from "@agentica/core";
2
+ import { AutoBeOpenApi } from "@autobe/interface";
3
+ import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
4
+ import { IPointer } from "tstl";
5
+ import typia from "typia";
6
+ import { v7 } from "uuid";
7
+
8
+ import { AutoBeContext } from "../../context/AutoBeContext";
9
+ import { assertSchemaModel } from "../../context/assertSchemaModel";
10
+ import { transformInterfaceEndpointsReviewHistories } from "./histories/transformInterfaceEndpointsReviewHistories";
11
+ import { IAutoBeInterfaceEndpointsReviewApplication } from "./structures/IAutoBeInterfaceEndpointsReviewApplication";
12
+
13
+ export async function orchestrateInterfaceEndpointsReview<
14
+ Model extends ILlmSchema.Model,
15
+ >(
16
+ ctx: AutoBeContext<Model>,
17
+ endpoints: AutoBeOpenApi.IEndpoint[],
18
+ message: string = `Review the generated endpoints`,
19
+ ): Promise<AutoBeOpenApi.IEndpoint[]> {
20
+ const pointer: IPointer<IAutoBeInterfaceEndpointsReviewApplication.IProps | null> =
21
+ {
22
+ value: null,
23
+ };
24
+
25
+ const { tokenUsage } = await ctx.conversate({
26
+ source: "interfaceEndpointsReview",
27
+ histories: transformInterfaceEndpointsReviewHistories(
28
+ ctx.state(),
29
+ endpoints,
30
+ ),
31
+ controller: createController({
32
+ model: ctx.model,
33
+ build: (props) => {
34
+ pointer.value = props;
35
+ },
36
+ }),
37
+ enforceFunctionCall: true,
38
+ message,
39
+ });
40
+
41
+ if (pointer.value === null) {
42
+ return endpoints;
43
+ }
44
+
45
+ const response = pointer.value?.endpoints ?? [];
46
+
47
+ ctx.dispatch({
48
+ id: v7(),
49
+ type: "interfaceEndpointsReview",
50
+ endpoints,
51
+ content: response,
52
+ created_at: new Date().toISOString(),
53
+ review: pointer.value?.review,
54
+ step: ctx.state().analyze?.step ?? 0,
55
+ tokenUsage,
56
+ });
57
+
58
+ return response;
59
+ }
60
+
61
+ export function createController<Model extends ILlmSchema.Model>(props: {
62
+ model: Model;
63
+ build: (props: IAutoBeInterfaceEndpointsReviewApplication.IProps) => void;
64
+ }): IAgenticaController.IClass<Model> {
65
+ assertSchemaModel(props.model);
66
+
67
+ const application: ILlmApplication<Model> = collection[
68
+ props.model
69
+ ] satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
70
+ return {
71
+ protocol: "class",
72
+ name: "interface",
73
+ application,
74
+ execute: {
75
+ reviewEndpoints: (next) => {
76
+ props.build(next);
77
+ },
78
+ } satisfies IAutoBeInterfaceEndpointsReviewApplication,
79
+ };
80
+ }
81
+
82
+ const claude = typia.llm.application<
83
+ IAutoBeInterfaceEndpointsReviewApplication,
84
+ "claude"
85
+ >();
86
+ const collection = {
87
+ chatgpt: typia.llm.application<
88
+ IAutoBeInterfaceEndpointsReviewApplication,
89
+ "chatgpt"
90
+ >(),
91
+ claude,
92
+ llama: claude,
93
+ deepseek: claude,
94
+ "3.1": claude,
95
+ };
@@ -3,6 +3,7 @@ import { AutoBeInterfaceGroupsEvent } from "@autobe/interface";
3
3
  import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
4
4
  import { IPointer } from "tstl";
5
5
  import typia from "typia";
6
+ import { v7 } from "uuid";
6
7
 
7
8
  import { AutoBeContext } from "../../context/AutoBeContext";
8
9
  import { assertSchemaModel } from "../../context/assertSchemaModel";
@@ -34,6 +35,7 @@ export async function orchestrateInterfaceGroups<
34
35
  if (pointer.value === null) throw new Error("Failed to generate groups."); // unreachable
35
36
  return {
36
37
  type: "interfaceGroups",
38
+ id: v7(),
37
39
  created_at: start.toISOString(),
38
40
  groups: pointer.value.groups,
39
41
  tokenUsage,
@@ -2,6 +2,7 @@ import { IAgenticaController } from "@agentica/core";
2
2
  import {
3
3
  AutoBeInterfaceOperationsEvent,
4
4
  AutoBeOpenApi,
5
+ AutoBeProgressEventBase,
5
6
  } from "@autobe/interface";
6
7
  import { AutoBeEndpointComparator, StringUtil } from "@autobe/utils";
7
8
  import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
@@ -9,11 +10,13 @@ import { HashMap, HashSet, IPointer } from "tstl";
9
10
  import typia from "typia";
10
11
  import { Escaper } from "typia/lib/utils/Escaper";
11
12
  import { NamingConvention } from "typia/lib/utils/NamingConvention";
13
+ import { v7 } from "uuid";
12
14
 
13
15
  import { AutoBeContext } from "../../context/AutoBeContext";
14
16
  import { assertSchemaModel } from "../../context/assertSchemaModel";
15
17
  import { divideArray } from "../../utils/divideArray";
16
18
  import { emplaceMap } from "../../utils/emplaceMap";
19
+ import { executeCachedBatch } from "../../utils/executeCachedBatch";
17
20
  import { transformInterfaceOperationHistories } from "./histories/transformInterfaceOperationHistories";
18
21
  import { orchestrateInterfaceOperationsReview } from "./orchestrateInterfaceOperationsReview";
19
22
  import { IAutoBeInterfaceOperationApplication } from "./structures/IAutoBeInterfaceOperationApplication";
@@ -30,23 +33,23 @@ export async function orchestrateInterfaceOperations<
30
33
  array: endpoints,
31
34
  capacity,
32
35
  });
33
- const operationsProgress: IProgress = {
34
- total: endpoints.length,
35
- completed: 0,
36
- };
37
- const operationsReviewProgress: IProgress = {
38
- total: matrix.length,
39
- completed: 0,
40
- };
36
+
41
37
  return (
42
- await Promise.all(
43
- matrix.map(async (it) => {
38
+ await executeCachedBatch(
39
+ matrix.map((it) => async (promptCacheKey) => {
44
40
  const row: AutoBeOpenApi.IOperation[] = await divideAndConquer(
45
41
  ctx,
46
42
  it,
47
43
  3,
48
- operationsProgress,
49
- operationsReviewProgress,
44
+ {
45
+ total: matrix.length,
46
+ completed: 0,
47
+ },
48
+ {
49
+ total: matrix.length,
50
+ completed: 0,
51
+ },
52
+ promptCacheKey,
50
53
  );
51
54
  return row;
52
55
  }),
@@ -58,8 +61,9 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
58
61
  ctx: AutoBeContext<Model>,
59
62
  endpoints: AutoBeOpenApi.IEndpoint[],
60
63
  retry: number,
61
- operationsProgress: IProgress,
62
- operationsReviewProgress: IProgress,
64
+ operationsProgress: AutoBeProgressEventBase,
65
+ operationsReviewProgress: AutoBeProgressEventBase,
66
+ promptCacheKey: string,
63
67
  ): Promise<AutoBeOpenApi.IOperation[]> {
64
68
  const remained: HashSet<AutoBeOpenApi.IEndpoint> = new HashSet(
65
69
  endpoints,
@@ -74,7 +78,7 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
74
78
  for (let i: number = 0; i < retry; ++i) {
75
79
  if (remained.empty() === true || unique.size() >= endpoints.length) break;
76
80
  const operations: AutoBeOpenApi.IOperation[] = remained.size()
77
- ? await process(ctx, remained, operationsProgress)
81
+ ? await process(ctx, remained, operationsProgress, promptCacheKey)
78
82
  : [];
79
83
 
80
84
  for (const item of operations) {
@@ -95,7 +99,8 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
95
99
  async function process<Model extends ILlmSchema.Model>(
96
100
  ctx: AutoBeContext<Model>,
97
101
  endpoints: HashSet<AutoBeOpenApi.IEndpoint>,
98
- progress: IProgress,
102
+ progress: AutoBeProgressEventBase,
103
+ promptCacheKey: string,
99
104
  ): Promise<AutoBeOpenApi.IOperation[]> {
100
105
  const prefix: string = NamingConvention.camel(ctx.state().analyze!.prefix);
101
106
  const pointer: IPointer<AutoBeOpenApi.IOperation[] | null> = {
@@ -151,12 +156,14 @@ async function process<Model extends ILlmSchema.Model>(
151
156
  },
152
157
  }),
153
158
  enforceFunctionCall: true,
159
+ promptCacheKey,
154
160
  message: "Make API operations",
155
161
  });
156
162
  if (pointer.value === null) throw new Error("Failed to create operations."); // never be happened
157
163
 
158
164
  ctx.dispatch({
159
165
  type: "interfaceOperations",
166
+ id: v7(),
160
167
  operations: pointer.value,
161
168
  tokenUsage,
162
169
  ...progress,
@@ -218,13 +225,13 @@ function createController<Model extends ILlmSchema.Model>(props: {
218
225
  errors.push({
219
226
  path: `$input.operations[${i}].authorizationRoles[${j}]`,
220
227
  expected: `null | ${props.roles.map((str) => JSON.stringify(str)).join(" | ")}`,
221
- description: [
222
- `Role "${role}" is not defined in the roles list.`,
223
- "",
224
- "Please select one of them below, or do not define (`null`): ",
225
- "",
226
- ...props.roles.map((role) => `- ${role}`),
227
- ].join("\n"),
228
+ description: StringUtil.trim`
229
+ Role "${role}" is not defined in the roles list.
230
+
231
+ Please select one of them below, or do not define (\`null\`):
232
+
233
+ ${props.roles.map((role) => `- ${role}`).join("\n")}
234
+ `,
228
235
  value: role,
229
236
  });
230
237
  });
@@ -247,15 +254,16 @@ function createController<Model extends ILlmSchema.Model>(props: {
247
254
  path: `$input.operations[${i}].{"path"|"method"}`,
248
255
  expected: "Unique endpoint (path and method)",
249
256
  value: key,
250
- description: [
251
- `Duplicated endpoint detected (method: ${op.method}, path: ${op.path}).`,
252
- "",
253
- "The duplicated endpoints of others are located in below accessors.",
254
- "Check them, and consider which operation endpoint would be proper to modify.",
255
- ...indexes.map(
256
- (idx) => `- $input.operations.[${idx}].{"path"|"method"}`,
257
- ),
258
- ].join("\n"),
257
+ description: StringUtil.trim`
258
+ Duplicated endpoint detected (method: ${op.method}, path: ${op.path}).
259
+
260
+ The duplicated endpoints of others are located in below accessors.
261
+ Check them, and consider which operation endpoint would be proper to modify.
262
+
263
+ ${indexes
264
+ .map((idx) => `- $input.operations.[${idx}].{"path"|"method"}`)
265
+ .join("\n")}
266
+ `,
259
267
  });
260
268
  indexes.push(i);
261
269
  } else endpoints.emplace(key, [i]);
@@ -276,20 +284,20 @@ function createController<Model extends ILlmSchema.Model>(props: {
276
284
  path: `$input.operations[${i}].name`,
277
285
  expected: "Unique name in the same accessor scope.",
278
286
  value: op.name,
279
- description: [
280
- `Duplicated operation accessor detected (name: ${op.name}, accessor: ${key}).`,
281
- "",
282
- "The operation name must be unique within the parent accessor.",
283
- "In other worlds, the operation accessor determined by the name",
284
- "must be unique in the OpenAPI document.",
285
- "",
286
- "Here is the list of elements of duplicated operation names.",
287
- "Check them, and consider which operation name would be proper to modify.",
288
- "",
289
- ...indexes
287
+ description: StringUtil.trim`
288
+ Duplicated operation accessor detected (name: ${op.name}, accessor: ${key}).
289
+
290
+ The operation name must be unique within the parent accessor.
291
+ In other worlds, the operation accessor determined by the name
292
+ must be unique in the OpenAPI document.
293
+
294
+ Here is the list of elements of duplicated operation names.
295
+ Check them, and consider which operation name would be proper to modify.
296
+
297
+ ${indexes
290
298
  .map((idx) => `- ${operations[idx].name} (accessor: ${key})`)
291
- .join("\n"),
292
- ].join("\n"),
299
+ .join("\n")}
300
+ `,
293
301
  });
294
302
  }
295
303
  indexes.push(i);
@@ -335,11 +343,6 @@ const collection = {
335
343
  }),
336
344
  };
337
345
 
338
- interface IProgress {
339
- completed: number;
340
- total: number;
341
- }
342
-
343
346
  type Validator = (
344
347
  input: unknown,
345
348
  ) => IValidation<IAutoBeInterfaceOperationApplication.IProps>;