@autobe/agent 0.24.2 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/lib/AutoBeAgent.js +11 -1
  2. package/lib/AutoBeAgent.js.map +1 -1
  3. package/lib/AutoBeMockAgent.js +1 -0
  4. package/lib/AutoBeMockAgent.js.map +1 -1
  5. package/lib/constants/AutoBeSystemPromptConstant.d.ts +21 -21
  6. package/lib/context/IAutoBeApplication.d.ts +101 -6
  7. package/lib/context/IAutoBeApplicationProps.d.ts +6 -2
  8. package/lib/factory/createAgenticaHistory.js +1 -1
  9. package/lib/factory/createAgenticaHistory.js.map +1 -1
  10. package/lib/factory/createAutoBeApplication.js +80 -90
  11. package/lib/factory/createAutoBeApplication.js.map +1 -1
  12. package/lib/factory/createAutoBeContext.js +6 -5
  13. package/lib/factory/createAutoBeContext.js.map +1 -1
  14. package/lib/index.mjs +3914 -2594
  15. package/lib/index.mjs.map +1 -1
  16. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +5 -1
  17. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
  18. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.d.ts +1 -1
  19. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +18 -3
  20. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  21. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +5 -1
  22. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +19 -7
  23. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  24. package/lib/orchestrate/analyze/orchestrateAnalyze.js +3 -2
  25. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  26. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.d.ts +1 -1
  27. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +2 -2
  28. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  29. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +1 -0
  30. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -2
  31. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  32. package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +1 -1
  33. package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
  34. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +36 -23
  35. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
  36. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.d.ts +22 -42
  37. package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
  38. package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
  39. package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js +2 -1
  40. package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
  41. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +5 -1
  42. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +20 -7
  43. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  44. package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.d.ts +3 -0
  45. package/lib/orchestrate/interface/histories/{transformInterfacePrerequisiteHistories.js → transformInterfaceCommonPrerequisiteHistories.js} +4 -4
  46. package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.js.map +1 -0
  47. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.d.ts +6 -1
  48. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +31 -23
  49. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  50. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.d.ts +6 -1
  51. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +22 -6
  52. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  53. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +1 -1
  54. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
  55. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.d.ts +4 -1
  56. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +27 -6
  57. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  58. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.d.ts +5 -1
  59. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +21 -5
  60. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  61. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +1 -1
  62. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  63. package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.d.ts +3 -0
  64. package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js +102 -0
  65. package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js.map +1 -0
  66. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +5 -1
  67. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +20 -4
  68. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  69. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
  70. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  71. package/lib/orchestrate/interface/orchestrateInterface.js +45 -11
  72. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  73. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +1 -1
  74. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +277 -37
  75. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  76. package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +4 -1
  77. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +69 -70
  78. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  79. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.d.ts +6 -1
  80. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +28 -13
  81. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  82. package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +4 -1
  83. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +11 -8
  84. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  85. package/lib/orchestrate/interface/orchestrateInterfaceOperations.d.ts +5 -1
  86. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +36 -21
  87. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  88. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +260 -29
  89. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  90. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.d.ts +5 -0
  91. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +713 -0
  92. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -0
  93. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.d.ts +5 -1
  94. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +83 -53
  95. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  96. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js +41 -7
  97. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
  98. package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +0 -38
  99. package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +6 -10
  100. package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.d.ts +52 -0
  101. package/lib/orchestrate/{common/structures/IAutoBeCommonCorrectDateApplication.js → interface/structures/IAutoBeInterfacePrerequisitesApplication.js} +1 -1
  102. package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.js.map +1 -0
  103. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +0 -33
  104. package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +6 -2
  105. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +105 -5
  106. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
  107. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +20 -1
  108. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
  109. package/lib/orchestrate/interface/utils/OperationValidator.d.ts +3 -4
  110. package/lib/orchestrate/interface/utils/OperationValidator.js +1 -1
  111. package/lib/orchestrate/interface/utils/OperationValidator.js.map +1 -1
  112. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.d.ts +4 -1
  113. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +19 -8
  114. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  115. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
  116. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  117. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.d.ts +6 -1
  118. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +20 -6
  119. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  120. package/lib/orchestrate/prisma/orchestratePrisma.js +3 -3
  121. package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  122. package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -1
  123. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +6 -3
  124. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  125. package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +1 -1
  126. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +12 -6
  127. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  128. package/lib/orchestrate/{common/histories/transformCommonCorrectDateHistories.d.ts → realize/histories/transformRealizeCorrectCastingHistories.d.ts} +1 -2
  129. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +32 -0
  130. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -0
  131. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +14 -22
  132. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  133. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +6 -6
  134. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +8 -2
  135. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  136. package/lib/orchestrate/realize/internal/compileRealizeFiles.js +1 -2
  137. package/lib/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
  138. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.d.ts +2 -1
  139. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js +119 -42
  140. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +1 -1
  141. package/lib/orchestrate/realize/orchestrateRealize.js +82 -52
  142. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  143. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +128 -88
  144. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  145. package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -1
  146. package/lib/orchestrate/realize/orchestrateRealizeWrite.js +117 -54
  147. package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  148. package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +52 -26
  149. package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +44 -34
  150. package/lib/orchestrate/realize/utils/InternalFileSystem.js +1 -1
  151. package/lib/orchestrate/realize/utils/InternalFileSystem.js.map +1 -1
  152. package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -5
  153. package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
  154. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +8 -3
  155. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +44 -17
  156. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
  157. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +4 -1
  158. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js +24 -9
  159. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -1
  160. package/lib/orchestrate/realize/utils/printErrorHints.d.ts +8 -0
  161. package/lib/orchestrate/realize/utils/printErrorHints.js +48 -0
  162. package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -0
  163. package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +1 -0
  164. package/lib/orchestrate/realize/utils/replaceImportStatements.js +93 -53
  165. package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  166. package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +5 -1
  167. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +11 -7
  168. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  169. package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +1 -1
  170. package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
  171. package/lib/orchestrate/test/histories/transformTestScenarioHistories.d.ts +7 -1
  172. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +35 -96
  173. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  174. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.d.ts +6 -3
  175. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +33 -77
  176. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
  177. package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +5 -1
  178. package/lib/orchestrate/test/histories/transformTestWriteHistories.js +111 -94
  179. package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  180. package/lib/orchestrate/test/orchestrateTest.js +20 -14
  181. package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
  182. package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +4 -1
  183. package/lib/orchestrate/test/orchestrateTestCorrect.js +81 -50
  184. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  185. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +31 -13
  186. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
  187. package/lib/orchestrate/test/orchestrateTestScenario.d.ts +1 -1
  188. package/lib/orchestrate/test/orchestrateTestScenario.js +18 -7
  189. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  190. package/lib/orchestrate/test/orchestrateTestScenarioReview.d.ts +5 -1
  191. package/lib/orchestrate/test/orchestrateTestScenarioReview.js +20 -12
  192. package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
  193. package/lib/orchestrate/test/orchestrateTestWrite.d.ts +4 -1
  194. package/lib/orchestrate/test/orchestrateTestWrite.js +46 -25
  195. package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  196. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +9 -5
  197. package/lib/orchestrate/test/structures/IAutoBeTestCorrectInvalidRequestApplication.d.ts +8 -2
  198. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +11 -7
  199. package/lib/orchestrate/test/utils/getPrerequisites.d.ts +5 -0
  200. package/lib/orchestrate/test/utils/getPrerequisites.js +36 -0
  201. package/lib/orchestrate/test/utils/getPrerequisites.js.map +1 -0
  202. package/lib/orchestrate/test/utils/getReferenceIds.js +1 -1
  203. package/lib/orchestrate/test/utils/getReferenceIds.js.map +1 -1
  204. package/package.json +5 -5
  205. package/src/AutoBeAgent.ts +17 -1
  206. package/src/AutoBeMockAgent.ts +1 -0
  207. package/src/constants/AutoBeSystemPromptConstant.ts +21 -21
  208. package/src/context/IAutoBeApplication.ts +101 -6
  209. package/src/context/IAutoBeApplicationProps.ts +6 -2
  210. package/src/factory/createAgenticaHistory.ts +11 -5
  211. package/src/factory/createAutoBeContext.ts +6 -5
  212. package/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts +5 -1
  213. package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +16 -0
  214. package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +22 -7
  215. package/src/orchestrate/analyze/orchestrateAnalyze.ts +3 -2
  216. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +2 -1
  217. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +3 -2
  218. package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +2 -2
  219. package/src/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.ts +25 -45
  220. package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +2 -1
  221. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +23 -9
  222. package/src/orchestrate/interface/histories/{transformInterfacePrerequisiteHistories.ts → transformInterfaceCommonPrerequisiteHistories.ts} +1 -1
  223. package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +33 -24
  224. package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +26 -9
  225. package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +30 -6
  226. package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +24 -7
  227. package/src/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.ts +118 -0
  228. package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +23 -6
  229. package/src/orchestrate/interface/orchestrateInterface.ts +65 -20
  230. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +22 -12
  231. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +34 -47
  232. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +40 -28
  233. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +9 -3
  234. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +51 -35
  235. package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +274 -0
  236. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +52 -33
  237. package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +1 -1
  238. package/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.ts +0 -39
  239. package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +6 -10
  240. package/src/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.ts +58 -0
  241. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +0 -34
  242. package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +92 -4
  243. package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +19 -1
  244. package/src/orchestrate/interface/utils/OperationValidator.ts +9 -7
  245. package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +20 -6
  246. package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +24 -9
  247. package/src/orchestrate/prisma/orchestratePrisma.ts +7 -3
  248. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +5 -1
  249. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +15 -10
  250. package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +44 -0
  251. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -24
  252. package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +6 -6
  253. package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +6 -4
  254. package/src/orchestrate/realize/internal/compileRealizeFiles.ts +1 -5
  255. package/src/orchestrate/realize/orchestRateRealizeCorrectCasting.ts +102 -16
  256. package/src/orchestrate/realize/orchestrateRealize.ts +121 -81
  257. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +50 -7
  258. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +14 -4
  259. package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +54 -29
  260. package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +46 -35
  261. package/src/orchestrate/realize/utils/InternalFileSystem.ts +1 -1
  262. package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -5
  263. package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +54 -22
  264. package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +28 -16
  265. package/src/orchestrate/realize/utils/printErrorHints.ts +55 -0
  266. package/src/orchestrate/realize/utils/replaceImportStatements.ts +99 -97
  267. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +14 -7
  268. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +50 -115
  269. package/src/orchestrate/test/histories/transformTestScenarioReviewHistories.ts +41 -111
  270. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +35 -12
  271. package/src/orchestrate/test/orchestrateTest.ts +19 -13
  272. package/src/orchestrate/test/orchestrateTestCorrect.ts +71 -51
  273. package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +13 -1
  274. package/src/orchestrate/test/orchestrateTestScenario.ts +27 -17
  275. package/src/orchestrate/test/orchestrateTestScenarioReview.ts +32 -19
  276. package/src/orchestrate/test/orchestrateTestWrite.ts +20 -10
  277. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +9 -228
  278. package/src/orchestrate/test/structures/IAutoBeTestCorrectInvalidRequestApplication.ts +8 -2
  279. package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +11 -78
  280. package/src/orchestrate/test/utils/getPrerequisites.ts +51 -0
  281. package/src/orchestrate/test/utils/getReferenceIds.ts +2 -1
  282. package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js +0 -48
  283. package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js.map +0 -1
  284. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.d.ts +0 -35
  285. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.js.map +0 -1
  286. package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.d.ts +0 -3
  287. package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js.map +0 -1
  288. package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.d.ts +0 -6
  289. package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js +0 -22
  290. package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js.map +0 -1
  291. package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.d.ts +0 -4
  292. package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js +0 -540
  293. package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js.map +0 -1
  294. package/src/orchestrate/common/histories/transformCommonCorrectDateHistories.ts +0 -60
  295. package/src/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.ts +0 -40
  296. package/src/orchestrate/interface/utils/OpenApiEndpointComparator.ts +0 -23
  297. package/src/orchestrate/realize/orchestrateRealizeCorrectDate.ts +0 -372
