@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,46 +1,59 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformPrismaSchemaHistories = void 0;
4
+ const utils_1 = require("@autobe/utils");
4
5
  const uuid_1 = require("uuid");
5
6
  const transformPrismaSchemaHistories = (requirementAnalysisReport, targetComponent, otherTables) => {
6
7
  return [
7
8
  {
8
- id: (0, uuid_1.v4)(),
9
+ id: (0, uuid_1.v7)(),
9
10
  created_at: new Date().toISOString(),
10
11
  type: "systemMessage",
11
12
  text: "# Enhanced Prisma Schema Expert System Prompt\n\n## Naming Conventions\n\n### Notation Types\nThe following naming conventions (notations) are used throughout the system:\n- **camelCase**: First word lowercase, subsequent words capitalized (e.g., `userAccount`, `productItem`)\n- **PascalCase**: All words capitalized (e.g., `UserAccount`, `ProductItem`)\n- **snake_case**: All lowercase with underscores between words (e.g., `user_account`, `product_item`)\n\n### Specific Property Notations\nAll database-related names in Prisma schemas MUST use **snake_case** notation:\n- **AutoBePrisma.IComponent.tables**: snake_case (e.g., `shopping_customers`, `bbs_articles`)\n- **AutoBePrisma.IModel.name**: snake_case (e.g., `shopping_sales`, `mv_shopping_sale_last_snapshots`)\n- **AutoBePrisma.IPrimaryField.name**: snake_case (e.g., `id`)\n- **AutoBePrisma.IForeignField.name**: snake_case (e.g., `shopping_customer_id`, `parent_id`)\n- **AutoBePrisma.IPlainField.name**: snake_case (e.g., `created_at`, `updated_at`, `deleted_at`)\n- **AutoBePrisma.IRelation.name**: camelCase (e.g., `customer`, `parent`)\n\n**Important**: While most application code uses camelCase, all database schema elements consistently use snake_case for PostgreSQL compatibility and database naming conventions.\n\n## \uD83C\uDFAF YOUR PRIMARY MISSION\n\n### WHAT YOU MUST DO (ONLY THIS!)\n\n**YOUR ASSIGNMENT:**\n```\nYour Job: targetComponent.tables = [...]\nYour File: targetComponent.filename = \"...\"\nYour Domain: targetComponent.namespace = \"...\"\n```\n\n**YOUR 2-STEP PROCESS:**\n1. **plan**: Analyze and plan database design for targetComponent.tables\n2. **models**: Generate production-ready AST models based on the strategic plan\n\n**SUCCESS CRITERIA:**\n\u2705 Every table from `targetComponent.tables` exists in your output\n\u2705 Total model count = `targetComponent.tables.length` (plus junction tables if needed)\n\u2705 All model names match `targetComponent.tables` entries exactly\n\u2705 Complete IAutoBePrismaSchemaApplication.IProps structure with 2 fields (plan, models)\n\u2705 AST models include proper field classification and type normalization\n\u2705 All models have correct `stance` classification\n\n---\n\n## \uD83D\uDEA7 REFERENCE INFORMATION (FOR RELATIONSHIPS ONLY)\n\n### Other Existing Tables (ALREADY CREATED - DO NOT CREATE)\n- `otherTables[]` is an array of table names that are **ALREADY CREATED** in other files\n- These tables are **ALREADY IMPLEMENTED** by other developers/processes\n- These tables **ALREADY EXIST** in the database system\n- Use these ONLY for foreign key relationships\n- Example: `shopping_customer_id` \u2192 references already existing `shopping_customers` table\n\n---\n\n## Core Expert Identity\n\nYou are a world-class Prisma database schema expert specializing in snapshot-based architecture and temporal data modeling. You excel at creating maintainable, scalable, and well-documented database schemas that preserve data integrity and audit trails through structured function calling.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the schemas directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n### Core Principles\n\n- **Focus on assigned tables** - Create exactly what `targetComponent.tables` specifies\n- **Output structured function call** - Use IAutoBePrismaSchemaApplication.IProps with 2-step process\n- **Follow snapshot-based architecture** - Design for historical data preservation and audit trails \n- **Prioritize data integrity** - Ensure referential integrity and proper constraints\n- **CRITICAL: Prevent all duplications** - Always verify no duplicate fields, relations, or models exist\n- **STRICT NORMALIZATION** - Follow database normalization principles rigorously (1NF, 2NF, 3NF minimum)\n- **DENORMALIZATION ONLY IN MATERIALIZED VIEWS** - Any denormalization must be implemented in `mv_` prefixed tables\n- **NEVER PRE-CALCULATE IN REGULAR TABLES** - Absolutely prohibit computed/calculated fields in regular business tables\n- **CLASSIFY TABLE STANCE** - Properly determine each table's architectural stance for API generation guidance\n\n## \uD83D\uDCCA TABLE STANCE CLASSIFICATION\n\n### Understanding Table Stance\nEvery model must have a correctly assigned `stance` property that determines its architectural role and API generation strategy:\n\n#### `\"primary\"` - Independent Business Entities\n**Key Question**: \"Do users need to independently create, search, filter, or manage these entities?\"\n\n**Characteristics:**\n- Users directly interact with these entities\n- Require independent CRUD API endpoints\n- Need search and filtering across all instances\n- Support independent operations regardless of parent context\n\n**Examples:**\n- `bbs_articles` - Users create, edit, and manage articles independently\n- `bbs_article_comments` - Comments require independent search (\"all comments by user X\"), moderation workflows, and direct user management\n\n**API Requirements:**\n- POST /articles, POST /comments (independent creation)\n- GET /comments?userId=X (cross-article search)\n- GET /comments/pending (moderation workflows)\n- PUT /comments/:id (direct updates)\n\n#### `\"subsidiary\"` - Supporting/Dependent Entities\n**Key Question**: \"Are these entities always managed through their parent entities?\"\n\n**Characteristics:**\n- Exist to support primary or snapshot entities\n- Managed indirectly through parent entity operations\n- Limited or no independent API operations needed\n- Provide supporting data or relationships\n\n**Examples:**\n- `bbs_article_snapshot_files` - Files attached to article snapshots, managed via snapshot APIs\n- `bbs_article_snapshot_tags` - Tags associated with article snapshots\n- `bbs_article_comment_snapshot_files` - Files attached to comment snapshots\n\n**API Strategy:**\n- Managed through parent entity endpoints\n- No independent creation endpoints needed\n- Access through parent entity relationships\n\n#### `\"snapshot\"` - Historical/Versioning Entities\n**Key Question**: \"Does this table capture point-in-time states for audit trails?\"\n\n**Characteristics:**\n- Capture historical states of primary entities\n- Append-only pattern (rarely updated or deleted)\n- Used for audit trails and change tracking\n- Usually read-only from user perspective\n\n**Examples:**\n- `bbs_article_snapshots` - Historical states of articles\n- `bbs_article_comment_snapshots` - Comment modification history\n\n**API Strategy:**\n- Typically read-only endpoints\n- Historical data access\n- Audit trail queries\n\n### Stance Classification Guidelines\n\n**Decision Tree for Stance Assignment:**\n\n1. **Is it a snapshot table (contains `_snapshots` or historical data)?**\n \u2192 `stance: \"snapshot\"`\n\n2. **Is it a supporting table (files, tags, junction tables, system-maintained)?**\n \u2192 `stance: \"subsidiary\"`\n\n3. **Do users need independent operations across parent boundaries?**\n \u2192 `stance: \"primary\"`\n\n**Common Misclassification (Avoid This):**\n```typescript\n// \u274C WRONG: Don't assume child entities are subsidiary\n{\n name: \"bbs_article_comments\",\n stance: \"subsidiary\" // WRONG! Comments need independent management\n}\n\n// \u2705 CORRECT: Child entities can be primary if independently managed\n{\n name: \"bbs_article_comments\", \n stance: \"primary\" // Comments require cross-article search and direct management\n}\n```\n\n## \uD83D\uDCCB MANDATORY PROCESSING STEPS\n\n### Step 1: Strategic Database Design Analysis (plan)\n```\nASSIGNMENT VALIDATION:\nMy Target Component: [targetComponent.namespace] - [targetComponent.filename]\nTables I Must Create: [list each table from targetComponent.tables with EXACT names]\nRequired Count: [targetComponent.tables.length]\nAlready Created Tables (Reference Only): [list otherTables - these ALREADY EXIST]\n\nSTANCE CLASSIFICATION:\n\u2705 I will classify each table's stance based on business requirements\n\u2705 Primary: Tables requiring independent user management and API operations\n\u2705 Subsidiary: Supporting tables managed through parent entities\n\u2705 Snapshot: Historical/audit tables with append-only patterns\n\nDESIGN PLANNING:\n\u2705 I will create exactly [count] models from targetComponent.tables\n\u2705 I will use EXACT table names as provided (NO CHANGES)\n\u2705 I will use otherTables only for foreign key relationships (they ALREADY EXIST)\n\u2705 I will add junction tables if needed for M:N relationships\n\u2705 I will identify materialized views (mv_) for denormalized data\n\u2705 I will ensure strict 3NF normalization for regular tables\n\u2705 I will assign correct stance to each model\n```\n\n### Step 2: Model Generation (models)\nGenerate AutoBePrisma.IModel[] array based on the strategic plan:\n- Create model objects for each table with exact names from targetComponent.tables\n- Include all fields, relationships, and indexes\n- **Assign appropriate stance classification to each model**\n- Follow AST structure requirements\n- Implement normalization principles\n- Ensure production-ready quality with proper documentation\n- All descriptions must be in English\n\n**Quality Requirements:**\n- **Zero Errors**: Valid AST structure, no validation warnings\n- **Proper Relationships**: All foreign keys reference existing tables correctly\n- **Optimized Indexes**: Strategic indexes without redundant foreign key indexes\n- **Full Normalization**: Strict 3NF compliance, denormalization only in mv_ tables\n- **Enterprise Documentation**: Complete descriptions with business context\n- **Audit Support**: Proper snapshot patterns and temporal fields (created_at, updated_at, deleted_at)\n- **Type Safety**: Consistent use of UUID for all keys, appropriate field types\n- **Correct Stance Classification**: Each model has appropriate stance assigned\n\n## \uD83C\uDFAF CLEAR EXAMPLES\n\n### Correct Assignment Processing:\n```yaml\ntargetComponent.tables: [\"bbs_articles\", \"bbs_article_snapshots\"]\n# \u2705 CREATES: bbs_articles (primary), bbs_article_snapshots (snapshot)\n# \u2705 OUTPUT: 2 models (or more if junction tables needed)\n```\n\n### Incorrect Approaches:\n```yaml\n# \u274C WRONG: Creating tables not in targetComponent.tables\n# \u274C WRONG: Skipping tables from targetComponent.tables\n# \u274C WRONG: Modifying table names from targetComponent.tables\n# \u274C WRONG: Calculated fields in regular tables\n# \u274C WRONG: Missing or incorrect stance classification\n```\n\n## \uD83D\uDCCC REMEMBER: YOUR SOLE PURPOSE\nYou are building ONLY the tables listed in `targetComponent.tables` for the specific file assigned to you. Other tables in `otherTables` already exist - use them only for foreign key relationships. Your output will be reviewed by a separate review agent, so focus on creating high-quality, production-ready models with correct stance classification in your first attempt.\n\n## DATABASE DESIGN PATTERNS\n\n### \uD83C\uDF1F REQUIRED PATTERNS\n\n#### Snapshot Pattern Implementation (MANDATORY FOR ENTITIES WITH STATE CHANGES)\n```typescript\n// Main Entity (PRIMARY STANCE)\nbbs_articles: {\n stance: \"primary\"\n id: uuid (PK)\n code: string (unique business identifier)\n // ... other fields\n created_at: datetime\n updated_at: datetime\n deleted_at: datetime?\n}\n\n// Snapshot Table (SNAPSHOT STANCE)\nbbs_article_snapshots: {\n stance: \"snapshot\"\n id: uuid (PK)\n bbs_article_id: uuid (FK \u2192 bbs_articles.id)\n // All fields from main entity (denormalized for historical accuracy)\n created_at: datetime (snapshot creation time)\n}\n```\n\n**WHEN TO USE SNAPSHOTS:**\n- \u2705 Products/Services with changing prices, descriptions, or attributes\n- \u2705 User profiles with evolving information\n- \u2705 Any entity where historical state matters for business logic\n- \u2705 Financial records requiring audit trails\n\n#### Materialized View Pattern (mv_ prefix)\n```typescript\n// Materialized View for Performance (SUBSIDIARY STANCE)\nmv_bbs_article_last_snapshots: {\n stance: \"subsidiary\"\n material: true\n id: uuid (PK)\n bbs_article_id: uuid (FK, unique)\n // Latest snapshot data (denormalized)\n // Pre-computed aggregations allowed here\n}\n```\n\n**MATERIALIZED VIEW RULES:**\n- \u2705 ONLY place for denormalized data\n- \u2705 ONLY place for calculated/aggregated fields\n- \u2705 Must start with `mv_` prefix\n- \u2705 Used for read-heavy operations\n- \u2705 Mark with `material: true` in AST\n- \u2705 Always `stance: \"subsidiary\"`\n\n### \uD83D\uDEAB PROHIBITED PATTERNS IN REGULAR TABLES\n\n**NEVER DO THESE IN BUSINESS TABLES:**\n```typescript\n// \u274C WRONG: Calculated fields in regular tables\nbbs_articles: {\n view_count: int // \u274C PROHIBITED\n comment_count: int // \u274C PROHIBITED\n like_count: int // \u274C PROHIBITED - Calculate in application\n}\n\n// \u2705 CORRECT: Store only raw data\nbbs_articles: {\n stance: \"primary\"\n // No calculated fields - compute in queries or mv_ tables\n}\n\n// \u274C WRONG: Redundant denormalized data\nbbs_article_comments: {\n article_title: string // \u274C PROHIBITED - exists in articles\n author_name: string // \u274C PROHIBITED - use snapshots\n}\n\n// \u2705 CORRECT: Reference and snapshot\nbbs_article_comments: {\n stance: \"primary\" // Comments need independent management\n bbs_article_id: uuid // Reference\n // No redundant data from parent\n}\n```\n\n### DATABASE NORMALIZATION RULES\n\n#### First Normal Form (1NF)\n- \u2705 Each column contains atomic values\n- \u2705 No repeating groups or arrays\n- \u2705 Each row is unique\n\n#### Second Normal Form (2NF)\n- \u2705 Satisfies 1NF\n- \u2705 All non-key attributes fully depend on the primary key\n- \u2705 No partial dependencies\n\n#### Third Normal Form (3NF)\n- \u2705 Satisfies 2NF\n- \u2705 No transitive dependencies\n- \u2705 Non-key attributes depend only on the primary key\n\n**NORMALIZATION EXAMPLES:**\n```typescript\n// \u274C WRONG: Violates 3NF\nbbs_article_comments: {\n bbs_article_id: uuid\n article_title: string // \u274C Transitive dependency\n article_author: string // \u274C Transitive dependency\n}\n\n// \u2705 CORRECT: Proper normalization\nbbs_article_comments: {\n stance: \"primary\"\n bbs_article_id: uuid // Reference only\n}\n```\n\n## AST STRUCTURE REQUIREMENTS\n\n### Field Classification\n```typescript\ninterface IModel {\n // Model Stance (REQUIRED)\n stance: \"primary\" | \"subsidiary\" | \"snapshot\"\n \n // 1. Primary Field (EXACTLY ONE)\n primaryField: {\n name: \"id\" // Always \"id\"\n type: \"uuid\" // Always UUID\n description: \"Primary Key.\"\n }\n \n // 2. Foreign Fields (Relationships)\n foreignFields: [{\n name: string // Format: {table_name}_id\n type: \"uuid\"\n relation: {\n name: string // Relation property name\n targetModel: string // Target table name\n }\n unique: boolean // true for 1:1\n nullable: boolean\n description: string // Format: \"Target description. {@link target_table.id}.\"\n }]\n \n // 3. Plain Fields (Business Data)\n plainFields: [{\n name: string\n type: \"string\" | \"int\" | \"double\" | \"boolean\" | \"datetime\" | \"uri\" | \"uuid\"\n nullable: boolean\n description: string // Business context\n }]\n}\n```\n\n### Index Strategy\n```typescript\n{\n // 1. Unique Indexes (Business Constraints)\n uniqueIndexes: [{\n fieldNames: string[] // Composite unique constraints\n unique: true\n }]\n \n // 2. Plain Indexes (Query Optimization)\n plainIndexes: [{\n fieldNames: string[] // Multi-column indexes\n // NOTE: Never create single-column index on foreign keys\n }]\n \n // 3. GIN Indexes (Full-Text Search)\n ginIndexes: [{\n fieldName: string // Text fields for search\n }]\n}\n```\n\n### Temporal Fields Pattern\n```typescript\n// Standard for all business entities\n{\n created_at: { type: \"datetime\", nullable: false }\n updated_at: { type: \"datetime\", nullable: false }\n deleted_at: { type: \"datetime\", nullable: true } // Soft delete\n}\n```\n\n## OUTPUT FORMAT\n\nYour response must be a valid IAutoBePrismaSchemaApplication.IProps object:\n\n```typescript\n{\n plan: \"Strategic database design analysis including stance classification...\",\n models: [\n {\n name: \"exact_table_name\",\n description: \"Business purpose and context...\",\n material: false,\n stance: \"primary\" | \"subsidiary\" | \"snapshot\", // REQUIRED\n primaryField: { ... },\n foreignFields: [ ... ],\n plainFields: [ ... ],\n uniqueIndexes: [ ... ],\n plainIndexes: [ ... ],\n ginIndexes: [ ... ]\n }\n ]\n}\n```\n\nRemember: Focus on quality in your initial generation, including correct stance classification for each model. The review process is handled by a separate agent, so your models should be production-ready from the start." /* AutoBeSystemPromptConstant.PRISMA_SCHEMA */,
12
13
  },
13
14
  {
14
- id: (0, uuid_1.v4)(),
15
+ id: (0, uuid_1.v7)(),
15
16
  created_at: new Date().toISOString(),
16
17
  type: "assistantMessage",
17
- text: [
18
- "Here is the input data for generating Prisma DB schema.",
19
- "",
20
- "```",
21
- JSON.stringify({
22
- requirementAnalysisReport,
23
- targetComponent,
24
- otherTables,
25
- }),
26
- "```",
27
- ].join("\n"),
18
+ text: utils_1.StringUtil.trim `
19
+ Here is the requirement analysis report:
20
+
21
+ \`\`\`json
22
+ ${JSON.stringify(requirementAnalysisReport)}
23
+ \`\`\`
24
+ `,
28
25
  },
29
26
  {
30
- id: (0, uuid_1.v4)(),
27
+ id: (0, uuid_1.v7)(),
28
+ created_at: new Date().toISOString(),
29
+ type: "assistantMessage",
30
+ text: utils_1.StringUtil.trim `
31
+ Here is the input data for generating Prisma DB schema.
32
+
33
+ \`\`\`json
34
+ ${JSON.stringify({
35
+ targetComponent,
36
+ otherTables,
37
+ })}
38
+ \`\`\`
39
+ `,
40
+ },
41
+ {
42
+ id: (0, uuid_1.v7)(),
31
43
  created_at: new Date().toISOString(),
32
44
  type: "systemMessage",
33
- text: [
34
- "You've already taken a mistake that creating models from the other components.",
35
- "Note that, you have to make models from the target component only. Never make",
36
- "models from the other components. The other components' models are already made.",
37
- "",
38
- "```json",
39
- JSON.stringify({
40
- targetComponent,
41
- }),
42
- "```",
43
- ].join("\n"),
45
+ text: utils_1.StringUtil.trim `
46
+ You've already taken a mistake that creating models from the other components.
47
+
48
+ Note that, you have to make models from the target component only. Never make
49
+ models from the other components. The other components' models are already made.
50
+
51
+ \`\`\`json
52
+ ${JSON.stringify({
53
+ targetComponent,
54
+ })}
55
+ \`\`\`
56
+ `,
44
57
  },
45
58
  ];
46
59
  };
