@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
+ import { StringUtil } from "@autobe/utils";
2
3
  import { NamingConvention } from "typia/lib/utils/NamingConvention";
3
- import { v4 } from "uuid";
4
+ import { v7 } from "uuid";
4
5
 
5
6
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
6
7
  import { AutoBeState } from "../../../context/AutoBeState";
@@ -17,67 +18,68 @@ export const transformPrismaComponentsHistories = (
17
18
  if (prefix) prefix = NamingConvention.snake(prefix);
18
19
  return [
19
20
  {
20
- id: v4(),
21
+ id: v7(),
21
22
  created_at: new Date().toISOString(),
22
23
  type: "systemMessage",
23
24
  text: AutoBeSystemPromptConstant.PRISMA_COMPONENT,
24
25
  },
25
26
  {
26
- id: v4(),
27
+ id: v7(),
27
28
  created_at: new Date().toISOString(),
28
29
  type: "assistantMessage",
29
- text: [
30
- "Here is the requirement analysis report.",
31
- "",
32
- "Call the provided tool function to generate Prisma DB schema",
33
- "referencing below requirement analysis report.",
34
- "",
35
- `## Requirement Analysis Report`,
36
- "",
37
- "```json",
38
- JSON.stringify(state.analyze.files),
39
- "```",
40
- "## Prefix",
41
- "",
42
- `* Prefix provided by the user: ${prefix}`,
43
- "",
44
- "The user wants all database schema (table) names to start with the prefix provided below.",
45
- "",
46
- "DO: Use the provided prefix for all table names",
47
- "DO: Place special-purpose prefixes like `mv` (for materialized views) before the given prefix",
48
- "DO NOT: Apply prefix if it is `null`",
49
- "",
50
- "## Prefix Example",
51
- "",
52
- "If the prefix is `shopping`, then table names are like:",
53
- "",
54
- "* `shopping_sales`",
55
- "* `shopping_sale_options`",
56
- "",
57
- "In cases where a table is created for performance optimization purposes (e.g., materialized views), the `mv_` prefix must come first.",
58
- "For example:",
59
- "",
60
- "* `mv_shopping_daily_stats`",
61
- "",
62
- "",
63
- state.analyze.roles.length > 0
64
- ? [
65
- "## User Role Handling",
66
- "",
67
- `The Requirement Analysis Report contains the following user roles: ${state.analyze.roles.join(", ")}.`,
68
- "",
69
- "**Do not normalize** user roles into a single table.",
70
- "Instead, create separate tables for each distinct role mentioned in the requirements.",
71
- "",
72
- "Create separate tables for each role:",
73
- "",
74
- state.analyze.roles
75
- .map((role) => `* ${prefix}_${role.name.toLowerCase()}`)
76
- .join("\n"),
77
- "",
78
- ].join("\n")
79
- : "",
80
- ].join("\n"),
30
+ text: StringUtil.trim`
31
+ Here is the requirement analysis report.
32
+
33
+ Call the provided tool function to generate Prisma DB schema
34
+ referencing below requirement analysis report.
35
+
36
+ ## Requirement Analysis Report
37
+
38
+ \`\`\`json
39
+ ${JSON.stringify(state.analyze.files)}
40
+ \`\`\`
41
+
42
+ ## Prefix
43
+
44
+ - Prefix provided by the user: ${prefix}
45
+
46
+ The user wants all database schema (table) names to start with the prefix provided below.
47
+
48
+ - DO: Use the provided prefix for all table names
49
+ - DO: Place special-purpose prefixes like \`mv\` (for materialized views) before the given prefix
50
+ - DO NOT: Apply prefix if it is \`null\`
51
+
52
+ ## Prefix Example
53
+
54
+ If the prefix is \`shopping\`, then table names are like:
55
+
56
+ - \`shopping_sales\`
57
+ - \`shopping_sale_options\`
58
+
59
+ In cases where a table is created for performance optimization purposes
60
+ (e.g., materialized views), the \`mv_\` prefix must come first. For example:
61
+
62
+ - \`mv_shopping_daily_stats\`
63
+
64
+ ${
65
+ state.analyze.roles.length > 0
66
+ ? StringUtil.trim`
67
+ ## User Role Handling
68
+
69
+ The Requirement Analysis Report contains the following user roles: ${state.analyze.roles.join(", ")}
70
+
71
+ **Do not normalize** user roles into a single table.
72
+ Instead, create separate tables for each distinct role mentioned in the requirements.
73
+
74
+ Create separate tables for each role:
75
+
76
+ ${state.analyze.roles
77
+ .map((role) => `- ${prefix}_${role.name.toLowerCase()}`)
78
+ .join("\n")}
79
+ `
80
+ : ""
81
+ }
82
+ `,
81
83
  },
82
84
  ];
83
85
  };