@@ -1,8 +1,12 @@
1
- import { AutoBeOpenApi } from "@autobe/interface";
1
+ import { AutoBeOpenApi, AutoBePrisma } from "@autobe/interface";
2
2
  import { AutoBeOpenApiTypeChecker, StringUtil } from "@autobe/utils";
3
+ import { OpenApiTypeChecker } from "@samchon/openapi";
3
4
  import typia, { tags } from "typia";
4
5
 
5
6
  export namespace JsonSchemaFactory {
7
+ /* -----------------------------------------------------------
8
+ ASSIGNMENTS
9
+ ----------------------------------------------------------- */
6
10
  export const presets = (
7
11
  typeNames: Set<string>,
8
12
  ): Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> => {
@@ -44,6 +48,77 @@ export namespace JsonSchemaFactory {
44
48
  }
45
49
  };
46
50
 
51
+ export const finalize = (props: {
52
+ document: AutoBeOpenApi.IDocument;
53
+ application: AutoBePrisma.IApplication;
54
+ }): void => {
55
+ removeUnused(props.document);
56
+ fixTimestamps(props);
57
+ };
58
+
59
+ const removeUnused = (document: AutoBeOpenApi.IDocument): void => {
60
+ const used: Set<string> = new Set();
61
+ const visit = (schema: AutoBeOpenApi.IJsonSchema): void =>
62
+ OpenApiTypeChecker.visit({
63
+ components: { schemas: document.components.schemas },
64
+ schema,
65
+ closure: (next) => {
66
+ if (OpenApiTypeChecker.isReference(next)) {
67
+ const key: string = next.$ref.split("/").pop()!;
68
+ used.add(key);
69
+ }
70
+ },
71
+ });
72
+
73
+ for (const op of document.operations) {
74
+ if (op.requestBody !== null)
75
+ visit({
76
+ $ref: `#/components/schemas/${op.requestBody.typeName}`,
77
+ });
78
+ if (op.responseBody !== null)
79
+ visit({
80
+ $ref: `#/components/schemas/${op.responseBody.typeName}`,
81
+ });
82
+ }
83
+ for (const key of Object.keys(document.components.schemas))
84
+ if (used.has(key) === false) delete document.components.schemas[key];
85
+ };
86
+
87
+ const fixTimestamps = (props: {
88
+ document: AutoBeOpenApi.IDocument;
89
+ application: AutoBePrisma.IApplication;
90
+ }): void => {
91
+ const entireModels: AutoBePrisma.IModel[] = props.application.files
92
+ .map((f) => f.models)
93
+ .flat();
94
+ for (const value of Object.values(props.document.components.schemas)) {
95
+ if (AutoBeOpenApiTypeChecker.isObject(value) === false) continue;
96
+
97
+ const model: AutoBePrisma.IModel | undefined = value[
98
+ "x-autobe-prisma-schema"
99
+ ]
100
+ ? entireModels.find((m) => m.name === value["x-autobe-prisma-schema"])
101
+ : undefined;
102
+ if (model === undefined) continue;
103
+
104
+ const properties: string[] = Object.keys(value.properties);
105
+ for (const key of properties) {
106
+ if (
107
+ key !== "created_at" &&
108
+ key !== "updated_at" &&
109
+ key !== "deleted_at"
110
+ )
111
+ continue;
112
+ const column: AutoBePrisma.IPlainField | undefined =
113
+ model.plainFields.find((c) => c.name === key);
114
+ if (column === undefined) delete value.properties[key];
115
+ }
116
+ }
117
+ };
118
+
119
+ /* -----------------------------------------------------------
120
+ PAGINATION
121
+ ----------------------------------------------------------- */
47
122
  export const page = (
48
123
  key: string,
49
124
  ): AutoBeOpenApi.IJsonSchemaDescriptive.IObject => ({
@@ -69,7 +144,7 @@ export namespace JsonSchemaFactory {
69
144
  `,
70
145
  });
71
146
 
72
- export const fix = (path: string, input: unknown): void => {
147
+ export const fixPage = (path: string, input: unknown): void => {
73
148
  if (isRecord(input) === false || isRecord(input[path]) === false) return;
74
149
 
75
150
  if (input[path].description) delete input[path].description;
@@ -99,8 +174,8 @@ export namespace JsonSchemaFactory {
99
174
  const DEFAULT_SCHEMAS = typia.assertEquals<
100
175
  Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>
101
176
  >(
102
- typia.json.schemas<[IPage.IPagination, IAuthorizationToken]>().components
103
- ?.schemas,
177
+ typia.json.schemas<[IPage.IPagination, IPage.IRequest, IAuthorizationToken]>()
178
+ .components?.schemas,
104
179
  );
105
180
 
106
181
  namespace IPage {
@@ -122,6 +197,19 @@ namespace IPage {
122
197
  */
123
198
  pages: number & tags.Type<"uint32">;
124
199
  }
200
+
201
+ /** Page request data */
202
+ export interface IRequest {
203
+ /** Page number. */
204
+ page?: null | (number & tags.Type<"uint32">);
205
+
206
+ /**
207
+ * Limitation of records per a page.
208
+ *
209
+ * @default 100
210
+ */
211
+ limit?: null | (number & tags.Type<"uint32">);
212
+ }
125
213
  }
126
214
 
127
215
  /**
@@ -41,7 +41,25 @@ export namespace JsonSchemaValidator {
41
41
  it to a valid variable name at the next time.
42
42
  `,
43
43
  });
44
- if (props.key === "IPageIRequest")
44
+ if (props.key.endsWith(".IPage")) {
45
+ const expected: string = `IPage${props.key.substring(0, props.key.length - 6)}`;
46
+ props.errors.push({
47
+ path: `${props.path}[${JSON.stringify(props.key)}]`,
48
+ expected: `"IPage" must be followed by another interface name. Use ${JSON.stringify(expected)} instead.`,
49
+ value: props.key,
50
+ description: StringUtil.trim`
51
+ "IPage" is a reserved type name for pagination response.
52
+ The pagination data type name must be post-fixed after "IPage".
53
+
54
+ However, you've defined ${JSON.stringify(props.key)},
55
+ post-fixing ".IPage" after the pagination data type name.
56
+
57
+ Change it to a valid pagination type name to be
58
+ ${JSON.stringify(expected)} at the next time. Note that,
59
+ this is not a recommendation, but an instruction you must follow.
60
+ `,
61
+ });
62
+ } else if (props.key === "IPageIRequest")
45
63
  props.errors.push({
46
64
  path: `${props.path}[${JSON.stringify(props.key)}]`,
47
65
  expected: `"IPageIRequest" is a mistake. Use "IPage.IRequest" instead.`,
@@ -1,5 +1,5 @@
1
1
  import { AutoBeOpenApi } from "@autobe/interface";
2
- import { AutoBeEndpointComparator, StringUtil } from "@autobe/utils";
2
+ import { AutoBeOpenApiEndpointComparator, StringUtil } from "@autobe/utils";
3
3
  import { HashMap } from "tstl";
4
4
  import { IValidation } from "typia";
5
5
  import { Escaper } from "typia/lib/utils/Escaper";
@@ -8,14 +8,16 @@ import { emplaceMap } from "../../../utils/emplaceMap";
8
8
  import { JsonSchemaValidator } from "./JsonSchemaValidator";
9
9
 
10
10
  export namespace OperationValidator {
11
- export interface IProps {
11
+ export const validate = (props: {
12
12
  errors: IValidation.IError[];
13
13
  path: string;
14
14
  operations: Array<
15
- Omit<AutoBeOpenApi.IOperation, "authorizationRole" | "authorizationType">
15
+ Omit<
16
+ AutoBeOpenApi.IOperation,
17
+ "authorizationRole" | "authorizationType" | "prerequisites"
18
+ >
16
19
  >;
17
- }
18
- export const validate = (props: IProps): void => {
20
+ }): void => {
19
21
  props.operations.forEach((op, i) => {
20
22
  // get method has request body
21
23
  if (op.method === "get" && op.requestBody !== null)
@@ -59,8 +61,8 @@ export namespace OperationValidator {
59
61
 
60
62
  // validate duplicated endpoints
61
63
  const endpoints: HashMap<AutoBeOpenApi.IEndpoint, number[]> = new HashMap(
62
- AutoBeEndpointComparator.hashCode,
63
- AutoBeEndpointComparator.equals,
64
+ AutoBeOpenApiEndpointComparator.hashCode,
65
+ AutoBeOpenApiEndpointComparator.equals,
64
66
  );
65
67
  props.operations.forEach((op, i) => {
66
68
  const key: AutoBeOpenApi.IEndpoint = {
@@ -8,14 +8,17 @@ import { AutoBeState } from "../../../context/AutoBeState";
8
8
 
9
9
  export const transformPrismaComponentsHistories = (
10
10
  state: AutoBeState,
11
- prefix: string | null = null,
11
+ props: {
12
+ prefix: string | null;
13
+ instruction: string;
14
+ },
12
15
  ): Array<
13
16
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
14
17
  > => {
15
18
  if (state.analyze === null)
16
19
  // unreachable
17
20
  throw new Error("Analyze state is not set.");
18
- if (prefix) prefix = NamingConvention.snake(prefix);
21
+ if (props.prefix) props.prefix = NamingConvention.snake(props.prefix);
19
22
  return [
20
23
  {
21
24
  id: v7(),
@@ -28,20 +31,20 @@ export const transformPrismaComponentsHistories = (
28
31
  created_at: new Date().toISOString(),
29
32
  type: "assistantMessage",
30
33
  text: StringUtil.trim`
34
+ ## Requirement Analysis Report
35
+
31
36
  Here is the requirement analysis report.
32
37
 
33
38
  Call the provided tool function to generate Prisma DB schema
34
39
  referencing below requirement analysis report.
35
40
 
36
- ## Requirement Analysis Report
37
-
38
41
  \`\`\`json
39
42
  ${JSON.stringify(state.analyze.files)}
40
43
  \`\`\`
41
44
 
42
45
  ## Prefix
43
46
 
44
- - Prefix provided by the user: ${prefix}
47
+ - Prefix provided by the user: ${props.prefix}
45
48
 
46
49
  The user wants all database schema (table) names to start with the prefix provided below.
47
50
 
@@ -74,11 +77,22 @@ export const transformPrismaComponentsHistories = (
74
77
  Create separate tables for each role:
75
78
 
76
79
  ${state.analyze.roles
77
- .map((role) => `- ${prefix}_${role.name.toLowerCase()}`)
80
+ .map((role) => `- ${props.prefix}_${role.name.toLowerCase()}`)
78
81
  .join("\n")}
79
82
  `
80
83
  : ""
81
84
  }
85
+
86
+ ## Database Design Instructions
87
+
88
+ The following database-specific instructions were extracted by AI from
89
+ the user's utterances. These focus ONLY on database schema design aspects
90
+ such as table structure, relationships, constraints, and indexing strategies.
91
+
92
+ Reference these instructions when designing namespace components and
93
+ DB table names.
94
+
95
+ ${props.instruction}
82
96
  `,
83
97
  },
84
98
  ];
@@ -5,11 +5,12 @@ import { v7 } from "uuid";
5
5
 
6
6
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
7
7
 
8
- export const transformPrismaSchemaHistories = (
9
- requirementAnalysisReport: Record<string, string>,
10
- targetComponent: AutoBePrisma.IComponent,
11
- otherTables: string[],
12
- ): Array<
8
+ export const transformPrismaSchemaHistories = (props: {
9
+ analysis: Record<string, string>;
10
+ targetComponent: AutoBePrisma.IComponent;
11
+ otherTables: string[];
12
+ instruction: string;
13
+ }): Array<
13
14
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
14
15
  > => {
15
16
  return [
@@ -27,7 +28,7 @@ export const transformPrismaSchemaHistories = (
27
28
  Here is the requirement analysis report:
28
29
 
29
30
  \`\`\`json
30
- ${JSON.stringify(requirementAnalysisReport)}
31
+ ${JSON.stringify(props.analysis)}
31
32
  \`\`\`
32
33
  `,
33
34
  },
@@ -36,12 +37,26 @@ export const transformPrismaSchemaHistories = (
36
37
  created_at: new Date().toISOString(),
37
38
  type: "assistantMessage",
38
39
  text: StringUtil.trim`
40
+ ## Database Design Instructions
41
+
42
+ The following database-specific instructions were extracted by AI from
43
+ the user's utterances. These focus ONLY on database schema design aspects
44
+ such as table structure, relationships, constraints, and indexing strategies.
45
+
46
+ Reference these instructions when designing the DB schema for this specific
47
+ component. If the instruction is not related to the current domain or
48
+ component, you may ignore it.
49
+
50
+ ${props.instruction}
51
+
52
+ ## Target Component
53
+
39
54
  Here is the input data for generating Prisma DB schema.
40
55
 
41
56
  \`\`\`json
42
57
  ${JSON.stringify({
43
- targetComponent,
44
- otherTables,
58
+ targetComponent: props.targetComponent,
59
+ otherTables: props.otherTables,
45
60
  })}
46
61
  \`\`\`
47
62
  `,
@@ -58,7 +73,7 @@ export const transformPrismaSchemaHistories = (
58
73
 
59
74
  \`\`\`json
60
75
  ${JSON.stringify({
61
- targetComponent,
76
+ targetComponent: props.targetComponent,
62
77
  })}
63
78
  \`\`\`
64
79
  `,
@@ -39,18 +39,22 @@ export const orchestratePrisma = async <Model extends ILlmSchema.Model>(
39
39
  type: "prismaStart",
40
40
  id: v7(),
41
41
  created_at: start.toISOString(),
42
- reason: props.reason,
42
+ reason: props.instruction,
43
43
  step: ctx.state().analyze?.step ?? 0,
44
44
  });
45
45
 
46
46
  // COMPONENTS
47
47
  const componentEvent: AutoBePrismaComponentsEvent =
48
- await orchestratePrismaComponents(ctx);
48
+ await orchestratePrismaComponents(ctx, props.instruction);
49
49
  ctx.dispatch(componentEvent);
50
50
 
51
51
  // CONSTRUCT AST DATA
52
52
  const schemaEvents: AutoBePrismaSchemasEvent[] =
53
- await orchestratePrismaSchemas(ctx, componentEvent.components);
53
+ await orchestratePrismaSchemas(
54
+ ctx,
55
+ props.instruction,
56
+ componentEvent.components,
57
+ );
54
58
  const application: AutoBePrisma.IApplication = {
55
59
  files: schemaEvents.map((e) => e.file),
56
60
  };
@@ -14,6 +14,7 @@ export async function orchestratePrismaComponents<
14
14
  Model extends ILlmSchema.Model,
15
15
  >(
16
16
  ctx: AutoBeContext<Model>,
17
+ instruction: string,
17
18
  message: string = "Design database from the given requirement analysis documents.",
18
19
  ): Promise<AutoBePrismaComponentsEvent> {
19
20
  const start: Date = new Date();
@@ -23,7 +24,10 @@ export async function orchestratePrismaComponents<
23
24
  const prefix: string | null = ctx.state().analyze?.prefix ?? null;
24
25
  const { tokenUsage } = await ctx.conversate({
25
26
  source: "prismaComponents",
26
- histories: transformPrismaComponentsHistories(ctx.state(), prefix),
27
+ histories: transformPrismaComponentsHistories(ctx.state(), {
28
+ prefix,
29
+ instruction,
30
+ }),
27
31
  controller: createController({
28
32
  model: ctx.model,
29
33
  build: (next) => {
@@ -15,6 +15,7 @@ import { IAutoBePrismaSchemaApplication } from "./structures/IAutoBePrismaSchema
15
15
 
16
16
  export async function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(
17
17
  ctx: AutoBeContext<Model>,
18
+ instruction: string,
18
19
  componentList: AutoBePrisma.IComponent[],
19
20
  ): Promise<AutoBePrismaSchemasEvent[]> {
20
21
  const start: Date = new Date();
@@ -29,6 +30,7 @@ export async function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(
29
30
  .map((c) => c.tables)
30
31
  .flat();
31
32
  const event: AutoBePrismaSchemasEvent = await process(ctx, {
33
+ instruction,
32
34
  component,
33
35
  otherTables,
34
36
  start,
@@ -45,6 +47,7 @@ export async function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(
45
47
  async function process<Model extends ILlmSchema.Model>(
46
48
  ctx: AutoBeContext<Model>,
47
49
  props: {
50
+ instruction: string;
48
51
  component: AutoBePrisma.IComponent;
49
52
  otherTables: string[];
50
53
  start: Date;
@@ -58,16 +61,18 @@ async function process<Model extends ILlmSchema.Model>(
58
61
  };
59
62
  const { tokenUsage } = await ctx.conversate({
60
63
  source: "prismaSchemas",
61
- histories: transformPrismaSchemaHistories(
62
- ctx
63
- .state()
64
- .analyze?.files.map((file) => ({ [file.filename]: file.content }))
65
- .reduce((acc, cur) => {
66
- return Object.assign(acc, cur);
67
- }, {}) ?? {},
68
- props.component,
69
- props.otherTables,
70
- ),
64
+ histories: transformPrismaSchemaHistories({
65
+ analysis:
66
+ ctx
67
+ .state()
68
+ .analyze?.files.map((file) => ({ [file.filename]: file.content }))
69
+ .reduce((acc, cur) => {
70
+ return Object.assign(acc, cur);
71
+ }, {}) ?? {},
72
+ targetComponent: props.component,
73
+ otherTables: props.otherTables,
74
+ instruction: props.instruction,
75
+ }),
71
76
  controller: createController(ctx, {
72
77
  targetComponent: props.component,
73
78
  otherTables: props.otherTables,
@@ -0,0 +1,44 @@
1
+ import { IAgenticaHistoryJson } from "@agentica/core";
2
+ import { IAutoBeTypeScriptCompileResult } from "@autobe/interface";
3
+ import { StringUtil } from "@autobe/utils";
4
+ import { v7 } from "uuid";
5
+
6
+ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
7
+ import { printErrorHints } from "../utils/printErrorHints";
8
+
9
+ interface IFailure {
10
+ diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[];
11
+ script: string;
12
+ }
13
+
14
+ export const transformRealizeCorrectCastingHistories = (
15
+ failures: IFailure[],
16
+ ): Array<
17
+ IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
18
+ > => {
19
+ return [
20
+ {
21
+ id: v7(),
22
+ created_at: new Date().toISOString(),
23
+ type: "systemMessage",
24
+ text: AutoBeSystemPromptConstant.COMMON_CORRECT_CASTING,
25
+ },
26
+ ...failures.map(
27
+ (f) =>
28
+ ({
29
+ id: v7(),
30
+ created_at: new Date().toISOString(),
31
+ type: "assistantMessage",
32
+ text: StringUtil.trim`
33
+ # Errors
34
+
35
+ This is a past code and an error with the code.
36
+ Please refer to the annotation for the location of the error.
37
+
38
+ ${printErrorHints(f.script, f.diagnostics)}
39
+ \`\`\`
40
+ `,
41
+ }) satisfies IAgenticaHistoryJson.IAssistantMessage,
42
+ ),
43
+ ];
44
+ };
@@ -7,6 +7,7 @@ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromp
7
7
  import { AutoBeState } from "../../../context/AutoBeState";
8
8
  import { IAutoBeRealizeFunctionFailure } from "../structures/IAutoBeRealizeFunctionFailure";
9
9
  import { IAutoBeRealizeScenarioResult } from "../structures/IAutoBeRealizeScenarioResult";
10
+ import { printErrorHints } from "../utils/printErrorHints";
10
11
  import { transformRealizeWriteHistories } from "./transformRealizeWriteHistories";
11
12
 
12
13
  export function transformRealizeCorrectHistories(props: {
@@ -40,30 +41,18 @@ export function transformRealizeCorrectHistories(props: {
40
41
  `,
41
42
  created_at: new Date().toISOString(),
42
43
  },
43
- ...props.failures.map(
44
- (f) =>
45
- ({
46
- id: v7(),
47
- type: "assistantMessage",
48
- text: StringUtil.trim`
49
-
50
- ## Generated Typescript Code
51
-
52
- \`\`\`typescript
53
- ${f.function.content}
54
- \`\`\`
55
-
56
- ## Compile Errors
57
-
58
- Fix the comilation error in the provided code.
59
-
60
- \`\`\`typescript
61
- ${JSON.stringify(f.diagnostics)}
62
- \`\`\`
63
- `,
64
- created_at: new Date().toISOString(),
65
- }) satisfies IAgenticaHistoryJson.IAssistantMessage,
66
- ),
44
+ ...props.failures.map((f) => {
45
+ return {
46
+ id: v7(),
47
+ type: "assistantMessage",
48
+ text: StringUtil.trim`
49
+ This is a past code and an error with the code. Please refer to the annotation for the location of the error.
50
+
51
+ ${printErrorHints(f.function.content, f.diagnostics)}
52
+ `,
53
+ created_at: new Date().toISOString(),
54
+ } satisfies IAgenticaHistoryJson.IAssistantMessage;
55
+ }),
67
56
  {
68
57
  id: v7(),
69
58
  type: "systemMessage",
@@ -29,13 +29,13 @@ export const transformRealizeWriteAuthorizationsHistories = (
29
29
  - Must NOT require authentication decorator (this endpoint creates authentication)
30
30
  - Should check if user exists and password matches
31
31
 
32
- ### MANDATORY: Use MyGlobal.password for Password Verification
32
+ ### MANDATORY: Use PasswordUtil for Password Verification
33
33
 
34
- **CRITICAL**: You MUST use MyGlobal.password utilities for password verification to ensure consistency with the join operation:
34
+ **CRITICAL**: You MUST use PasswordUtil utilities for password verification to ensure consistency with the join operation:
35
35
 
36
36
  \`\`\`typescript
37
37
  // Example: Password verification in login
38
- const isValid = await MyGlobal.password.verify(
38
+ const isValid = await PasswordUtil.verify(
39
39
  body.password, // plain password from request
40
40
  user.password_hash // hashed password from database
41
41
  );
@@ -126,13 +126,13 @@ export const transformRealizeWriteAuthorizationsHistories = (
126
126
  - Should create a new user record in the database
127
127
  - Must NOT require authentication decorator (public endpoint)
128
128
 
129
- ### MANDATORY: Use MyGlobal.password for Password Hashing
129
+ ### MANDATORY: Use PasswordUtil for Password Hashing
130
130
 
131
- **CRITICAL**: You MUST use MyGlobal.password utilities for password hashing to ensure consistency across all authentication operations:
131
+ **CRITICAL**: You MUST use PasswordUtil utilities for password hashing to ensure consistency across all authentication operations:
132
132
 
133
133
  \`\`\`typescript
134
134
  // Example: Password hashing in join/registration
135
- const hashedPassword = await MyGlobal.password.hash(body.password);
135
+ const hashedPassword = await PasswordUtil.hash(body.password);
136
136
 
137
137
  // Store the hashed password in database
138
138
  await MyGlobal.prisma.users.create({
@@ -100,6 +100,7 @@ export const transformRealizeWriteHistories = (props: {
100
100
  const authorizationHistories = operation.authorizationType
101
101
  ? transformRealizeWriteAuthorizationsHistories(operation, payloads)
102
102
  : [];
103
+ const document = props.state.interface.document;
103
104
 
104
105
  return [
105
106
  {
@@ -127,11 +128,12 @@ export const transformRealizeWriteHistories = (props: {
127
128
  id: v7(),
128
129
  type: "systemMessage",
129
130
  created_at: new Date().toISOString(),
130
- text: getRealizeWriteCodeTemplate(
131
- props.scenario,
131
+ text: getRealizeWriteCodeTemplate({
132
+ authorization: props.authorization,
133
+ scenario: props.scenario,
134
+ schemas: document.components.schemas,
132
135
  operation,
133
- props.authorization,
134
- ),
136
+ }),
135
137
  },
136
138
  {
137
139
  id: v7(),
@@ -47,13 +47,11 @@ export async function compileRealizeFiles<Model extends ILlmSchema.Model>(
47
47
  props.functions.map((el) => [el.location, el.content]),
48
48
  ),
49
49
  };
50
-
51
50
  const compiled: IAutoBeTypeScriptCompileResult =
52
51
  await compiler.typescript.compile({
53
52
  files: files,
54
53
  });
55
-
56
- const event: AutoBeRealizeValidateEvent = {
54
+ return {
57
55
  type: "realizeValidate",
58
56
  id: v7(),
59
57
  files: files,
@@ -61,6 +59,4 @@ export async function compileRealizeFiles<Model extends ILlmSchema.Model>(
61
59
  step: ctx.state().analyze?.step ?? 0,
62
60
  created_at: new Date().toISOString(),
63
61
  };
64
-
65
- return event;
66
62
  }