@@ -1 +1 @@
1
- {"version":3,"file":"transformPrismaSchemaHistories.js","sourceRoot":"","sources":["../../../../../../src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts"],"names":[],"mappings":";;;AAEA,+BAA0B;AAInB,MAAM,8BAA8B,GAAG,CAC5C,yBAAiD,EACjD,eAAwC,EACxC,WAAqB,EAGrB,EAAE;IACF,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,yjjBAA0C;SAC/C;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE;gBACJ,yDAAyD;gBACzD,EAAE;gBACF,KAAK;gBACL,IAAI,CAAC,SAAS,CAAC;oBACb,yBAAyB;oBACzB,eAAe;oBACf,WAAW;iBACZ,CAAC;gBACF,KAAK;aACN,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE;gBACJ,gFAAgF;gBAChF,+EAA+E;gBAC/E,kFAAkF;gBAClF,EAAE;gBACF,SAAS;gBACT,IAAI,CAAC,SAAS,CAAC;oBACb,eAAe;iBAChB,CAAC;gBACF,KAAK;aACN,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;AACJ,CAAC,CAAC;AA/CW,QAAA,8BAA8B,kCA+CzC"}
1
+ {"version":3,"file":"transformPrismaSchemaHistories.js","sourceRoot":"","sources":["../../../../../../src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,+BAA0B;AAInB,MAAM,8BAA8B,GAAG,CAC5C,yBAAiD,EACjD,eAAwC,EACxC,WAAqB,EAGrB,EAAE;IACF,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,yjjBAA0C;SAC/C;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;UAIjB,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC;;OAE5C;SACF;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;UAIjB,IAAI,CAAC,SAAS,CAAC;gBACf,eAAe;gBACf,WAAW;aACZ,CAAC;;OAEH;SACF;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;UAOjB,IAAI,CAAC,SAAS,CAAC;gBACf,eAAe;aAChB,CAAC;;OAEH;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA3DW,QAAA,8BAA8B,kCA2DzC"}
@@ -24,13 +24,14 @@ const orchestratePrisma = (ctx, props) => __awaiter(void 0, void 0, void 0, func
24
24
  if (predicate !== null)
25
25
  return ctx.assistantMessage({
26
26
  type: "assistantMessage",
27
- id: (0, uuid_1.v4)(),
27
+ id: (0, uuid_1.v7)(),
28
28
  created_at: start.toISOString(),
29
29
  text: predicate,
30
30
  completed_at: new Date().toISOString(),
31
31
  });
32
32
  ctx.dispatch({
33
33
  type: "prismaStart",
34
+ id: (0, uuid_1.v7)(),
34
35
  created_at: start.toISOString(),
35
36
  reason: props.reason,
36
37
  step: (_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : 0,
@@ -65,6 +66,7 @@ const orchestratePrisma = (ctx, props) => __awaiter(void 0, void 0, void 0, func
65
66
  // PROPAGATE
66
67
  return ctx.dispatch({
67
68
  type: "prismaComplete",
69
+ id: (0, uuid_1.v7)(),
68
70
  result,
69
71
  schemas: finalSchemas,
70
72
  compiled: yield compiler.prisma.compile({
@@ -1 +1 @@
1
- {"version":3,"file":"orchestratePrisma.js","sourceRoot":"","sources":["../../../../../src/orchestrate/prisma/orchestratePrisma.ts"],"names":[],"mappings":";;;;;;;;;;;;AAYA,+BAA0B;AAI1B,6EAA0E;AAC1E,6EAA2E;AAC3E,yEAAsE;AACtE,uEAAoE;AACpE,yEAAsE;AAE/D,MAAM,iBAAiB,G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YAAY,CAAC;QACzC,CAAC;IACH,CAAC;IAED,WAAW;IACX,MAAM,MAAM,GAA4B,MAAM,IAAA,mDAAwB,EACpE,GAAG,EACH,WAAW,CACZ,CAAC;IACF,MAAM,YAAY,GAA2B,MAAM,QAAQ,CAAC,MAAM,CAAC,KAAK,CACtE,MAAM,CAAC,IAAI,EACX,UAAU,CACX,CAAC;IAEF,YAAY;IACZ,OAAO,GAAG,CAAC,QAAQ,CAAC;QAClB,IAAI,EAAE,gBAAgB;QACtB,EAAE,EAAE,IAAA,SAAE,GAAE;QACR,MAAM;QACN,OAAO,EAAE,YAAY;QACrB,QAAQ,EAAE,MAAM,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC;YACtC,KAAK,EAAE,YAAY;SACpB,CAAC;QACF,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,OAAO,0CAAE,IAAI,mCAAI,CAAC;QACpC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE;QAC/C,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACD,CAAC,CAAC;AACzC,CAAC,CAAA,CAAC;AApFW,QAAA,iBAAiB,qBAoF5B"}
@@ -48,6 +48,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
48
48
  exports.orchestratePrismaComponents = orchestratePrismaComponents;
49
49
  const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
50
50
  const typia_1 = __importDefault(require("typia"));
51
+ const uuid_1 = require("uuid");
51
52
  const assertSchemaModel_1 = require("../../context/assertSchemaModel");
52
53
  const transformPrismaComponentsHistories_1 = require("./histories/transformPrismaComponentsHistories");
53
54
  function orchestratePrismaComponents(ctx_1) {
@@ -74,6 +75,7 @@ function orchestratePrismaComponents(ctx_1) {
74
75
  throw new Error("Failed to extract files and tables."); // unreachable
75
76
  return {
76
77
  type: "prismaComponents",
78
+ id: (0, uuid_1.v7)(),
77
79
  created_at: start.toISOString(),
78
80
  thinking: pointer.value.thinking,
79
81
  review: pointer.value.review,
@@ -1 +1 @@
1
- {"version":3,"file":"orchestratePrismaComponent.js","sourceRoot":"","sources":["../../../../../src/orchestrate/prisma/orchestratePrismaComponent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,kEAmCC;;AA1CD,kDAA0B;AAG1B,uEAAoE;AACpE,uGAAoG;AAGpG,SAAsB,2BAA2B;yDAG/C,GAAyB,EACzB,UAAkB,gEAAgE;;QAElF,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,OAAO,GAA8D;YACzE,KAAK,EAAE,IAAI;SACZ,CAAC;QACF,MAAM,MAAM,GAAkB,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,OAAO,0CAAE,MAAM,mCAAI,IAAI,CAAC;QAClE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC;YAC1C,MAAM,EAAE,kBAAkB;YAC1B,SAAS,EAAE,IAAA,uEAAkC,EAAC,GAAG,CAAC,KAAK,EAAE,EAAE,MAAM,CAAC;YAClE,UAAU,EAAE,gBAAgB,CAAC;gBAC3B,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;oBACd,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;gBACvB,CAAC;aACF,CAAC;YACF,mBAAmB,EAAE,IAAI;YACzB,OAAO;SACR,CAAC,CAAC;QACH,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI;YACxB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC,CAAC,cAAc;QACxE,OAAO;YACL,IAAI,EAAE,kBAAkB;YACxB,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;YAC/B,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ;YAChC,MAAM,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QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;CACd,CAAC"}
1
+ {"version":3,"file":"orchestratePrismaComponent.js","sourceRoot":"","sources":["../../../../../src/orchestrate/prisma/orchestratePrismaComponent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,kEAoCC;;AA5CD,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,uGAAoG;AAGpG,SAAsB,2BAA2B;yDAG/C,GAAyB,EACzB,UAAkB,gEAAgE;;QAElF,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,OAAO,GAA8D;YACzE,KAAK,EAAE,IAAI;SACZ,CAAC;QACF,MAAM,MAAM,GAAkB,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,OAAO,0CAAE,MAAM,mCAAI,IAAI,CAAC;QAClE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC;YAC1C,MAAM,EAAE,kBAAkB;YAC1B,SAAS,EAAE,IAAA,uEAAkC,EAAC,GAAG,CAAC,KAAK,EAAE,EAAE,MAAM,CAAC;YAClE,UAAU,EAAE,gBAAgB,CAAC;gBAC3B,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;oBACd,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;gBACvB,CAAC;aACF,CAAC;YACF,mBAAmB,EAAE,IAAI;YACzB,OAAO;SACR,CAAC,CAAC;QACH,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI;YACxB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC,CAAC,cAAc;QACxE,OAAO;YACL,IAAI,EAAE,kBAAkB;YACxB,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;YAC/B,QAAQ,EAAE,OAAO,CAAC,KAA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IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;CACd,CAAC"}
@@ -49,6 +49,7 @@ exports.orchestratePrismaCorrect = orchestratePrismaCorrect;
49
49
  const __typia_transform__isUniqueItems = __importStar(require("typia/lib/internal/_isUniqueItems.js"));
50
50
  const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
51
51
  const typia_1 = __importDefault(require("typia"));
52
+ const uuid_1 = require("uuid");
52
53
  const assertSchemaModel_1 = require("../../context/assertSchemaModel");
53
54
  const transformPrismaCorrectHistories_1 = require("./histories/transformPrismaCorrectHistories");
54
55
  function orchestratePrismaCorrect(ctx, application, life = 4) {
@@ -76,6 +77,7 @@ function iterate(ctx, application, life) {
76
77
  const schemas = yield compiler.prisma.write(application, "postgres");
77
78
  ctx.dispatch({
78
79
  type: "prismaValidate",
80
+ id: (0, uuid_1.v7)(),
79
81
  result,
80
82
  schemas,
81
83
  compiled: yield compiler.prisma.compile({
@@ -164,6 +166,7 @@ function execute(ctx, failure) {
164
166
  };
165
167
  ctx.dispatch({
166
168
  type: "prismaCorrect",
169
+ id: (0, uuid_1.v7)(),
167
170
  failure,
168
171
  planning: pointer.value.planning,
169
172
  correction: correction,
@@ -1 +1 @@
1
- {"version":3,"file":"orchestratePrismaCorrect.js","sourceRoot":"","sources":["../../../../../src/orchestrate/prisma/orchestratePrismaCorrect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,4DAcC;;;AArBD,kDAA0B;AAG1B,uEAAoE;AACpE,iGAA8F;AAG9F,SAAgB,wBAAwB,CACtC,GAAyB,EACzB,WAAsC,EACtC,OAAe,CAAC;IAEhB,MAAM,MAAM,GAAgB,IAAI,GAAG,EAAE,CAAC;IACtC,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,KAAK;QAClC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,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B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAqE;IAC5E,MAAM;IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;CACd,CAAC"}
@@ -49,7 +49,9 @@ exports.orchestratePrismaReview = orchestratePrismaReview;
49
49
  const __typia_transform__isUniqueItems = __importStar(require("typia/lib/internal/_isUniqueItems.js"));
50
50
  const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
51
51
  const typia_1 = __importDefault(require("typia"));
52
+ const uuid_1 = require("uuid");
52
53
  const assertSchemaModel_1 = require("../../context/assertSchemaModel");
54
+ const executeCachedBatch_1 = require("../../utils/executeCachedBatch");
53
55
  const transformPrismaReviewHistories_1 = require("./histories/transformPrismaReviewHistories");
54
56
  function orchestratePrismaReview(ctx, application, schemas, componentList) {
55
57
  return __awaiter(this, void 0, void 0, function* () {
@@ -57,9 +59,15 @@ function orchestratePrismaReview(ctx, application, schemas, componentList) {
57
59
  completed: 0,
58
60
  total: componentList.length,
59
61
  };
60
- return (yield Promise.all(componentList.map((component) => __awaiter(this, void 0, void 0, function* () {
62
+ return (yield (0, executeCachedBatch_1.executeCachedBatch)(componentList.map((component) => (promptCacheKey) => __awaiter(this, void 0, void 0, function* () {
61
63
  try {
62
- return yield step(ctx, application, schemas, component, progress);
64
+ return yield step(ctx, {
65
+ application,
66
+ schemas,
67
+ component,
68
+ progress,
69
+ promptCacheKey,
70
+ });
63
71
  }
64
72
  catch (_a) {
65
73
  ++progress.completed;
@@ -68,7 +76,7 @@ function orchestratePrismaReview(ctx, application, schemas, componentList) {
68
76
  })))).filter((v) => v !== null);
69
77
  });
70
78
  }
71
- function step(ctx, application, schemas, component, progress) {
79
+ function step(ctx, props) {
72
80
  return __awaiter(this, void 0, void 0, function* () {
73
81
  var _a, _b, _c, _d;
74
82
  const start = new Date();
@@ -83,9 +91,9 @@ function step(ctx, application, schemas, component, progress) {
83
91
  .analyze) === null || _a === void 0 ? void 0 : _a.files.map((file) => ({ [file.filename]: file.content })).reduce((acc, cur) => {
84
92
  return Object.assign(acc, cur);
85
93
  }, {})) !== null && _b !== void 0 ? _b : {},
86
- application,
87
- schemas,
88
- component,
94
+ application: props.application,
95
+ schemas: props.schemas,
96
+ component: props.component,
89
97
  }),
90
98
  controller: createController(ctx, {
91
99
  build: (next) => {
@@ -93,20 +101,22 @@ function step(ctx, application, schemas, component, progress) {
93
101
  },
94
102
  }),
95
103
  enforceFunctionCall: true,
104
+ promptCacheKey: props.promptCacheKey,
96
105
  message: "Please review the Prisma schema file.",
97
106
  });
98
107
  if (pointer.value === null)
99
108
  throw new Error("Failed to review the Prisma schema.");
100
109
  const event = {
101
110
  type: "prismaReview",
111
+ id: (0, uuid_1.v7)(),
102
112
  created_at: start.toISOString(),
103
- filename: component.filename,
113
+ filename: props.component.filename,
104
114
  review: pointer.value.review,
105
115
  plan: pointer.value.plan,
106
116
  modifications: pointer.value.modifications,
107
117
  tokenUsage,
108
- completed: ++progress.completed,
109
- total: progress.total,
118
+ completed: ++props.progress.completed,
119
+ total: props.progress.total,
110
120
  step: (_d = (_c = ctx.state().analyze) === null || _c === void 0 ? void 0 : _c.step) !== null && _d !== void 0 ? _d : 0,
111
121
  };
112
122
  ctx.dispatch(event);
@@ -1 +1 @@
1
- {"version":3,"file":"orchestratePrismaReview.js","sourceRoot":"","sources":["../../../../../src/orchestrate/prisma/orchestratePrismaReview.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,0DAsBC;;;AA7BD,kDAA0B;AAG1B,uEAAoE;AACpE,+FAA4F;AAG5F,SAAsB,uBAAuB,CAC3C,GAAyB,EACzB,WAAsC,EACtC,OAA+B,EAC/B,aAAwC;;QAExC,MAAM,QAAQ,GAA4B;YACxC,SAAS,EAAE,CAAC;YACZ,KAAK,EAAE,aAAa,CAAC,MAAM;SAC5B,CAAC;QACF,OAAO,CACL,MAAM,OAAO,CAAC,GAAG,CACf,aAAa,CAAC,GAAG,CAAC,CAAO,SAAS,EAAE,EAAE;YACpC,IAAI,CAAC;gBACH,OAAO,MAAM,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;YACpE,CAAC;YAAC,WAAM,CAAC;gBACP,EAAE,QAAQ,CAAC,SAAS,CAAC;gBACrB,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC,CAAA,CAAC,CACH,CACF,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IAC9B,CAAC;CAAA;AAED,SAAe,IAAI,CACjB,GAAyB,EACzB,WAAsC,EACtC,OAA+B,EAC/B,SAAkC,EAClC,QAAiC;;;QAEjC,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,OAAO,GAA2D;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAoE;IAC3E,MAAM;IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;CACd,CAAC"}
@@ -49,8 +49,11 @@ exports.orchestratePrismaSchemas = orchestratePrismaSchemas;
49
49
  const __typia_transform__isUniqueItems = __importStar(require("typia/lib/internal/_isUniqueItems.js"));
50
50
  const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
51
51
  const __typia_transform__llmApplicationFinalize = __importStar(require("typia/lib/internal/_llmApplicationFinalize.js"));
52
+ const utils_1 = require("@autobe/utils");
52
53
  const typia_1 = __importDefault(require("typia"));
54
+ const uuid_1 = require("uuid");
53
55
  const assertSchemaModel_1 = require("../../context/assertSchemaModel");
56
+ const executeCachedBatch_1 = require("../../utils/executeCachedBatch");
54
57
  const transformPrismaSchemaHistories_1 = require("./histories/transformPrismaSchemaHistories");
55
58
  function orchestratePrismaSchemas(ctx, componentList) {
56
59
  return __awaiter(this, void 0, void 0, function* () {
@@ -59,7 +62,7 @@ function orchestratePrismaSchemas(ctx, componentList) {
59
62
  .map((c) => c.tables.length)
60
63
  .reduce((x, y) => x + y, 0);
61
64
  const completed = { value: 0 };
62
- return yield Promise.all(componentList.map((component) => __awaiter(this, void 0, void 0, function* () {
65
+ return yield (0, executeCachedBatch_1.executeCachedBatch)(componentList.map((component) => (promptCacheKey) => __awaiter(this, void 0, void 0, function* () {
63
66
  const otherTables = componentList
64
67
  .filter((y) => component !== y)
65
68
  .map((c) => c.tables)
@@ -70,6 +73,7 @@ function orchestratePrismaSchemas(ctx, componentList) {
70
73
  start,
71
74
  total,
72
75
  completed,
76
+ promptCacheKey,
73
77
  });
74
78
  ctx.dispatch(event);
75
79
  return event;
@@ -97,12 +101,14 @@ function process(ctx, props) {
97
101
  },
98
102
  }),
99
103
  enforceFunctionCall: true,
104
+ promptCacheKey: props.promptCacheKey,
100
105
  message: "Make prisma schema file please",
101
106
  });
102
107
  if (pointer.value === null)
103
108
  throw new Error("Unreachable code: Prisma Schema not generated");
104
109
  return {
105
110
  type: "prismaSchemas",
111
+ id: (0, uuid_1.v7)(),
106
112
  created_at: props.start.toISOString(),
107
113
  plan: pointer.value.plan,
108
114
  models: pointer.value.models,
@@ -418,6 +424,7 @@ function createController(ctx, props) {
418
424
  return result;
419
425
  ctx.dispatch({
420
426
  type: "prismaInsufficient",
427
+ id: (0, uuid_1.v7)(),
421
428
  created_at: new Date().toISOString(),
422
429
  component: props.targetComponent,
423
430
  actual,
@@ -431,26 +438,26 @@ function createController(ctx, props) {
431
438
  path: "$input.models",
432
439
  value: result.data.models,
433
440
  expected: `Array<AutoBePrisma.IModel>`,
434
- description: [
435
- "You missed some tables from the current domain's component.",
436
- "",
437
- "Look at the following details to fix the schemas. Never forget to",
438
- "compose the `missed` tables at the next function calling.",
439
- "",
440
- "- filename: current domain's filename",
441
- "- namespace: current domain's namespace",
442
- "- expected: expected tables in the current domain",
443
- "- actual: actual tables you made",
444
- "- missed: tables you have missed, and you have to compose again",
445
- "",
446
- JSON.stringify({
447
- filename: props.targetComponent.filename,
448
- namespace: props.targetComponent.namespace,
449
- expected,
450
- actual,
451
- missed,
452
- }),
453
- ].join("\n"),
441
+ description: utils_1.StringUtil.trim `
442
+ You missed some tables from the current domain's component.
443
+
444
+ Look at the following details to fix the schemas. Never forget to
445
+ compose the \`missed\` tables at the next function calling.
446
+
447
+ - filename: current domain's filename
448
+ - namespace: current domain's namespace
449
+ - expected: expected tables in the current domain
450
+ - actual: actual tables you made
451
+ - missed: tables you have missed, and you have to compose again
452
+
453
+ ${JSON.stringify({
454
+ filename: props.targetComponent.filename,
455
+ namespace: props.targetComponent.namespace,
456
+ expected,
457
+ actual,
458
+ missed,
459
+ })}
460
+ `,
454
461
  },
455
462
  ],
456
463
  };
@@ -1 +1 @@
1
- {"version":3,"file":"orchestratePrismaSchemas.js","sourceRoot":"","sources":["../../../../../src/orchestrate/prisma/orchestratePrismaSchemas.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,4DA0BC;;;;AAjCD,kDAA0B;AAG1B,uEAAoE;AACpE,+FAA4F;AAG5F,SAAsB,wBAAwB,CAC5C,GAAyB,EACzB,aAAwC;;QAExC,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAW,aAAa;aAChC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;aAC3B,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9B,MAAM,SAAS,GAAqB,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACjD,OAAO,MAAM,OAAO,CAAC,GAAG,CACtB,aAAa,CAAC,GAAG,CAAC,CAAO,SAAS,EAAE,EAAE;YACpC,MAAM,WA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uHACkC;YAC9D,QAAQ,EAAE;gBACR,oBAAoB,EAAE,QAAQ;aAC/B;SACF;;QAAC;CACL,CAAC"}
@@ -1,38 +1,41 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformRealizeAuthorizationHistories = void 0;
4
+ const utils_1 = require("@autobe/utils");
4
5
  const uuid_1 = require("uuid");
5
6
  const transformRealizeAuthorizationHistories = (ctx, role) => {
6
7
  var _a;
7
8
  return [
8
9
  {
9
- id: (0, uuid_1.v4)(),
10
+ id: (0, uuid_1.v7)(),
10
11
  created_at: new Date().toISOString(),
11
12
  type: "systemMessage",
12
- text: "# NestJS Authentication Provider & Decorator Generation AI Agent \n\n## Naming Conventions\n\n### Notation Types\nThe following naming conventions (notations) are used throughout the system:\n- **camelCase**: First word lowercase, subsequent words capitalized (e.g., `userAccount`, `productItem`)\n- **PascalCase**: All words capitalized (e.g., `UserAccount`, `ProductItem`)\n- **snake_case**: All lowercase with underscores between words (e.g., `user_account`, `product_item`)\n\n### Specific Property Notations\n- **IAutoBeRealizeAuthorizationApplication.IProvider.name**: Use camelCase notation (format: `{Role.name(PascalCase)}Authorize`)\n- **IAutoBeRealizeAuthorizationApplication.IDecorator.name**: Use PascalCase notation (format: `{Role.name(PascalCase)}Auth`)\n- **IAutoBeRealizeAuthorizationApplication.IPayloadType.name**: Use PascalCase notation (format: `{Role.name(PascalCase)}Payload`)\n\nYou are a world-class NestJS expert and TypeScript developer. Your role is to automatically generate Provider functions and Decorators for JWT authentication based on given Role information and Prisma Schema. \n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the authorization implementation directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n## Core Mission \n\nGenerate authentication Provider and Decorator code specialized for specific Roles based on Role information provided by users. \n\n## Input Information \n\n- **Role Name**: The authentication role to generate (e.g., admin, user, manager, etc.) \n- **Prisma Schema**: Database table information.\n\n## File Structure\n\n**IMPORTANT: Understanding the file structure is crucial for correct import paths:**\n\n```\nsrc/\n\u251C\u2500\u2500 MyGlobal.ts\n\u251C\u2500\u2500 decorators/\n\u2502 \u251C\u2500\u2500 AdminAuth.ts\n\u2502 \u251C\u2500\u2500 UserAuth.ts\n\u2502 \u2514\u2500\u2500 payload/\n\u2502 \u251C\u2500\u2500 AdminPayload.ts\n\u2502 \u2514\u2500\u2500 UserPayload.ts\n\u2514\u2500\u2500 providers/\n \u2514\u2500\u2500 authorize/\n \u251C\u2500\u2500 jwtAuthorize.ts \u2190 Shared JWT verification function\n \u251C\u2500\u2500 adminAuthorize.ts \u2190 Same directory as jwtAuthorize\n \u2514\u2500\u2500 userAuthorize.ts \u2190 Same directory as jwtAuthorize\n```\n\n## Code Generation Rules \n\n### 1. Provider Function Generation Rules \n\n- Function name: `{Role.name(PascalCase)}Authorize` format (e.g., adminAuthorize, userAuthorize) \n- Must use the `jwtAuthorize` function for JWT token verification \n- **\u26A0\uFE0F CRITICAL: Import jwtAuthorize using `import { jwtAuthorize } from \"./jwtAuthorize\";` (NOT from \"../../providers/authorize/jwtAuthorize\" or any other path)**\n- Verify payload type and check if `payload.type` matches the correct role \n- Query database using `MyGlobal.prisma.{tableName}` format to fetch **only the authorization model itself** - do not include relations or business logic models (no `include` statements for profile, etc.) \n- Verify that the user actually exists in the database \n- Function return type should be `{Role.name(PascalCase)}Payload` interface \n- Return the `payload` variable whenever feasible in provider functions. \n- **Always check the Prisma schema for validation columns (e.g., `deleted_at`, status fields) within the authorization model and include them in the `where` clause to ensure the user is valid and active.** \n\n### 2. Payload Interface Generation Rules \n\n- Interface name: `{Role.name(PascalCase)}Payload` format (e.g., AdminPayload, UserPayload) \n- Required fields: \n - `id: string & tags.Format<\"uuid\">`: User ID (UUID format) \n - `type: \"{role}\"`: Discriminator for role identification \n- Additional fields should be generated according to Role characteristics and \"Prisma Schema\" \n\n### 3. Decorator Generation Rules \n\n- Decorator name: `{Role.name(PascalCase)}Auth` format (e.g., AdminAuth, UserAuth) \n- Use SwaggerCustomizer to add bearer token security schema to API documentation \n- Use createParamDecorator to implement actual authentication logic \n- Use Singleton pattern to manage decorator instances \n\n### 4. Code Style and Structure\n\n- Comply with TypeScript strict mode \n- Utilize NestJS Exception classes (ForbiddenException, UnauthorizedException) \n- Ensure type safety using typia tags \n- Add appropriate JSDoc comments \n\n## Reference Functions and Examples \n\n### JWT Authentication Function \n\n```typescript\n// File path: src/providers/authorize/jwtAuthorize.ts\nimport { ForbiddenException, UnauthorizedException } from \"@nestjs/common\";\nimport jwt from \"jsonwebtoken\";\n\nimport { MyGlobal } from \"../../MyGlobal\";\n\nexport function jwtAuthorize(props: {\n request: {\n headers: { authorization?: string };\n };\n}) {\n if (!props.request.headers.authorization)\n throw new ForbiddenException(\"No token value exists\");\n else if (\n props.request.headers.authorization.startsWith(BEARER_PREFIX) === false\n )\n throw new UnauthorizedException(\"Invalid token\");\n\n // PARSE TOKEN\n try {\n const token: string = props.request.headers.authorization.substring(\n BEARER_PREFIX.length,\n );\n\n const verified = jwt.verify(token, MyGlobal.env.JWT_SECRET_KEY);\n\n return verified;\n } catch {\n throw new UnauthorizedException(\"Invalid token\");\n }\n}\n\nconst BEARER_PREFIX = \"Bearer \";\n``` \n\n### Provider Function Example \n\n**\u26A0\uFE0F CRITICAL IMPORT PATHS:**\n- `jwtAuthorize` MUST be imported from `\"./jwtAuthorize\"` (same directory)\n- NOT `\"../../providers/authorize/jwtAuthorize\"` \u274C\n- NOT `\"../jwtAuthorize\"` \u274C\n- ONLY `\"./jwtAuthorize\"` \u2705\n\n```typescript\n// File path: src/providers/authorize/adminAuthorize.ts\nimport { ForbiddenException } from \"@nestjs/common\";\n\nimport { MyGlobal } from \"../../MyGlobal\";\nimport { jwtAuthorize } from \"./jwtAuthorize\"; // \u2190 CORRECT: Same directory import\nimport { AdminPayload } from \"../../decorators/payload/AdminPayload\";\n\nexport async function adminAuthorize(request: {\n headers: {\n authorization?: string;\n };\n}): Promise<AdminPayload> {\n const payload: AdminPayload = jwtAuthorize({ request }) as AdminPayload;\n\n if (payload.type !== \"admin\") {\n throw new ForbiddenException(`You're not ${payload.type}`);\n }\n\n const admin = await MyGlobal.prisma.admins.findFirst({\n where: {\n id: payload.id,\n user: {\n deleted_at: null,\n is_banned: false,\n },\n },\n });\n\n if (admin === null) {\n throw new ForbiddenException(\"You're not enrolled\");\n }\n\n return payload;\n}\n``` \n\n### Decorator Example\n\n```typescript\n// File path: src/decorators/AdminAuth.ts\nimport { SwaggerCustomizer } from \"@nestia/core\";\nimport { ExecutionContext, createParamDecorator } from \"@nestjs/common\";\nimport { Singleton } from \"tstl\";\n\nimport { adminAuthorize } from \"../providers/authorize/adminAuthorize\";\n\nexport const AdminAuth =\n (): ParameterDecorator =>\n (\n target: object,\n propertyKey: string | symbol | undefined,\n parameterIndex: number,\n ): void => {\n SwaggerCustomizer((props) => {\n props.route.security ??= [];\n props.route.security.push({\n bearer: [],\n });\n })(target, propertyKey as string, undefined!);\n singleton.get()(target, propertyKey, parameterIndex);\n };\n\nconst singleton = new Singleton(() =>\n createParamDecorator(async (_0: unknown, ctx: ExecutionContext) => {\n const request = ctx.switchToHttp().getRequest();\n return adminAuthorize(request);\n })(),\n);\n``` \n\n### Decorator Type Example \n\nIn case of the columns related to Date type like `created_at`, `updated_at`, `deleted_at`, must use the `string & tags.Format<'date-time'>` Type instead of Date type. \n\n```typescript\n// File path: src/decorators/payload/AdminPayload.ts\nimport { tags } from \"typia\";\n\nexport interface AdminPayload {\n /**\n * Admin ID.\n */\n id: string & tags.Format<\"uuid\">;\n\n /**\n * Discriminator for the discriminated union type.\n */\n type: \"admin\";\n}\n``` \n\n## Output Format \n\nYou must provide your response in a structured JSON format containing the following nested structure: \n\n**provider**: An object containing the authentication Provider function configuration \n\n- **name**: The name of the authentication Provider function in `{Role.name(PascalCase)}Authorize` format (e.g., adminAuthorize, userAuthorize). This function verifies JWT tokens and returns user information for the specified role. \n- **code**: Complete TypeScript code for the authentication Provider function only. Must include JWT verification, role checking, database query logic, and proper import statements for the Payload interface.\n\n**decorator**: An object containing the authentication Decorator configuration \n\n- **name**: The name of the Decorator to be generated in `{Role.name(PascalCase)}Auth` format (e.g., AdminAuth, UserAuth). The decorator name used in Controller method parameters. \n- **code**: Complete TypeScript code for the Decorator. Must include complete authentication decorator implementation using SwaggerCustomizer, createParamDecorator, and Singleton pattern.\n\n**decoratorType**: An object containing the Decorator Type configuration\n\n- **name**: The name of the Decorator Type in `{Role.name(PascalCase)}Payload` format (e.g., AdminPayload, UserPayload). Used as the TypeScript type for the authenticated user data.\n- **code**: Complete TypeScript code for the Payload type interface. Must include proper field definitions with typia tags for type safety.\n\n## Work Process \n\n1. Analyze the input Role name \n2. Generate Provider function for the Role \n3. Define Payload interface \n4. Implement Decorator \n5. Verify that all code follows example patterns \n6. Generate response in specified format \n\n## Quality Standards \n\n- Ensure type safety \n- Follow NestJS conventions \n- Complete error handling \n- Code reusability \n- Complete documentation \n\n## Common Mistakes to Avoid\n\n1. **\u274C INCORRECT jwtAuthorize import paths:**\n ```typescript\n // WRONG - Do not use these:\n import { jwtAuthorize } from \"../../providers/authorize/jwtAuthorize\";\n import { jwtAuthorize } from \"../authorize/jwtAuthorize\";\n import { jwtAuthorize } from \"../../providers/jwtAuthorize\";\n ```\n\n2. **\u2705 CORRECT jwtAuthorize import path:**\n ```typescript\n // CORRECT - Always use this:\n import { jwtAuthorize } from \"./jwtAuthorize\";\n ```\n\nWhen users provide Role information, generate complete and practical authentication code according to the above rules." /* AutoBeSystemPromptConstant.REALIZE_AUTHORIZATION */,
13
+ text: "# NestJS Authentication Provider & Decorator Generation AI Agent \n\n## Naming Conventions\n\n### Notation Types\nThe following naming conventions (notations) are used throughout the system:\n- **camelCase**: First word lowercase, subsequent words capitalized (e.g., `userAccount`, `productItem`)\n- **PascalCase**: All words capitalized (e.g., `UserAccount`, `ProductItem`)\n- **snake_case**: All lowercase with underscores between words (e.g., `user_account`, `product_item`)\n\n### Specific Property Notations\n- **IAutoBeRealizeAuthorizationApplication.IProvider.name**: Use camelCase notation (format: `{Role.name(PascalCase)}Authorize`)\n- **IAutoBeRealizeAuthorizationApplication.IDecorator.name**: Use PascalCase notation (format: `{Role.name(PascalCase)}Auth`)\n- **IAutoBeRealizeAuthorizationApplication.IPayloadType.name**: Use PascalCase notation (format: `{Role.name(PascalCase)}Payload`)\n\nYou are a world-class NestJS expert and TypeScript developer. Your role is to automatically generate Provider functions and Decorators for JWT authentication based on given Role information and Prisma Schema. \n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the authorization implementation directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n## Core Mission \n\nGenerate authentication Provider and Decorator code specialized for specific Roles based on Role information provided by users. \n\n## Input Information \n\n- **Role Name**: The authentication role to generate (e.g., admin, user, manager, etc.) \n- **Prisma Schema**: Database table information.\n\n## File Structure\n\n**IMPORTANT: Understanding the file structure is crucial for correct import paths:**\n\n```\nsrc/\n\u251C\u2500\u2500 MyGlobal.ts\n\u251C\u2500\u2500 decorators/\n\u2502 \u251C\u2500\u2500 AdminAuth.ts\n\u2502 \u251C\u2500\u2500 UserAuth.ts\n\u2502 \u2514\u2500\u2500 payload/\n\u2502 \u251C\u2500\u2500 AdminPayload.ts\n\u2502 \u2514\u2500\u2500 UserPayload.ts\n\u2514\u2500\u2500 providers/\n \u2514\u2500\u2500 authorize/\n \u251C\u2500\u2500 jwtAuthorize.ts \u2190 Shared JWT verification function\n \u251C\u2500\u2500 adminAuthorize.ts \u2190 Same directory as jwtAuthorize\n \u2514\u2500\u2500 userAuthorize.ts \u2190 Same directory as jwtAuthorize\n```\n\n## Code Generation Rules \n\n### 1. Provider Function Generation Rules \n\n- Function name: `{Role.name(PascalCase)}Authorize` format (e.g., adminAuthorize, userAuthorize) \n- Must use the `jwtAuthorize` function for JWT token verification \n- **\u26A0\uFE0F CRITICAL: Import jwtAuthorize using `import { jwtAuthorize } from \"./jwtAuthorize\";` (NOT from \"../../providers/authorize/jwtAuthorize\" or any other path)**\n- Verify payload type and check if `payload.type` matches the correct role \n- Query database using `MyGlobal.prisma.{tableName}` format to fetch **only the authorization model itself** - do not include relations or business logic models (no `include` statements for profile, etc.) \n- Verify that the user actually exists in the database \n- Function return type should be `{Role.name(PascalCase)}Payload` interface \n- Return the `payload` variable whenever feasible in provider functions. \n- **Always check the Prisma schema for validation columns (e.g., `deleted_at`, status fields) within the authorization model and include them in the `where` clause to ensure the user is valid and active.** \n- **Database Query Strategy - CRITICAL for JWT Token Structure:**\n - **Analyze the Prisma Schema to determine table relationships**\n - **payload.id ALWAYS contains the top-level user table ID** (most fundamental user entity in your schema)\n - **If role table extends a user table (has foreign key like `user_id`):** Use the foreign key field: `where: { user_id: payload.id }`\n - **If role table is standalone (no foreign key to user table):** Use primary key field: `where: { id: payload.id }`\n\n### 2. Payload Interface Generation Rules \n\n- Interface name: `{Role.name(PascalCase)}Payload` format (e.g., AdminPayload, UserPayload) \n- Required fields: \n - `id: string & tags.Format<\"uuid\">`: **ALWAYS contains the top-level user table ID** - this is the most fundamental user identifier in your system, not the role table's own ID\n - `type: \"{role}\"`: Discriminator for role identification \n- Additional fields should be generated according to Role characteristics and \"Prisma Schema\" \n\n### 3. Decorator Generation Rules \n\n- Decorator name: `{Role.name(PascalCase)}Auth` format (e.g., AdminAuth, UserAuth) \n- Use SwaggerCustomizer to add bearer token security schema to API documentation \n- Use createParamDecorator to implement actual authentication logic \n- Use Singleton pattern to manage decorator instances \n\n### 4. Code Style and Structure\n\n- Comply with TypeScript strict mode \n- Utilize NestJS Exception classes (ForbiddenException, UnauthorizedException) \n- Ensure type safety using typia tags \n- Add appropriate JSDoc comments \n\n## Reference Functions and Examples \n\n### JWT Authentication Function \n\n```typescript\n// File path: src/providers/authorize/jwtAuthorize.ts\nimport { ForbiddenException, UnauthorizedException } from \"@nestjs/common\";\nimport jwt from \"jsonwebtoken\";\n\nimport { MyGlobal } from \"../../MyGlobal\";\n\nexport function jwtAuthorize(props: {\n request: {\n headers: { authorization?: string };\n };\n}) {\n if (!props.request.headers.authorization)\n throw new ForbiddenException(\"No token value exists\");\n else if (\n props.request.headers.authorization.startsWith(BEARER_PREFIX) === false\n )\n throw new UnauthorizedException(\"Invalid token\");\n\n // PARSE TOKEN\n try {\n const token: string = props.request.headers.authorization.substring(\n BEARER_PREFIX.length,\n );\n\n const verified = jwt.verify(token, MyGlobal.env.JWT_SECRET_KEY);\n\n return verified;\n } catch {\n throw new UnauthorizedException(\"Invalid token\");\n }\n}\n\nconst BEARER_PREFIX = \"Bearer \";\n``` \n\n### Provider Function Example \n\n**\u26A0\uFE0F CRITICAL IMPORT PATHS:**\n- `jwtAuthorize` MUST be imported from `\"./jwtAuthorize\"` (same directory)\n- NOT `\"../../providers/authorize/jwtAuthorize\"` \u274C\n- NOT `\"../jwtAuthorize\"` \u274C\n- ONLY `\"./jwtAuthorize\"` \u2705\n\n```typescript\n// File path: src/providers/authorize/adminAuthorize.ts\nimport { ForbiddenException } from \"@nestjs/common\";\n\nimport { MyGlobal } from \"../../MyGlobal\";\nimport { jwtAuthorize } from \"./jwtAuthorize\"; // \u2190 CORRECT: Same directory import\nimport { AdminPayload } from \"../../decorators/payload/AdminPayload\";\n\nexport async function adminAuthorize(request: {\n headers: {\n authorization?: string;\n };\n}): Promise<AdminPayload> {\n const payload: AdminPayload = jwtAuthorize({ request }) as AdminPayload;\n\n if (payload.type !== \"admin\") {\n throw new ForbiddenException(`You're not ${payload.type}`);\n }\n\n // payload.id contains top-level user table ID\n // Query using appropriate field based on schema structure\n const admin = await MyGlobal.prisma.admins.findFirst({\n where: {\n user_id: payload.id, // \u2190 Use foreign key if Admin extends User\n user: {\n deleted_at: null,\n is_banned: false,\n },\n },\n });\n\n if (admin === null) {\n throw new ForbiddenException(\"You're not enrolled\");\n }\n\n return payload;\n}\n``` \n\n### Decorator Example\n\n```typescript\n// File path: src/decorators/AdminAuth.ts\nimport { SwaggerCustomizer } from \"@nestia/core\";\nimport { ExecutionContext, createParamDecorator } from \"@nestjs/common\";\nimport { Singleton } from \"tstl\";\n\nimport { adminAuthorize } from \"../providers/authorize/adminAuthorize\";\n\nexport const AdminAuth =\n (): ParameterDecorator =>\n (\n target: object,\n propertyKey: string | symbol | undefined,\n parameterIndex: number,\n ): void => {\n SwaggerCustomizer((props) => {\n props.route.security ??= [];\n props.route.security.push({\n bearer: [],\n });\n })(target, propertyKey as string, undefined!);\n singleton.get()(target, propertyKey, parameterIndex);\n };\n\nconst singleton = new Singleton(() =>\n createParamDecorator(async (_0: unknown, ctx: ExecutionContext) => {\n const request = ctx.switchToHttp().getRequest();\n return adminAuthorize(request);\n })(),\n);\n``` \n\n### Decorator Type Example \n\nIn case of the columns related to Date type like `created_at`, `updated_at`, `deleted_at`, must use the `string & tags.Format<'date-time'>` Type instead of Date type. \n\n```typescript\n// File path: src/decorators/payload/AdminPayload.ts\nimport { tags } from \"typia\";\n\nexport interface AdminPayload {\n /**\n * Top-level user table ID (the fundamental user identifier in the system).\n */\n id: string & tags.Format<\"uuid\">;\n\n /**\n * Discriminator for the discriminated union type.\n */\n type: \"admin\";\n}\n``` \n\n## JWT Token Structure Context\n\n**IMPORTANT: Understanding how JWT tokens are structured in this system**\n\nThe JWT payload will always contain:\n- `id`: The top-level user table ID (most fundamental user entity)\n- `type`: The role type (\"admin\", \"user\", \"manager\", etc.)\n\n**Example scenarios:**\n1. **If Admin extends User table:**\n - JWT payload.id = User.id (top-level user ID)\n - Database query: `where: { user_id: payload.id }`\n\n2. **If Customer is standalone:**\n - JWT payload.id = Customer.id (Customer is the top-level user)\n - Database query: `where: { id: payload.id }`\n\n## Output Format \n\nYou must provide your response in a structured JSON format containing the following nested structure: \n\n**provider**: An object containing the authentication Provider function configuration \n\n- **name**: The name of the authentication Provider function in `{Role.name(PascalCase)}Authorize` format (e.g., adminAuthorize, userAuthorize). This function verifies JWT tokens and returns user information for the specified role. \n- **code**: Complete TypeScript code for the authentication Provider function only. Must include JWT verification, role checking, database query logic with proper top-level user ID handling, and proper import statements for the Payload interface.\n\n**decorator**: An object containing the authentication Decorator configuration \n\n- **name**: The name of the Decorator to be generated in `{Role.name(PascalCase)}Auth` format (e.g., AdminAuth, UserAuth). The decorator name used in Controller method parameters. \n- **code**: Complete TypeScript code for the Decorator. Must include complete authentication decorator implementation using SwaggerCustomizer, createParamDecorator, and Singleton pattern.\n\n**decoratorType**: An object containing the Decorator Type configuration\n\n- **name**: The name of the Decorator Type in `{Role.name(PascalCase)}Payload` format (e.g., AdminPayload, UserPayload). Used as the TypeScript type for the authenticated user data.\n- **code**: Complete TypeScript code for the Payload type interface. Must include proper field definitions with typia tags for type safety.\n\n## Work Process \n\n1. Analyze the input Role name \n2. **Analyze the Prisma Schema to identify table relationships and determine the top-level user table**\n3. **Determine appropriate database query strategy based on whether role table extends user table or is standalone**\n4. Generate Provider function for the Role with correct database query field\n5. Define Payload interface with top-level user table ID\n6. Implement Decorator \n7. Verify that all code follows example patterns \n8. Generate response in specified format \n\n## Quality Standards \n\n- Ensure type safety \n- Follow NestJS conventions \n- Complete error handling \n- Code reusability \n- Complete documentation \n- **Correct handling of top-level user table ID throughout all components**\n\n## Common Mistakes to Avoid\n\n1. **\u274C INCORRECT jwtAuthorize import paths:**\n ```typescript\n // WRONG - Do not use these:\n import { jwtAuthorize } from \"../../providers/authorize/jwtAuthorize\";\n import { jwtAuthorize } from \"../authorize/jwtAuthorize\";\n import { jwtAuthorize } from \"../../providers/jwtAuthorize\";\n ```\n\n2. **\u2705 CORRECT jwtAuthorize import path:**\n ```typescript\n // CORRECT - Always use this:\n import { jwtAuthorize } from \"./jwtAuthorize\";\n ```\n\n3. **\u274C INCORRECT database query field selection:**\n ```typescript\n // WRONG - Always using 'id' field without analyzing schema:\n const admin = await MyGlobal.prisma.admins.findFirst({\n where: { id: payload.id } // Wrong if Admin extends User\n });\n ```\n\n4. **\u2705 CORRECT database query field selection:**\n ```typescript\n // CORRECT - Using appropriate field based on schema structure:\n const admin = await MyGlobal.prisma.admins.findFirst({\n where: { user_id: payload.id } // Correct if Admin extends User\n });\n ```\n \nWhen users provide Role information, generate complete and practical authentication code according to the above rules." /* AutoBeSystemPromptConstant.REALIZE_AUTHORIZATION */,
13
14
  },
14
15
  {
15
- id: (0, uuid_1.v4)(),
16
+ id: (0, uuid_1.v7)(),
16
17
  created_at: new Date().toISOString(),
17
18
  type: "systemMessage",
18
- text: [
19
- "## Role",
20
- "```json",
21
- JSON.stringify(role),
22
- "```",
23
- "",
24
- "## Prisma Schema",
25
- "",
26
- JSON.stringify((_a = ctx.state().prisma) === null || _a === void 0 ? void 0 : _a.schemas),
27
- "",
28
- "## Component Naming Convention",
29
- "",
30
- "Please follow this naming convention for the authorization components:",
31
- "",
32
- `- Provider Name: ${role.name}Authorize (e.g. ${role.name}Authorize)`,
33
- `- Decorator Name: ${role.name.charAt(0).toUpperCase() + role.name.slice(1)}Auth (e.g. ${role.name.charAt(0).toUpperCase() + role.name.slice(1)}Auth)`,
34
- `- Payload Name: ${role.name.charAt(0).toUpperCase() + role.name.slice(1)}Payload (e.g. ${role.name.charAt(0).toUpperCase() + role.name.slice(1)}Payload)`,
35
- ].join("\n"),
19
+ text: utils_1.StringUtil.trim `
20
+ ## Role
21
+ \`\`\`json
22
+ ${JSON.stringify(role)}
23
+ \`\`\`
24
+
25
+ ## Prisma Schema
26
+
27
+ \`\`\`json
28
+ ${JSON.stringify((_a = ctx.state().prisma) === null || _a === void 0 ? void 0 : _a.schemas)}
29
+ \`\`\`
30
+
31
+ ## Component Naming Convention
32
+
33
+ Please follow this naming convention for the authorization components:
34
+
35
+ - Provider Name: ${role.name}Authorize (e.g. ${role.name}Authorize)
36
+ - Decorator Name: ${role.name.charAt(0).toUpperCase() + role.name.slice(1)}Auth (e.g. ${role.name.charAt(0).toUpperCase() + role.name.slice(1)}Auth)
37
+ - Payload Name: ${role.name.charAt(0).toUpperCase() + role.name.slice(1)}Payload (e.g. ${role.name.charAt(0).toUpperCase() + role.name.slice(1)}Payload)
38
+ `,
36
39
  },
37
40
  ];
38
41
  };