@@ -1,6 +1,7 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { IAutoBePrismaValidation } 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
 
@@ -11,46 +12,34 @@ export const transformPrismaCorrectHistories = (
11
12
  > => {
12
13
  return [
13
14
  {
14
- id: v4(),
15
+ id: v7(),
15
16
  created_at: new Date().toISOString(),
16
17
  type: "systemMessage",
17
18
  text: AutoBeSystemPromptConstant.PRISMA_CORRECT,
18
19
  },
19
20
  {
20
- id: v4(),
21
+ id: v7(),
21
22
  created_at: new Date().toISOString(),
22
23
  type: "assistantMessage",
23
- text: [
24
- "Here is the Prisma application data what you made:",
25
- "",
26
- "```json",
27
- JSON.stringify(result.data),
28
- "```",
29
- ].join("\n"),
24
+ text: StringUtil.trim`
25
+ Here is the Prisma application data what you made:
26
+
27
+ \`\`\`json
28
+ ${JSON.stringify(result.data)}
29
+ \`\`\`
30
+ `,
30
31
  },
31
32
  {
32
- id: v4(),
33
+ id: v7(),
33
34
  created_at: new Date().toISOString(),
34
35
  type: "assistantMessage",
35
- text: [
36
- "Below are the list of errors what you have to fix:",
37
- "",
38
- "```json",
39
- JSON.stringify(result.errors),
40
- "```",
41
- ].join("\n"),
42
- },
43
- {
44
- id: v4(),
45
- created_at: new Date().toISOString(),
46
- type: "systemMessage",
47
- text: [
48
- "Before fixing the schema files,",
49
- "study about Prisma schema language",
50
- "from the best practices and examples",
51
- "",
52
- AutoBeSystemPromptConstant.PRISMA_EXAMPLE,
53
- ].join("\n"),
36
+ text: StringUtil.trim`
37
+ Below are the list of errors what you have to fix:
38
+
39
+ \`\`\`json
40
+ ${JSON.stringify(result.errors)}
41
+ \`\`\`
42
+ `,
54
43
  },
55
44
  ];
56
45
  };
@@ -1,6 +1,7 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { AutoBePrisma } 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
 
@@ -14,53 +15,55 @@ export const transformPrismaReviewHistories = (props: {
14
15
  > => {
15
16
  return [
16
17
  {
17
- id: v4(),
18
+ id: v7(),
18
19
  created_at: new Date().toISOString(),
19
20
  type: "systemMessage",
20
21
  text: AutoBeSystemPromptConstant.PRISMA_SCHEMA,
21
22
  },
22
23
  {
23
- id: v4(),
24
+ id: v7(),
24
25
  created_at: new Date().toISOString(),
25
- type: "assistantMessage",
26
- text: [
27
- "Here is the requirement analysis report given by the user:",
28
- "",
29
- "```json",
30
- JSON.stringify(props.analysis),
31
- "```",
32
- "",
33
- "Reading the requirement analysis report, you AI made below AST definition for the database design:",
34
- "",
35
- "```json",
36
- JSON.stringify(props.application),
37
- "```",
38
- "",
39
- "And here are the Prisma schema files generated (compiled) from the above AST:",
40
- "",
41
- "```prisma",
42
- JSON.stringify(props.schemas),
43
- "```",
44
- ].join("\n"),
26
+ type: "systemMessage",
27
+ text: AutoBeSystemPromptConstant.PRISMA_REVIEW,
45
28
  },
46
29
  {
47
- id: v4(),
30
+ id: v7(),
48
31
  created_at: new Date().toISOString(),
49
- type: "systemMessage",
50
- text: AutoBeSystemPromptConstant.PRISMA_REVIEW,
32
+ type: "assistantMessage",
33
+ text: StringUtil.trim`
34
+ Here is the requirement analysis report given by the user:
35
+
36
+ \`\`\`json
37
+ ${JSON.stringify(props.analysis)}
38
+ \`\`\`
39
+
40
+ Reading the requirement analysis report, you AI made
41
+ below AST definition for the database design:
42
+
43
+ \`\`\`json
44
+ ${JSON.stringify(props.application)}
45
+ \`\`\`
46
+
47
+ And here are the Prisma schema files generated (compiled)
48
+ from the above AST:
49
+
50
+ \`\`\`json
51
+ ${JSON.stringify(props.schemas)}
52
+ \`\`\`
53
+ `,
51
54
  },
52
55
  {
53
- id: v4(),
56
+ id: v7(),
54
57
  created_at: new Date().toISOString(),
55
58
  type: "assistantMessage",
56
- text: [
57
- `Now, please review the tables in the "${props.component.namespace}" namespace.`,
58
- "",
59
- "Focus your review exclusively on these tables.",
60
- "",
61
- "**Tables in this namespace:**",
62
- ...props.component.tables.map((table) => `- ${table}`),
63
- ].join("\n"),
59
+ text: StringUtil.trim`
60
+ Now, please review the tables in the "${props.component.namespace}" namespace.
61
+
62
+ Focus your review exclusively on these tables.
63
+
64
+ **Tables in this namespace:**
65
+ ${props.component.tables.map((table) => `- ${table}`).join("\n")}
66
+ `,
64
67
  },
65
68
  ];
66
69
  };
@@ -1,6 +1,7 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { AutoBePrisma } 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
 
@@ -13,42 +14,54 @@ export const transformPrismaSchemaHistories = (
13
14
  > => {
14
15
  return [
15
16
  {
16
- id: v4(),
17
+ id: v7(),
17
18
  created_at: new Date().toISOString(),
18
19
  type: "systemMessage",
19
20
  text: AutoBeSystemPromptConstant.PRISMA_SCHEMA,
20
21
  },
21
22
  {
22
- id: v4(),
23
+ id: v7(),
23
24
  created_at: new Date().toISOString(),
24
25
  type: "assistantMessage",
25
- text: [
26
- "Here is the input data for generating Prisma DB schema.",
27
- "",
28
- "```",
29
- JSON.stringify({
30
- requirementAnalysisReport,
26
+ text: StringUtil.trim`
27
+ Here is the requirement analysis report:
28
+
29
+ \`\`\`json
30
+ ${JSON.stringify(requirementAnalysisReport)}
31
+ \`\`\`
32
+ `,
33
+ },
34
+ {
35
+ id: v7(),
36
+ created_at: new Date().toISOString(),
37
+ type: "assistantMessage",
38
+ text: StringUtil.trim`
39
+ Here is the input data for generating Prisma DB schema.
40
+
41
+ \`\`\`json
42
+ ${JSON.stringify({
31
43
  targetComponent,
32
44
  otherTables,
33
- }),
34
- "```",
35
- ].join("\n"),
45
+ })}
46
+ \`\`\`
47
+ `,
36
48
  },
37
49
  {
38
- id: v4(),
50
+ id: v7(),
39
51
  created_at: new Date().toISOString(),
40
52
  type: "systemMessage",
41
- text: [
42
- "You've already taken a mistake that creating models from the other components.",
43
- "Note that, you have to make models from the target component only. Never make",
44
- "models from the other components. The other components' models are already made.",
45
- "",
46
- "```json",
47
- JSON.stringify({
53
+ text: StringUtil.trim`
54
+ You've already taken a mistake that creating models from the other components.
55
+
56
+ Note that, you have to make models from the target component only. Never make
57
+ models from the other components. The other components' models are already made.
58
+
59
+ \`\`\`json
60
+ ${JSON.stringify({
48
61
  targetComponent,
49
- }),
50
- "```",
51
- ].join("\n"),
62
+ })}
63
+ \`\`\`
64
+ `,
52
65
  },
53
66
  ];
54
67
  };
@@ -10,7 +10,7 @@ import {
10
10
  } from "@autobe/interface";
11
11
  import { AutoBePrismaSchemasEvent } from "@autobe/interface/src/events/AutoBePrismaSchemasEvent";
12
12
  import { ILlmSchema } from "@samchon/openapi";
13
- import { v4 } from "uuid";
13
+ import { v7 } from "uuid";
14
14
 
15
15
  import { AutoBeContext } from "../../context/AutoBeContext";
16
16
  import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
@@ -30,13 +30,14 @@ export const orchestratePrisma = async <Model extends ILlmSchema.Model>(
30
30
  if (predicate !== null)
31
31
  return ctx.assistantMessage({
32
32
  type: "assistantMessage",
33
- id: v4(),
33
+ id: v7(),
34
34
  created_at: start.toISOString(),
35
35
  text: predicate,
36
36
  completed_at: new Date().toISOString(),
37
37
  });
38
38
  ctx.dispatch({
39
39
  type: "prismaStart",
40
+ id: v7(),
40
41
  created_at: start.toISOString(),
41
42
  reason: props.reason,
42
43
  step: ctx.state().analyze?.step ?? 0,
@@ -93,6 +94,7 @@ export const orchestratePrisma = async <Model extends ILlmSchema.Model>(
93
94
  // PROPAGATE
94
95
  return ctx.dispatch({
95
96
  type: "prismaComplete",
97
+ id: v7(),
96
98
  result,
97
99
  schemas: finalSchemas,
98
100
  compiled: await compiler.prisma.compile({
@@ -3,6 +3,7 @@ import { AutoBePrismaComponentsEvent } from "@autobe/interface/src/events/AutoBe
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";
@@ -36,6 +37,7 @@ export async function orchestratePrismaComponents<
36
37
  throw new Error("Failed to extract files and tables."); // unreachable
37
38
  return {
38
39
  type: "prismaComponents",
40
+ id: v7(),
39
41
  created_at: start.toISOString(),
40
42
  thinking: pointer.value.thinking,
41
43
  review: pointer.value.review,
@@ -8,6 +8,7 @@ import {
8
8
  import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
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";
@@ -49,6 +50,7 @@ async function iterate<Model extends ILlmSchema.Model>(
49
50
  );
50
51
  ctx.dispatch({
51
52
  type: "prismaValidate",
53
+ id: v7(),
52
54
  result,
53
55
  schemas,
54
56
  compiled: await compiler.prisma.compile({
@@ -144,6 +146,7 @@ async function execute<Model extends ILlmSchema.Model>(
144
146
  };
145
147
  ctx.dispatch({
146
148
  type: "prismaCorrect",
149
+ id: v7(),
147
150
  failure,
148
151
  planning: pointer.value.planning,
149
152
  correction: correction,
@@ -4,9 +4,11 @@ import { AutoBePrismaReviewEvent } from "@autobe/interface/src/events/AutoBePris
4
4
  import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
5
5
  import { IPointer } from "tstl";
6
6
  import typia from "typia";
7
+ import { v7 } from "uuid";
7
8
 
8
9
  import { AutoBeContext } from "../../context/AutoBeContext";
9
10
  import { assertSchemaModel } from "../../context/assertSchemaModel";
11
+ import { executeCachedBatch } from "../../utils/executeCachedBatch";
10
12
  import { transformPrismaReviewHistories } from "./histories/transformPrismaReviewHistories";
11
13
  import { IAutoBePrismaReviewApplication } from "./structures/IAutoBePrismaReviewApplication";
12
14
 
@@ -21,10 +23,16 @@ export async function orchestratePrismaReview<Model extends ILlmSchema.Model>(
21
23
  total: componentList.length,
22
24
  };
23
25
  return (
24
- await Promise.all(
25
- componentList.map(async (component) => {
26
+ await executeCachedBatch(
27
+ componentList.map((component) => async (promptCacheKey) => {
26
28
  try {
27
- return await step(ctx, application, schemas, component, progress);
29
+ return await step(ctx, {
30
+ application,
31
+ schemas,
32
+ component,
33
+ progress,
34
+ promptCacheKey,
35
+ });
28
36
  } catch {
29
37
  ++progress.completed;
30
38
  return null;
@@ -36,10 +44,13 @@ export async function orchestratePrismaReview<Model extends ILlmSchema.Model>(
36
44
 
37
45
  async function step<Model extends ILlmSchema.Model>(
38
46
  ctx: AutoBeContext<Model>,
39
- application: AutoBePrisma.IApplication,
40
- schemas: Record<string, string>,
41
- component: AutoBePrisma.IComponent,
42
- progress: AutoBeProgressEventBase,
47
+ props: {
48
+ application: AutoBePrisma.IApplication;
49
+ schemas: Record<string, string>;
50
+ component: AutoBePrisma.IComponent;
51
+ progress: AutoBeProgressEventBase;
52
+ promptCacheKey: string;
53
+ },
43
54
  ): Promise<AutoBePrismaReviewEvent> {
44
55
  const start: Date = new Date();
45
56
  const pointer: IPointer<IAutoBePrismaReviewApplication.IProps | null> = {
@@ -55,9 +66,9 @@ async function step<Model extends ILlmSchema.Model>(
55
66
  .reduce((acc, cur) => {
56
67
  return Object.assign(acc, cur);
57
68
  }, {}) ?? {},
58
- application,
59
- schemas,
60
- component,
69
+ application: props.application,
70
+ schemas: props.schemas,
71
+ component: props.component,
61
72
  }),
62
73
  controller: createController(ctx, {
63
74
  build: (next) => {
@@ -65,6 +76,7 @@ async function step<Model extends ILlmSchema.Model>(
65
76
  },
66
77
  }),
67
78
  enforceFunctionCall: true,
79
+ promptCacheKey: props.promptCacheKey,
68
80
  message: "Please review the Prisma schema file.",
69
81
  });
70
82
  if (pointer.value === null)
@@ -72,14 +84,15 @@ async function step<Model extends ILlmSchema.Model>(
72
84
 
73
85
  const event: AutoBePrismaReviewEvent = {
74
86
  type: "prismaReview",
87
+ id: v7(),
75
88
  created_at: start.toISOString(),
76
- filename: component.filename,
89
+ filename: props.component.filename,
77
90
  review: pointer.value.review,
78
91
  plan: pointer.value.plan,
79
92
  modifications: pointer.value.modifications,
80
93
  tokenUsage,
81
- completed: ++progress.completed,
82
- total: progress.total,
94
+ completed: ++props.progress.completed,
95
+ total: props.progress.total,
83
96
  step: ctx.state().analyze?.step ?? 0,
84
97
  };
85
98
  ctx.dispatch(event);
@@ -1,12 +1,15 @@
1
1
  import { IAgenticaController } from "@agentica/core";
2
2
  import { AutoBePrisma } from "@autobe/interface";
3
3
  import { AutoBePrismaSchemasEvent } from "@autobe/interface/src/events/AutoBePrismaSchemasEvent";
4
+ import { StringUtil } from "@autobe/utils";
4
5
  import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
5
6
  import { IPointer } from "tstl";
6
7
  import typia from "typia";
8
+ import { v7 } from "uuid";
7
9
 
8
10
  import { AutoBeContext } from "../../context/AutoBeContext";
9
11
  import { assertSchemaModel } from "../../context/assertSchemaModel";
12
+ import { executeCachedBatch } from "../../utils/executeCachedBatch";
10
13
  import { transformPrismaSchemaHistories } from "./histories/transformPrismaSchemaHistories";
11
14
  import { IAutoBePrismaSchemaApplication } from "./structures/IAutoBePrismaSchemaApplication";
12
15
 
@@ -19,8 +22,8 @@ export async function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(
19
22
  .map((c) => c.tables.length)
20
23
  .reduce((x, y) => x + y, 0);
21
24
  const completed: IPointer<number> = { value: 0 };
22
- return await Promise.all(
23
- componentList.map(async (component) => {
25
+ return await executeCachedBatch(
26
+ componentList.map((component) => async (promptCacheKey) => {
24
27
  const otherTables: string[] = componentList
25
28
  .filter((y) => component !== y)
26
29
  .map((c) => c.tables)
@@ -31,6 +34,7 @@ export async function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(
31
34
  start,
32
35
  total,
33
36
  completed,
37
+ promptCacheKey,
34
38
  });
35
39
  ctx.dispatch(event);
36
40
  return event;
@@ -46,6 +50,7 @@ async function process<Model extends ILlmSchema.Model>(
46
50
  start: Date;
47
51
  total: number;
48
52
  completed: IPointer<number>;
53
+ promptCacheKey: string;
49
54
  },
50
55
  ): Promise<AutoBePrismaSchemasEvent> {
51
56
  const pointer: IPointer<IAutoBePrismaSchemaApplication.IProps | null> = {
@@ -71,12 +76,14 @@ async function process<Model extends ILlmSchema.Model>(
71
76
  },
72
77
  }),
73
78
  enforceFunctionCall: true,
79
+ promptCacheKey: props.promptCacheKey,
74
80
  message: "Make prisma schema file please",
75
81
  });
76
82
  if (pointer.value === null)
77
83
  throw new Error("Unreachable code: Prisma Schema not generated");
78
84
  return {
79
85
  type: "prismaSchemas",
86
+ id: v7(),
80
87
  created_at: props.start.toISOString(),
81
88
  plan: pointer.value.plan,
82
89
  models: pointer.value.models,
@@ -118,6 +125,7 @@ function createController<Model extends ILlmSchema.Model>(
118
125
 
119
126
  ctx.dispatch({
120
127
  type: "prismaInsufficient",
128
+ id: v7(),
121
129
  created_at: new Date().toISOString(),
122
130
  component: props.targetComponent,
123
131
  actual,
@@ -131,26 +139,26 @@ function createController<Model extends ILlmSchema.Model>(
131
139
  path: "$input.models",
132
140
  value: result.data.models,
133
141
  expected: `Array<AutoBePrisma.IModel>`,
134
- description: [
135
- "You missed some tables from the current domain's component.",
136
- "",
137
- "Look at the following details to fix the schemas. Never forget to",
138
- "compose the `missed` tables at the next function calling.",
139
- "",
140
- "- filename: current domain's filename",
141
- "- namespace: current domain's namespace",
142
- "- expected: expected tables in the current domain",
143
- "- actual: actual tables you made",
144
- "- missed: tables you have missed, and you have to compose again",
145
- "",
146
- JSON.stringify({
142
+ description: StringUtil.trim`
143
+ You missed some tables from the current domain's component.
144
+
145
+ Look at the following details to fix the schemas. Never forget to
146
+ compose the \`missed\` tables at the next function calling.
147
+
148
+ - filename: current domain's filename
149
+ - namespace: current domain's namespace
150
+ - expected: expected tables in the current domain
151
+ - actual: actual tables you made
152
+ - missed: tables you have missed, and you have to compose again
153
+
154
+ ${JSON.stringify({
147
155
  filename: props.targetComponent.filename,
148
156
  namespace: props.targetComponent.namespace,
149
157
  expected,
150
158
  actual,
151
159
  missed,
152
- }),
153
- ].join("\n"),
160
+ })}
161
+ `,
154
162
  },
155
163
  ],
156
164
  };