@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
@@ -22,10 +22,13 @@ import { IAutoBeTestWriteResult } from "./structures/IAutoBeTestWriteResult";
22
22
 
23
23
  export async function orchestrateTestWrite<Model extends ILlmSchema.Model>(
24
24
  ctx: AutoBeContext<Model>,
25
- scenarios: AutoBeTestScenario[],
25
+ props: {
26
+ instruction: string;
27
+ scenarios: AutoBeTestScenario[];
28
+ },
26
29
  ): Promise<IAutoBeTestWriteResult[]> {
27
30
  const progress: AutoBeProgressEventBase = {
28
- total: scenarios.length,
31
+ total: props.scenarios.length,
29
32
  completed: 0,
30
33
  };
31
34
  const result: Array<IAutoBeTestWriteResult | null> = await executeCachedBatch(
@@ -34,7 +37,7 @@ export async function orchestrateTestWrite<Model extends ILlmSchema.Model>(
34
37
  * individual test code implementations. Each scenario is processed to
35
38
  * generate corresponding test code and progress events.
36
39
  */
37
- scenarios.map((scenario) => async (promptCacheKey) => {
40
+ props.scenarios.map((scenario) => async (promptCacheKey) => {
38
41
  try {
39
42
  const artifacts: IAutoBeTestScenarioArtifacts =
40
43
  await getTestScenarioArtifacts(ctx, scenario);
@@ -43,6 +46,7 @@ export async function orchestrateTestWrite<Model extends ILlmSchema.Model>(
43
46
  artifacts,
44
47
  progress,
45
48
  promptCacheKey,
49
+ instruction: props.instruction,
46
50
  });
47
51
  ctx.dispatch(event);
48
52
  return {
@@ -65,6 +69,7 @@ async function process<Model extends ILlmSchema.Model>(
65
69
  artifacts: IAutoBeTestScenarioArtifacts;
66
70
  progress: AutoBeProgressEventBase;
67
71
  promptCacheKey: string;
72
+ instruction: string;
68
73
  },
69
74
  ): Promise<AutoBeTestWriteEvent> {
70
75
  const { scenario, artifacts, progress, promptCacheKey } = props;
@@ -73,7 +78,11 @@ async function process<Model extends ILlmSchema.Model>(
73
78
  };
74
79
  const { tokenUsage } = await ctx.conversate({
75
80
  source: "testWrite",
76
- histories: await transformTestWriteHistories(ctx, scenario, artifacts),
81
+ histories: await transformTestWriteHistories(ctx, {
82
+ scenario,
83
+ artifacts,
84
+ instruction: props.instruction,
85
+ }),
77
86
  controller: createController({
78
87
  model: ctx.model,
79
88
  build: (next) => {
@@ -90,11 +99,12 @@ async function process<Model extends ILlmSchema.Model>(
90
99
  throw new Error("Failed to create test code.");
91
100
  }
92
101
 
93
- pointer.value.revise.final = await completeTestCode(
94
- ctx,
95
- artifacts,
96
- pointer.value.revise.final,
97
- );
102
+ if (pointer.value.revise.final)
103
+ pointer.value.revise.final = await completeTestCode(
104
+ ctx,
105
+ artifacts,
106
+ pointer.value.revise.final,
107
+ );
98
108
  pointer.value.draft = await completeTestCode(
99
109
  ctx,
100
110
  artifacts,
@@ -109,7 +119,7 @@ async function process<Model extends ILlmSchema.Model>(
109
119
  domain: pointer.value.domain,
110
120
  draft: pointer.value.draft,
111
121
  review: pointer.value.revise?.review,
112
- final: pointer.value.revise?.final,
122
+ final: pointer.value.revise?.final ?? undefined,
113
123
  tokenUsage,
114
124
  completed: ++progress.completed,
115
125
  total: progress.total,
@@ -91,161 +91,6 @@ export namespace IAutoBeTestCorrectApplication {
91
91
  revise: IReviseProps;
92
92
  }
93
93
 
94
- // /**
95
- // * Comprehensive compilation error analysis and correction planning
96
- // * properties.
97
- // *
98
- // * This interface structures the AI's deep thinking process during error
99
- // * correction, requiring individual analysis of each compilation error along
100
- // * with an overall strategy assessment. The AI must meticulously examine every
101
- // * error message, understand its root cause, and propose targeted solutions
102
- // * while maintaining a holistic view of the correction process.
103
- // *
104
- // * The structure enforces granular error analysis while ensuring the AI
105
- // * maintains awareness of overarching patterns and systemic issues that may
106
- // * require broader strategic changes like scenario rewrites or architectural
107
- // * adjustments.
108
- // */
109
- // export interface IThinkProps {
110
- // /**
111
- // * Individual analyses for each compilation diagnostic.
112
- // *
113
- // * Contains detailed examination of every compilation error encountered,
114
- // * with specific analysis and targeted solutions. Each entry represents a
115
- // * single compilation diagnostic that must be resolved. The AI must read the
116
- // * IAutoBeTypeScriptCompileResult.IDiagnostic objects, interpret their
117
- // * content, and provide human-readable summaries along with precise fixes.
118
- // *
119
- // * This granular approach ensures no error is overlooked and each issue
120
- // * receives appropriate attention and resolution strategy.
121
- // */
122
- // analyses: IDiagnosticAnalysis[] & tags.MinItems<1>;
123
-
124
- // /**
125
- // * Overall assessment of compilation issues and correction strategies.
126
- // *
127
- // * Synthesizes patterns across all individual errors to identify systemic
128
- // * issues and overarching correction strategies. This includes verification
129
- // * of TEST_WRITE.md and TEST_CORRECT.md compliance, assessment of whether
130
- // * scenario rewrites are needed, identification of common error patterns,
131
- // * and documentation of broad strategic decisions.
132
- // *
133
- // * Must address: type safety compliance, async/await patterns, scenario
134
- // * adaptation requirements, and overall code quality considerations that
135
- // * span multiple errors.
136
- // */
137
- // overall: string;
138
- // }
139
-
140
- // /**
141
- // * Detailed analysis structure for individual compilation diagnostics.
142
- // *
143
- // * Represents the AI's systematic approach to understanding and resolving each
144
- // * compilation diagnostic. Each diagnostic must be thoroughly analyzed to
145
- // * understand its root cause, with a specific solution that addresses the
146
- // * exact issue while maintaining type safety and code quality.
147
- // */
148
- // export interface IDiagnosticAnalysis {
149
- // /**
150
- // * AI-generated summary of the compilation diagnostic.
151
- // *
152
- // * The AI must analyze the `IAutoBeTypeScriptCompileResult.IDiagnostic`
153
- // * object and provide a clear, concise summary of the error. This should
154
- // * include the error message, file location, line/column position, and error
155
- // * code in a human-readable format. The AI interprets and restructures the
156
- // * raw diagnostic data to present it in a more understandable way.
157
- // *
158
- // * **IMPORTANT**: The AI should not copy the raw diagnostic object. Instead,
159
- // * it must read and understand the diagnostic details, then compose a clear
160
- // * string description that captures all essential information about the
161
- // * error.
162
- // */
163
- // diagnostic: string;
164
-
165
- // /**
166
- // * Root cause analysis of why this compilation error occurred.
167
- // *
168
- // * **🚨 CRITICAL FIRST CHECK: Is this caused by INTENTIONAL TYPE ERROR TESTING? 🚨**
169
- // * - Look for `as any` usage in the error location
170
- // * - Check if code is intentionally sending wrong types to test type validation
171
- // * - Check if code is testing missing required fields
172
- // * - **IF YES → Root cause: "Prohibited type error testing code that must be DELETED"**
173
- // *
174
- // * **⚠️ THINK BEYOND THE DIAGNOSTIC LINE - EXPAND YOUR INVESTIGATION ⚠️**
175
- // * - Do NOT focus only on the error line - it might be just a symptom
176
- // * - The real cause might be ABOVE the error location in earlier code
177
- // * - The test scenario itself might be fundamentally flawed or impossible
178
- // * - Consider if the scenario is requesting non-existent APIs or prohibited actions
179
- // * - Example: Error on line 50 might be caused by wrong type assignment on line 20
180
- // * - Example: API call fails because the scenario describes unimplemented functionality
181
- // *
182
- // * AI must examine the error message carefully and identify the specific
183
- // * reason for failure. This includes understanding whether it's a missing
184
- // * property, type mismatch, nullable/undefined issue, incorrect API usage,
185
- // * intentional type error testing, flawed scenario, or other TypeScript
186
- // * violations. The analysis should be precise and fact-based, but also
187
- // * consider the broader context and causal relationships.
188
- // *
189
- // * **MANDATORY**: The AI must thoroughly review ALL sections of
190
- // * TEST_CORRECT.md and apply relevant error patterns and analysis guidelines
191
- // * from sections 4.1-4.16 to ensure accurate diagnosis.
192
- // *
193
- // * Example: "Property 'code' is missing because the object literal lacks
194
- // * this required field from ICommunityPlatformCommunity.ICreate interface"
195
- // *
196
- // * Example: "Type error caused by intentional wrong type test using 'as any'
197
- // * - prohibited pattern that must be deleted"
198
- // *
199
- // * Example: "API endpoint doesn't exist - scenario requests unimplemented
200
- // * functionality that cannot be tested"
201
- // */
202
- // analysis: string;
203
-
204
- // /**
205
- // * Specific solution to resolve this compilation error.
206
- // *
207
- // * **🚨 IF ROOT CAUSE IS TYPE ERROR TESTING → Solution: "DELETE entire test block" 🚨**
208
- // * **🚨 IF PROBLEM IS UNRECOVERABLE → Solution: "DELETE the problematic section" 🚨**
209
- // * - NEVER try to "fix" intentional type error tests - DELETE them
210
- // * - NEVER violate type safety to force a fix - DELETE instead
211
- // * - Tests using `as any` to send wrong types must be DELETED
212
- // * - Tests checking type validation must be DELETED
213
- // * - Unrecoverable compilation errors should result in DELETION
214
- // *
215
- // * **THREE SOLUTION TYPES:**
216
- // * 1. **FIX**: Correct the error while maintaining functionality
217
- // * 2. **DELETE**: Remove prohibited or unrecoverable code entirely
218
- // * 3. **REWRITE**: Restructure if the scenario itself is fundamentally flawed
219
- // *
220
- // * Detailed correction strategy that addresses the exact issue identified in
221
- // * the analysis. Solutions must be actionable, type-safe, and compliant with
222
- // * all project guidelines. For nullable/undefined errors with typia tags,
223
- // * immediately apply typia.assert(value!) pattern. For missing properties,
224
- // * specify what will be added and how.
225
- // *
226
- // * **CRITICAL**: The AI must thoroughly review BOTH TEST_WRITE.md and
227
- // * TEST_CORRECT.md before proposing solutions. All prohibitions from
228
- // * TEST_WRITE.md must be strictly respected (no type bypasses, proper
229
- // * async/await usage, etc.), and correction patterns from TEST_CORRECT.md
230
- // * sections 4.1-4.16 must be properly applied.
231
- // *
232
- // * **DELETION IS A VALID SOLUTION** when:
233
- // * - Code violates absolute prohibitions
234
- // * - Fixing would require type safety violations
235
- // * - The scenario describes impossible functionality
236
- // * - Multiple fix attempts have failed
237
- // *
238
- // * Example: "Add missing 'code' property using typia.random<string>() to
239
- // * generate a valid string value that satisfies the interface requirement"
240
- // *
241
- // * Example: "DELETE this entire test - it's testing type errors with 'as any'"
242
- // *
243
- // * Example: "DELETE this section - API endpoint doesn't exist and cannot be
244
- // * tested without violating type safety"
245
- // */
246
- // solution: string;
247
- // }
248
-
249
94
  /**
250
95
  * Revision properties for the final review and implementation phases.
251
96
  *
@@ -253,74 +98,6 @@ export namespace IAutoBeTestCorrectApplication {
253
98
  * workflow, ensuring systematic review and production-ready code delivery.
254
99
  */
255
100
  export interface IReviseProps {
256
- // /**
257
- // * Dual-document compliance validation for TEST_WRITE.md and
258
- // * TEST_CORRECT.md.
259
- // *
260
- // * This property tracks whether each section from BOTH TEST_WRITE.md and
261
- // * TEST_CORRECT.md guidelines has been properly followed. Since the correct
262
- // * agent must ensure compliance with both documents, keys should include
263
- // * sections from both prompt files.
264
- // *
265
- // * Each ICheck item should have:
266
- // *
267
- // * - Title: Prefixed with source document for clarity ("TEST_WRITE: " or
268
- // * "TEST_CORRECT: ")
269
- // * - State: Compliance status (true if followed, false if violated)
270
- // *
271
- // * Note: Section identifiers may evolve as documentation updates, so
272
- // * implementations should be flexible in handling different key formats.
273
- // *
274
- // * Example:
275
- // *
276
- // * ```typescript
277
- // * rules: [
278
- // * { title: "TEST_WRITE: 1. Role and Responsibility", state: true },
279
- // * { title: "TEST_WRITE: 3.1. Import Management", state: true },
280
- // * {
281
- // * title: "TEST_CORRECT: 4.1. Missing Properties Pattern",
282
- // * state: true,
283
- // * },
284
- // * {
285
- // * title: "TEST_CORRECT: 4.2. Type Mismatch Pattern",
286
- // * state: false,
287
- // * },
288
- // * // ... other sections from both documents
289
- // * ];
290
- // * ```
291
- // */
292
- // rules: ICheck[] & tags.MinItems<1>;
293
-
294
- // /**
295
- // * Combined quality checklist validation from both prompt documents.
296
- // *
297
- // * This property captures the compliance status for checklist items from
298
- // * BOTH TEST_WRITE.md (Section 5: Final Checklist) and TEST_CORRECT.md
299
- // * (Section 5: Final Review Checklist). The correct agent must validate
300
- // * against both checklists to ensure comprehensive quality control.
301
- // *
302
- // * Each ICheck item should have:
303
- // *
304
- // * - Title: Checklist item as described in the documents
305
- // * - State: Whether the criterion has been satisfied
306
- // *
307
- // * Note: Checklist items may be updated over time, so implementations should
308
- // * adapt to documentation changes while maintaining the validation purpose.
309
- // *
310
- // * Example:
311
- // *
312
- // * ```typescript
313
- // * checkList: [
314
- // * { title: "No compilation errors", state: true },
315
- // * { title: "Proper async/await usage", state: true },
316
- // * { title: "All typia tags preserved", state: true },
317
- // * { title: "No type bypasses or workarounds", state: false },
318
- // * // ... other checklist items from both documents
319
- // * ];
320
- // * ```
321
- // */
322
- // checkList: ICheck[] & tags.MinItems<1>;
323
-
324
101
  /**
325
102
  * Step 3: Code review and correction validation.
326
103
  *
@@ -347,17 +124,21 @@ export namespace IAutoBeTestCorrectApplication {
347
124
  * incorporating all review feedback and validation results. This code
348
125
  * represents the completed error correction, guaranteed to compile
349
126
  * successfully while preserving all original test functionality and
350
- * business logic.
127
+ * business logic. When the draft correction already perfectly resolves all
128
+ * issues with no problems found during review, this value can be null,
129
+ * indicating no further refinement was necessary.
351
130
  *
352
131
  * The final implementation resolves all compilation issues, maintains
353
132
  * strict type safety, follows all established conventions, and delivers a
354
133
  * production-ready test that accurately validates the intended API
355
- * behaviors and user workflows.
134
+ * behaviors and user workflows. A null value signifies the draft correction
135
+ * was already optimal and requires no modifications.
356
136
  *
357
137
  * Workflow: Review integration → Final refinement → Production-ready
358
- * implementation. This is the ultimate deliverable that will replace the
359
- * compilation-failed code.
138
+ * implementation (or null if draft needs no changes). This is the ultimate
139
+ * deliverable that will replace the compilation-failed code when provided,
140
+ * otherwise the draft correction is used as-is.
360
141
  */
361
- final: string;
142
+ final: string | null;
362
143
  }
363
144
  }
@@ -131,7 +131,10 @@ export namespace IAutoBeTestCorrectInvalidRequestApplication {
131
131
  * Final corrected code.
132
132
  *
133
133
  * The complete, cleaned test code with all invalid API request sections
134
- * removed, ready for compilation.
134
+ * removed, ready for compilation. When the draft already successfully
135
+ * removes all problematic code with no additional issues found during
136
+ * review, this value can be null, indicating the draft deletion was
137
+ * sufficient and requires no further changes.
135
138
  *
136
139
  * This code must:
137
140
  *
@@ -140,7 +143,10 @@ export namespace IAutoBeTestCorrectInvalidRequestApplication {
140
143
  * - Have no `as any` or similar type violations
141
144
  * - Maintain the original file structure
142
145
  * - Be production-ready E2E test code
146
+ *
147
+ * A null value indicates the draft successfully removed all invalid code
148
+ * and needs no additional modifications.
143
149
  */
144
- final: string;
150
+ final: string | null;
145
151
  }
146
152
  }
@@ -65,8 +65,8 @@ export namespace IAutoBeTestWriteApplication {
65
65
  *
66
66
  * Contains the iterative improvement workflow that transforms the initial
67
67
  * draft into production-ready test code. The review phase identifies issues
68
- * to fix or code to delete, followed by the final phase that produces
69
- * the polished, production-ready test implementation.
68
+ * to fix or code to delete, followed by the final phase that produces the
69
+ * polished, production-ready test implementation.
70
70
  *
71
71
  * Workflow: Draft → Review analysis → Final implementation
72
72
  */
@@ -74,52 +74,6 @@ export namespace IAutoBeTestWriteApplication {
74
74
  }
75
75
 
76
76
  export interface IReviseProps {
77
- // /**
78
- // * Test implementation rules compliance validation.
79
- // *
80
- // * This property tracks whether each section of the TEST_WRITE.md guidelines
81
- // * has been properly followed. Each array element represents a section from
82
- // * the documentation with its title and compliance status.
83
- // *
84
- // * Note: The specific section titles may evolve as documentation updates, so
85
- // * implementations should be flexible in handling different titles.
86
- // *
87
- // * Example:
88
- // *
89
- // * ```typescript
90
- // * rules: [
91
- // * { title: "1. Role and Responsibility", state: true },
92
- // * { title: "2. Input Materials Provided", state: true },
93
- // * { title: "3. Code Generation Requirements", state: false },
94
- // * // ... other sections
95
- // * ];
96
- // * ```
97
- // */
98
- // rules: ICheck[] & tags.MinItems<1>;
99
-
100
- // /**
101
- // * Final quality checklist validation results.
102
- // *
103
- // * This property captures the compliance status for each item in the Final
104
- // * Checklist (Section 5) from TEST_WRITE.md. Each array element represents a
105
- // * checklist item with its description and validation result.
106
- // *
107
- // * Note: Checklist items may be updated over time, so implementations should
108
- // * adapt to documentation changes while maintaining the validation purpose.
109
- // *
110
- // * Example:
111
- // *
112
- // * ```typescript
113
- // * checkList: [
114
- // * { title: "NO additional import statements", state: true },
115
- // * { title: "NO wrong type data in requests", state: true },
116
- // * { title: "EVERY api.functional.* call has await", state: false },
117
- // * // ... other checklist items
118
- // * ];
119
- // * ```
120
- // */
121
- // checkList: ICheck[] & tags.MinItems<1>;
122
-
123
77
  /**
124
78
  * Step 4: Code review and quality assessment.
125
79
  *
@@ -180,7 +134,9 @@ export namespace IAutoBeTestWriteApplication {
180
134
  *
181
135
  * AI produces the final, polished version of the test code incorporating
182
136
  * all review feedback. This code represents the completed test
183
- * implementation, ready for production deployment.
137
+ * implementation, ready for production deployment. When the draft code is
138
+ * already perfect with no issues found during review, this value can be
139
+ * null, indicating no revisions were necessary.
184
140
  *
185
141
  * **🚨 CRITICAL: APPLY ALL FIXES AND DELETIONS FROM REVIEW 🚨**
186
142
  *
@@ -188,41 +144,18 @@ export namespace IAutoBeTestWriteApplication {
188
144
  * - DELETE all prohibited code identified in review
189
145
  * - If review found type error tests, they MUST be deleted in final
190
146
  * - If review found code to DELETE, final MUST be different from draft
147
+ * - If review finds NO issues requiring changes, set to null
191
148
  *
192
149
  * All identified issues must be resolved, and the code must meet the
193
- * highest quality standards.
150
+ * highest quality standards. A null value indicates the draft code already
151
+ * meets all requirements without modification.
194
152
  *
195
153
  * Workflow: Review feedback → Apply FIXES → Apply DELETIONS →
196
- * Production-ready implementation
154
+ * Production-ready implementation (or null if no changes needed)
197
155
  *
198
156
  * This is the ultimate deliverable that will be used in the actual test
199
- * suite.
157
+ * suite when provided, otherwise the draft is used as-is.
200
158
  */
201
- final: string;
159
+ final: string | null;
202
160
  }
203
-
204
- // /**
205
- // * Check validation item structure.
206
- // *
207
- // * Represents a validation check with its title and compliance state. Used for
208
- // * both rules validation and final checklist validation.
209
- // */
210
- // export interface ICheck {
211
- // /**
212
- // * The title or description of the check.
213
- // *
214
- // * For rules: Section identifiers from TEST_WRITE.md (e.g., "1. Role and
215
- // * Responsibility") For checklist: Checklist item descriptions (e.g., "No
216
- // * compilation errors")
217
- // */
218
- // title: string;
219
-
220
- // /**
221
- // * The validation state of this check.
222
- // *
223
- // * - True: The requirement has been satisfied
224
- // * - False: The requirement has been violated or not met
225
- // */
226
- // state: boolean;
227
- // }
228
161
  }
@@ -0,0 +1,51 @@
1
+ import { AutoBeOpenApi } from "@autobe/interface";
2
+ import { AutoBeOpenApiEndpointComparator } from "@autobe/utils";
3
+ import { HashMap } from "tstl";
4
+
5
+ export const getPrerequisites = (props: {
6
+ document: AutoBeOpenApi.IDocument;
7
+ endpoint: AutoBeOpenApi.IEndpoint;
8
+ }): AutoBeOpenApi.IPrerequisite[] => {
9
+ const visited: Set<string> = new Set<string>();
10
+ const result: HashMap<
11
+ AutoBeOpenApi.IEndpoint,
12
+ AutoBeOpenApi.IPrerequisite[]
13
+ > = new HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IPrerequisite[]>(
14
+ AutoBeOpenApiEndpointComparator.hashCode,
15
+ AutoBeOpenApiEndpointComparator.equals,
16
+ );
17
+
18
+ const traverse = (endpoint: AutoBeOpenApi.IEndpoint): void => {
19
+ const key = `${endpoint.method}:${endpoint.path}`;
20
+
21
+ // prevent circular structure: skip visited endpoint
22
+ if (visited.has(key)) return;
23
+ visited.add(key);
24
+
25
+ const operation: AutoBeOpenApi.IOperation | undefined =
26
+ props.document.operations.find(
27
+ (op) => op.method === endpoint.method && op.path === endpoint.path,
28
+ );
29
+
30
+ if (operation === undefined) return;
31
+
32
+ // add current operation's prerequisites
33
+ for (const prerequisite of operation.prerequisites) {
34
+ // check if already in result to avoid duplicates
35
+ const exists: boolean = result.has(prerequisite.endpoint);
36
+
37
+ if (!exists) {
38
+ result.set(prerequisite.endpoint, [prerequisite]);
39
+ }
40
+
41
+ // recursively traverse prerequisite's prerequisites
42
+ traverse(prerequisite.endpoint);
43
+ }
44
+ };
45
+
46
+ traverse(props.endpoint);
47
+ return result
48
+ .toJSON()
49
+ .map((it) => it.second)
50
+ .flat();
51
+ };
@@ -7,7 +7,8 @@ export const getReferenceIds = (props: {
7
7
  }): string[] => {
8
8
  const result: Set<string> = new Set();
9
9
  const emplace = (key: string) => {
10
- if (key.endsWith("_id") || key.endsWith("Id")) result.add(key);
10
+ if (key.endsWith("_id") || key.endsWith("Id") || key === "id")
11
+ result.add(key);
11
12
  };
12
13
 
13
14
  props.operation.parameters.forEach((p) => emplace(p.name));
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformCommonCorrectDateHistories = void 0;
4
- const utils_1 = require("@autobe/utils");
5
- const uuid_1 = require("uuid");
6
- /** Transform date correction histories for AI conversation */
7
- const transformCommonCorrectDateHistories = (failures) => [
8
- {
9
- id: (0, uuid_1.v7)(),
10
- created_at: new Date().toISOString(),
11
- type: "systemMessage",
12
- text: "<!--\nfilename: REALIZE_DATE.md\n-->\n# \uD83D\uDCC5 Date Type Handling Guide for Realize Agent\n\n## \uD83D\uDEA8 CRITICAL: Date Type is ABSOLUTELY FORBIDDEN in TypeScript Declarations\n\nThis document provides comprehensive guidelines for handling date-related types in the Realize Agent system. Violations of these rules will cause compilation failures.\n\n## \uD83D\uDD34 The Golden Rule: NEVER Use Native Date Type\n\n### \u274C ABSOLUTELY FORBIDDEN\n```typescript\n// NEVER declare variables with Date type\nconst now: Date = new Date(); // \u274C FORBIDDEN\nconst processDate = (date: Date) => { ... }; // \u274C FORBIDDEN\nfunction getDate(): Date { ... } // \u274C FORBIDDEN\ninterface IUser { created_at: Date; } // \u274C FORBIDDEN\ntype TimeStamp = Date; // \u274C FORBIDDEN\n```\n\n### \u2705 REQUIRED: Always Use String with Tags\n```typescript\n// ALWAYS use string with tags.Format<'date-time'>\nconst now: string & tags.Format<'date-time'> = toISOStringSafe(new Date());\nconst processDate = (date: string & tags.Format<'date-time'>) => { ... };\nfunction getDate(): string & tags.Format<'date-time'> { ... }\ninterface IUser { created_at: string & tags.Format<'date-time'>; }\ntype TimeStamp = string & tags.Format<'date-time'>;\n```\n\n## \uD83D\uDEE0\uFE0F The toISOStringSafe() Function\n\n### Function Signature\n```typescript\nfunction toISOStringSafe(\n value: Date | (string & tags.Format<\"date-time\">)\n): string & tags.Format<\"date-time\">\n```\n\n### Purpose\n`toISOStringSafe()` is the ONLY approved method for converting Date objects or date strings to ISO strings with proper type branding.\n\n### \u26A0\uFE0F CRITICAL: Parameter Requirements\n\n**toISOStringSafe REQUIRES a non-null parameter!**\n- The function accepts `Date` or ISO string format\n- It does NOT accept `null` or `undefined`\n- Always check for null/undefined BEFORE calling\n\n```typescript\n// \u274C WRONG: Function doesn't accept null\ntoISOStringSafe(nullableValue) // Type error if nullable!\n\n// \u2705 CORRECT: Check null first, then call\nvalue ? toISOStringSafe(value) : null // Safe null handling\n```\n\n### Common Usage Patterns\n\n#### 1. Creating New Timestamps\n```typescript\n// \u2705 For new timestamps\nconst created_at = toISOStringSafe(new Date());\nconst updated_at = toISOStringSafe(new Date());\n\n// \u2705 Converting existing date strings\nconst formatted_date = toISOStringSafe(dateString);\n```\n\n#### 2. Converting Prisma DateTime Fields\n```typescript\n// \u2705 Converting from Prisma (which returns Date objects)\nreturn {\n created_at: toISOStringSafe(created.created_at),\n updated_at: toISOStringSafe(created.updated_at),\n expires_at: created.expires_at ? toISOStringSafe(created.expires_at) : null,\n};\n```\n\n#### 3. Processing API Input Dates\n```typescript\n// \u2705 Converting date strings from API input\nawait MyGlobal.prisma.posts.create({\n data: {\n title: body.title,\n content: body.content,\n published_at: body.published_at ? toISOStringSafe(body.published_at) : null,\n scheduled_at: body.scheduled_at ? toISOStringSafe(body.scheduled_at) : null,\n },\n});\n```\n\n## \uD83D\uDCCA Date Field Patterns in Different Contexts\n\n### 1. Prisma Operations\n\n#### CREATE Operations\n```typescript\nawait MyGlobal.prisma.articles.create({\n data: {\n id: v4() as string & tags.Format<'uuid'>,\n title: body.title,\n content: body.content,\n // Required date fields\n created_at: toISOStringSafe(new Date()),\n updated_at: toISOStringSafe(new Date()),\n // Optional/nullable date fields\n published_at: body.published_at ? toISOStringSafe(body.published_at) : null,\n deleted_at: null, // If soft delete field exists\n },\n});\n```\n\n#### UPDATE Operations\n```typescript\nawait MyGlobal.prisma.articles.update({\n where: { id: parameters.id },\n data: {\n title: body.title,\n content: body.content,\n // Always update the updated_at field\n updated_at: toISOStringSafe(new Date()),\n // Conditional date updates\n ...(body.published_at !== undefined && {\n published_at: body.published_at ? toISOStringSafe(body.published_at) : null\n }),\n },\n});\n```\n\n#### WHERE Clauses with Date Ranges\n```typescript\nawait MyGlobal.prisma.events.findMany({\n where: {\n // Date range queries\n created_at: {\n gte: body.start_date ? toISOStringSafe(body.start_date) : undefined,\n lte: body.end_date ? toISOStringSafe(body.end_date) : undefined,\n },\n // Specific date comparisons\n expires_at: {\n gt: toISOStringSafe(new Date()), // Events not yet expired\n },\n },\n});\n```\n\n### 2. Return Object Transformations\n\n#### From Prisma to API Response\n```typescript\n// Prisma returns Date objects, API expects ISO strings\nconst users = await MyGlobal.prisma.users.findMany();\n\nreturn users.map(user => ({\n id: user.id,\n name: user.name,\n email: user.email,\n // Convert all Date fields to ISO strings\n created_at: toISOStringSafe(user.created_at),\n updated_at: toISOStringSafe(user.updated_at),\n last_login_at: user.last_login_at ? toISOStringSafe(user.last_login_at) : null,\n email_verified_at: user.email_verified_at ? toISOStringSafe(user.email_verified_at) : null,\n}));\n```\n\n### 3. Complex Date Operations\n\n#### Soft Delete Implementation\n```typescript\n// If schema has deleted_at field (always check first!)\nawait MyGlobal.prisma.posts.update({\n where: { id: parameters.id },\n data: {\n deleted_at: toISOStringSafe(new Date()), // Mark as deleted\n updated_at: toISOStringSafe(new Date()),\n },\n});\n\n// Querying non-deleted items\nawait MyGlobal.prisma.posts.findMany({\n where: {\n deleted_at: null, // Only get non-deleted posts\n },\n});\n```\n\n#### Date Calculations\n```typescript\n// Calculate expiry date (30 days from now)\nconst now = new Date();\nconst expiryDate = new Date(now.getTime() + 30 * 24 * 60 * 60 * 1000);\n\nawait MyGlobal.prisma.subscriptions.create({\n data: {\n user_id: user.id,\n started_at: toISOStringSafe(now),\n expires_at: toISOStringSafe(expiryDate),\n },\n});\n```\n\n## \uD83D\uDEAB Common Date Type Errors and Solutions\n\n### Error: \"Type 'Date' is not assignable to type 'string & tags.Format<'date-time'>'\"\n\n**Cause**: Trying to assign a Date object directly without conversion\n\n```typescript\n// \u274C WRONG\nreturn {\n created_at: new Date(), // ERROR!\n};\n\n// \u2705 CORRECT\nreturn {\n created_at: toISOStringSafe(new Date()),\n};\n```\n\n### Error: \"Argument of type 'null' is not assignable to parameter\"\n\n**Cause**: Trying to pass null or undefined to toISOStringSafe\n\n```typescript\n// \u274C WRONG\nconst date = toISOStringSafe(nullableDate); // Type error if nullable!\n\n// \u2705 CORRECT\nconst date = nullableDate ? toISOStringSafe(nullableDate) : null;\n```\n\n### Error: \"Type 'string | null' is not assignable to type 'string & tags.Format<'date-time'>'\"\n\n**Cause**: Nullable date field being assigned to required date field\n\n```typescript\n// \u274C WRONG (if API expects non-nullable)\nreturn {\n created_at: user.created_at ? toISOStringSafe(user.created_at) : null, // ERROR!\n};\n\n// \u2705 CORRECT (provide default for required fields)\nreturn {\n created_at: user.created_at \n ? toISOStringSafe(user.created_at) \n : toISOStringSafe(new Date()), // Default to current time\n};\n```\n\n## \uD83D\uDCCB Date Type Checklist\n\nBefore implementing any date-related functionality, verify:\n\n1. \u2705 **NO Date type declarations** - Search for `: Date` in your code\n2. \u2705 **All Date objects wrapped in toISOStringSafe()** - Never use .toISOString() directly\n3. \u2705 **Null checks before toISOStringSafe()** - Function cannot handle null\n4. \u2705 **Proper type annotations** - Use `string & tags.Format<'date-time'>`\n5. \u2705 **Schema verification** - Check if date fields actually exist in Prisma schema\n6. \u2705 **API contract alignment** - Verify if fields are nullable or required in DTOs\n\n## \uD83C\uDFAF Quick Reference\n\n### DO \u2705\n- `toISOStringSafe(new Date())`\n- `toISOStringSafe(dateString)` for existing strings\n- `value ? toISOStringSafe(value) : null` for nullable values\n- `string & tags.Format<'date-time'>` for type declarations\n- Check null/undefined BEFORE calling toISOStringSafe\n- Check Prisma schema for date field existence\n\n### DON'T \u274C\n- `const date: Date = new Date()` - storing Date in variables\n- `new Date().toISOString()` - use toISOStringSafe instead\n- `toISOStringSafe(nullableValue)` - function doesn't accept null\n- `toISOStringSafe()` - function requires a parameter\n- Assume date fields exist (like deleted_at)\n- Use Date type in function signatures\n\n## \uD83D\uDD0D Exception: new Date() Usage\n\nThe ONLY acceptable use of `new Date()` is as an immediate argument to `toISOStringSafe()`:\n\n```typescript\n// \u2705 ONLY ALLOWED PATTERN\nconst timestamp = toISOStringSafe(new Date());\n\n// \u274C NEVER STORE Date IN VARIABLE\nconst now = new Date(); // FORBIDDEN!\nconst timestamp = toISOStringSafe(now); // VIOLATION!\n```\n\n## \uD83D\uDCDD Summary\n\nThe Date type handling in Realize Agent follows a strict pattern:\n1. **Never** declare Date types in TypeScript\n2. **Always** use `string & tags.Format<'date-time'>` for type declarations\n3. **Always** use `toISOStringSafe()` for Date/string to ISO conversions\n4. **Always** check null/undefined before calling `toISOStringSafe()` - it doesn't accept null\n5. **Always** pass a parameter to `toISOStringSafe()` - it's not optional\n6. **Always** verify schema before using date fields\n\nFollowing these rules ensures type safety, prevents runtime errors, and maintains consistency across the entire codebase." /* AutoBeSystemPromptConstant.REALIZE_DATE */,
13
- },
14
- ...failures.map((f, i, array) => ({
15
- id: (0, uuid_1.v7)(),
16
- created_at: new Date().toISOString(),
17
- type: "assistantMessage",
18
- text: utils_1.StringUtil.trim `
19
- # ${i === array.length - 1 ? "Latest Date Type Failure" : "Previous Date Type Failure"}
20
-
21
- ## Generated TypeScript Code
22
- \`\`\`typescript
23
- ${f.script}
24
- \`\`\`
25
-
26
- ## Date-Related Compile Errors
27
- ${f.diagnostics
28
- .map((d) => {
29
- const location = d.file
30
- ? `[${d.file}${d.start ? `:${d.start}` : ""}]`
31
- : "[Unknown location]";
32
- const code = d.code ? `TS${d.code}` : "";
33
- const messageText = d.messageText || "Date type error";
34
- return `- ${location} ${code}: ${messageText}`;
35
- })
36
- .join("\n")}
37
-
38
- ## Required Fixes:
39
- - Replace all Date type declarations with string & tags.Format<"date-time">
40
- - Wrap Date objects with toISOStringSafe(value)
41
- - Check null/undefined BEFORE calling toISOStringSafe (it doesn't accept null)
42
- - Remove Date variable declarations (const now = new Date() is forbidden)
43
- - toISOStringSafe requires a parameter - it's not optional
44
- `,
45
- })),
46
- ];
47
- exports.transformCommonCorrectDateHistories = transformCommonCorrectDateHistories;
48
- //# sourceMappingURL=transformCommonCorrectDateHistories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transformCommonCorrectDateHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/common/histories/transformCommonCorrectDateHistories.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,+BAA0B;AAS1B,8DAA8D;AACvD,MAAM,mCAAmC,GAAG,CACjD,QAAoB,EAGpB,EAAE,CAAC;IACH;QACE,EAAE,EAAE,IAAA,SAAE,GAAE;QACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,IAAI,EAAE,eAAe;QACrB,IAAI,+wTAAyC;KAC9C;IACD,GAAG,QAAQ,CAAC,GAAG,CACb,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,CACd,CAAC;QACC,EAAE,EAAE,IAAA,SAAE,GAAE;QACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;cACf,CAAC,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,4BAA4B;;;;YAIpF,CAAC,CAAC,MAAM;;;;YAIR,CAAC,CAAC,WAAW;aACZ,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACT,MAAM,QAAQ,GAAG,CAAC,CAAC,IAAI;gBACrB,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG;gBAC9C,CAAC,CAAC,oBAAoB,CAAC;YACzB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,IAAI,iBAAiB,CAAC;YACvD,OAAO,KAAK,QAAQ,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;QACjD,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC;;;;;;;;SAQd;KACF,CAAkD,CACtD;CACF,CAAC;AA9CW,QAAA,mCAAmC,uCA8C9C"}
@@ -1,35 +0,0 @@
1
- import typia from "typia";
2
- /** Application interface for Date type correction in generated code */
3
- export interface IAutoBeCommonCorrectDateApplication {
4
- /**
5
- * Rewrite the function to fix Date type issues
6
- *
7
- * @param props - Correction properties
8
- */
9
- rewrite(props: IAutoBeCommonCorrectDateApplication.IProps): void;
10
- /** Reject the correction task if Date issues cannot be fixed */
11
- reject(): void;
12
- }
13
- export declare namespace IAutoBeCommonCorrectDateApplication {
14
- /** Properties for Date type correction */
15
- interface IProps {
16
- /** The correction revision containing the fixed code */
17
- revise: {
18
- /** Optional: Analysis of Date type errors found */
19
- analysis?: string & typia.tags.MaxLength<4000>;
20
- /** Optional: Strategy for fixing Date issues */
21
- strategy?: string & typia.tags.MaxLength<2000>;
22
- /**
23
- * Final corrected code with all Date type issues resolved
24
- *
25
- * Must follow these rules:
26
- *
27
- * - No ': Date' type declarations
28
- * - All dates use 'string & tags.Format<"date-time">'
29
- * - All Date objects wrapped with toISOStringSafe()
30
- * - Null checks before toISOStringSafe()
31
- */
32
- final: string;
33
- };
34
- }
35
- }