@autobe/agent 0.18.0 → 0.19.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 (281) hide show
  1. package/lib/AutoBeMockAgent.d.ts +2 -10
  2. package/lib/agent/src/AutoBeAgent.js +5 -0
  3. package/lib/agent/src/AutoBeAgent.js.map +1 -1
  4. package/lib/agent/src/AutoBeMockAgent.d.ts +2 -10
  5. package/lib/agent/src/AutoBeMockAgent.js +7 -2
  6. package/lib/agent/src/AutoBeMockAgent.js.map +1 -1
  7. package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +23 -29
  8. package/lib/agent/src/constants/AutoBeSystemPromptConstant.js.map +1 -1
  9. package/lib/agent/src/context/AutoBeTokenUsageComponent.d.ts +1 -0
  10. package/lib/agent/src/context/AutoBeTokenUsageComponent.js +14 -0
  11. package/lib/agent/src/context/AutoBeTokenUsageComponent.js.map +1 -1
  12. package/lib/agent/src/factory/consentFunctionCall.d.ts +10 -0
  13. package/lib/agent/src/factory/consentFunctionCall.js +212 -0
  14. package/lib/agent/src/factory/consentFunctionCall.js.map +1 -0
  15. package/lib/agent/src/factory/createAgenticaHistory.js +1 -0
  16. package/lib/agent/src/factory/createAgenticaHistory.js.map +1 -1
  17. package/lib/agent/src/factory/createAutoBeContext.js +71 -14
  18. package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
  19. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +3 -1
  20. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.js +4 -4
  21. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.js.map +1 -1
  22. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +1 -1
  23. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +3 -1
  24. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +16 -4
  25. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  26. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js +8 -3
  27. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  28. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +2 -3
  29. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +7 -7
  30. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
  31. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +24 -37
  32. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  33. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +5 -3
  34. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  35. package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +16 -16
  36. package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +5 -5
  37. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js +1 -0
  38. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
  39. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +1 -1
  40. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  41. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
  42. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  43. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +2 -10
  44. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  45. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
  46. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  47. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
  48. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  49. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +3 -3
  50. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  51. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
  52. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  53. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +9 -3
  54. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  55. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +29 -9
  56. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
  57. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +2 -2
  58. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +1565 -1142
  59. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  60. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +22 -4
  61. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  62. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
  63. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js +11 -15
  64. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  65. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +32 -26
  66. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  67. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.d.ts +2 -3
  68. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +135 -124
  69. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  70. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +371 -209
  71. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  72. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +185 -179
  73. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
  74. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +38 -0
  75. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +16 -16
  76. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +59 -14
  77. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +37 -1
  78. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +46 -14
  79. package/lib/agent/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +18 -24
  80. package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.d.ts +7 -0
  81. package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js +35 -0
  82. package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js.map +1 -0
  83. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +11 -17
  84. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  85. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +1 -1
  86. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
  87. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +2 -2
  88. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  89. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
  90. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  91. package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js +13 -4
  92. package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  93. package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -2
  94. package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js +6 -10
  95. package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  96. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +35 -2
  97. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  98. package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js +44 -3
  99. package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
  100. package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js +40 -3
  101. package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  102. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +2 -2
  103. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
  104. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +5 -5
  105. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  106. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +1 -0
  107. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +2 -2
  108. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  109. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +3 -0
  110. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +278 -0
  111. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -0
  112. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -2
  113. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +12 -20
  114. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  115. package/lib/agent/src/orchestrate/realize/internal/compile.d.ts +3 -3
  116. package/lib/agent/src/orchestrate/realize/internal/compile.js +9 -26
  117. package/lib/agent/src/orchestrate/realize/internal/compile.js.map +1 -1
  118. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +59 -42
  119. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
  120. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +6 -6
  121. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  122. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +6 -6
  123. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +8 -1
  124. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +17 -16
  125. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  126. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +6 -1
  127. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +24 -19
  128. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  129. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
  130. package/lib/agent/src/orchestrate/realize/structures/{IAutoBeRealizeCoderApplication.js → IAutoBeRealizeCorrectApplication.js} +1 -1
  131. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.js.map +1 -0
  132. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +19 -16
  133. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js +5 -1
  134. package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  135. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +1 -1
  136. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  137. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.d.ts +2 -1
  138. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +95 -50
  139. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  140. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +1 -1
  141. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  142. package/lib/agent/src/orchestrate/test/orchestrateTest.js +12 -0
  143. package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
  144. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +4 -4
  145. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +119 -16
  146. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  147. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  148. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +6 -5
  149. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +1 -1
  150. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.d.ts +6 -0
  151. package/lib/agent/src/orchestrate/{internal/IProgress.js → test/structures/IAutoBeTestScenarioAuthorizationRole.js} +1 -1
  152. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.js.map +1 -0
  153. package/lib/agent/src/utils/predicateStateMessage.d.ts +4 -0
  154. package/lib/agent/src/utils/predicateStateMessage.js +87 -0
  155. package/lib/agent/src/utils/predicateStateMessage.js.map +1 -0
  156. package/lib/constants/AutoBeSystemPromptConstant.d.ts +23 -29
  157. package/lib/context/AutoBeTokenUsageComponent.d.ts +1 -0
  158. package/lib/factory/consentFunctionCall.d.ts +10 -0
  159. package/lib/index.mjs +3036 -1648
  160. package/lib/index.mjs.map +1 -1
  161. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +3 -1
  162. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +3 -1
  163. package/lib/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +2 -3
  164. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +16 -16
  165. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +5 -5
  166. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +2 -2
  167. package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
  168. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.d.ts +2 -3
  169. package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +38 -0
  170. package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +16 -16
  171. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +59 -14
  172. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +37 -1
  173. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +46 -14
  174. package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +18 -24
  175. package/lib/orchestrate/interface/utils/validateAuthorizationSchema.d.ts +7 -0
  176. package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -2
  177. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +1 -0
  178. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +3 -0
  179. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -2
  180. package/lib/orchestrate/realize/internal/compile.d.ts +3 -3
  181. package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +8 -1
  182. package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +6 -1
  183. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
  184. package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +19 -16
  185. package/lib/orchestrate/test/histories/transformTestScenarioHistories.d.ts +2 -1
  186. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +6 -5
  187. package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +1 -1
  188. package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.d.ts +6 -0
  189. package/lib/utils/predicateStateMessage.d.ts +4 -0
  190. package/package.json +6 -6
  191. package/src/AutoBeAgent.ts +14 -0
  192. package/src/AutoBeMockAgent.ts +9 -11
  193. package/src/constants/AutoBeSystemPromptConstant.ts +23 -29
  194. package/src/context/AutoBeTokenUsageComponent.ts +20 -0
  195. package/src/factory/consentFunctionCall.ts +128 -0
  196. package/src/factory/createAgenticaHistory.ts +1 -0
  197. package/src/factory/createAutoBeContext.ts +99 -14
  198. package/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.ts +11 -4
  199. package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +26 -4
  200. package/src/orchestrate/analyze/orchestrateAnalyze.ts +19 -14
  201. package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +3 -3
  202. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +8 -32
  203. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +5 -3
  204. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +16 -16
  205. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +5 -5
  206. package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +1 -0
  207. package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +0 -10
  208. package/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.ts +1 -1
  209. package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +9 -3
  210. package/src/orchestrate/interface/orchestrateInterface.ts +51 -12
  211. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +126 -23
  212. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +6 -19
  213. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +32 -27
  214. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +49 -32
  215. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +127 -33
  216. package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +67 -65
  217. package/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.ts +39 -0
  218. package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +16 -16
  219. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +62 -14
  220. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +38 -1
  221. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +47 -14
  222. package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +18 -24
  223. package/src/orchestrate/interface/utils/validateAuthorizationSchema.ts +41 -0
  224. package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +9 -16
  225. package/src/orchestrate/prisma/orchestratePrisma.ts +15 -6
  226. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +6 -19
  227. package/src/orchestrate/prisma/orchestratePrismaReview.ts +15 -9
  228. package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +1 -1
  229. package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +19 -23
  230. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +4 -2
  231. package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +285 -0
  232. package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +27 -27
  233. package/src/orchestrate/realize/internal/compile.ts +28 -45
  234. package/src/orchestrate/realize/orchestrateRealize.ts +71 -67
  235. package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +3 -3
  236. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +19 -15
  237. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +23 -15
  238. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +3 -3
  239. package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +19 -16
  240. package/src/orchestrate/realize/utils/replaceImportStatements.ts +7 -0
  241. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +110 -59
  242. package/src/orchestrate/test/orchestrateTest.ts +12 -0
  243. package/src/orchestrate/test/orchestrateTestScenario.ts +155 -19
  244. package/src/orchestrate/test/orchestrateTestWrite.ts +3 -3
  245. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +6 -5
  246. package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +1 -1
  247. package/src/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.ts +7 -0
  248. package/src/utils/predicateStateMessage.ts +107 -0
  249. package/lib/agent/src/orchestrate/internal/IProgress.d.ts +0 -4
  250. package/lib/agent/src/orchestrate/internal/IProgress.js.map +0 -1
  251. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCoderHistories.d.ts +0 -7
  252. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCoderHistories.js +0 -213
  253. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCoderHistories.js.map +0 -1
  254. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +0 -345
  255. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js.map +0 -1
  256. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +0 -56
  257. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCompile.js +0 -3
  258. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCompile.js.map +0 -1
  259. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.d.ts +0 -2
  260. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.js +0 -5
  261. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.js.map +0 -1
  262. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeReviewApplication.js +0 -3
  263. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeReviewApplication.js.map +0 -1
  264. package/lib/agent/src/utils/pipe.d.ts +0 -5
  265. package/lib/agent/src/utils/pipe.js +0 -14
  266. package/lib/agent/src/utils/pipe.js.map +0 -1
  267. package/lib/orchestrate/internal/IProgress.d.ts +0 -4
  268. package/lib/orchestrate/realize/histories/transformRealizeCoderHistories.d.ts +0 -7
  269. package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +0 -345
  270. package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +0 -56
  271. package/lib/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.d.ts +0 -2
  272. package/lib/utils/pipe.d.ts +0 -5
  273. package/src/orchestrate/internal/IProgress.ts +0 -4
  274. package/src/orchestrate/realize/histories/transformRealizeCoderHistories.ts +0 -248
  275. package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +0 -358
  276. package/src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts +0 -70
  277. package/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.ts +0 -2
  278. package/src/utils/pipe.ts +0 -39
  279. /package/lib/agent/src/orchestrate/realize/structures/{IAutoBeRealizeReviewApplication.d.ts → IAutoBeRealizeCorrectApplication.d.ts} +0 -0
  280. /package/lib/orchestrate/realize/structures/{IAutoBeRealizeReviewApplication.d.ts → IAutoBeRealizeCorrectApplication.d.ts} +0 -0
  281. /package/src/orchestrate/realize/structures/{IAutoBeRealizeReviewApplication.ts → IAutoBeRealizeCorrectApplication.ts} +0 -0
@@ -5,6 +5,7 @@ import {
5
5
  } from "@autobe/interface";
6
6
  import { v4 } from "uuid";
7
7
 
8
+ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
8
9
  import { AutoBeState } from "../../../context/AutoBeState";
9
10
  import { IAutoBeTestScenarioArtifacts } from "../../test/structures/IAutoBeTestScenarioArtifacts";
10
11
  import { IAutoBeRealizeScenarioApplication } from "../structures/IAutoBeRealizeScenarioApplication";
@@ -15,6 +16,7 @@ export function transformRealizeCorrectHistories(props: {
15
16
  scenario: IAutoBeRealizeScenarioApplication.IProps;
16
17
  artifacts: IAutoBeTestScenarioArtifacts;
17
18
  authorization: AutoBeRealizeAuthorization | null;
19
+ totalAuthorizations: AutoBeRealizeAuthorization[];
18
20
  code: string;
19
21
  diagnostic: IAutoBeTypeScriptCompileResult.IDiagnostic;
20
22
  }): Array<
@@ -32,7 +34,7 @@ export function transformRealizeCorrectHistories(props: {
32
34
  "```",
33
35
  `The code has a compilation error:`,
34
36
  "```json",
35
- JSON.stringify(props.diagnostic, null, 2),
37
+ JSON.stringify(props.diagnostic),
36
38
  "",
37
39
  ].join("\n"),
38
40
  created_at: new Date().toISOString(),
@@ -40,7 +42,7 @@ export function transformRealizeCorrectHistories(props: {
40
42
  {
41
43
  id: v4(),
42
44
  type: "systemMessage",
43
- text: `You are an expert TypeScript developer. You will review the code and correct`,
45
+ text: AutoBeSystemPromptConstant.REALIZE_CORRECT,
44
46
  created_at: new Date().toISOString(),
45
47
  },
46
48
  ];
@@ -0,0 +1,285 @@
1
+ import { IAgenticaHistoryJson } from "@agentica/core";
2
+ import { AutoBeOpenApi } from "@autobe/interface";
3
+ import { StringUtil } from "@autobe/utils";
4
+ import { v4 } from "uuid";
5
+
6
+ export const transformRealizeWriteAuthorizationsHistories = (
7
+ operation: AutoBeOpenApi.IOperation,
8
+ payloads: Record<string, string>,
9
+ ): Array<IAgenticaHistoryJson.ISystemMessage> => {
10
+ // Login operation 가이드
11
+ const loginGuide =
12
+ operation.authorizationType === "login"
13
+ ? [
14
+ {
15
+ id: v4(),
16
+ created_at: new Date().toISOString(),
17
+ type: "systemMessage" as const,
18
+ text: StringUtil.trim`
19
+ # Authorization Type: Login
20
+
21
+ This is a **login** operation that authenticates users.
22
+
23
+ ## Implementation Guidelines for Login:
24
+
25
+ ### Login Operation Requirements
26
+ - This is a login endpoint that authenticates users
27
+ - Must validate credentials (username/email and password)
28
+ - Should return authentication tokens (access and refresh tokens)
29
+ - Must NOT require authentication decorator (this endpoint creates authentication)
30
+ - Should check if user exists and password matches
31
+
32
+ ### MANDATORY: Use MyGlobal.password for Password Verification
33
+
34
+ **CRITICAL**: You MUST use MyGlobal.password utilities for password verification to ensure consistency with the join operation:
35
+
36
+ \`\`\`typescript
37
+ // Example: Password verification in login
38
+ const isValid = await MyGlobal.password.verify(
39
+ body.password, // plain password from request
40
+ user.password_hash // hashed password from database
41
+ );
42
+
43
+ if (!isValid) {
44
+ throw new Error("Invalid credentials");
45
+ }
46
+ \`\`\`
47
+
48
+ ### JWT Token Generation
49
+
50
+ **NOTE**: The jsonwebtoken library is automatically imported as jwt. Use it to generate tokens with the EXACT payload structure:
51
+
52
+ **CRITICAL**: Use the predefined payload structures for consistency:
53
+ ${JSON.stringify(payloads)}
54
+
55
+ // JWT is already imported: import jwt from "jsonwebtoken";
56
+
57
+ // Generate access token with the EXACT payload structure for the user type
58
+ // DO NOT use type annotations like: const payload: MemberPayload = {...}
59
+ // Just create the payload object directly
60
+
61
+ const accessToken = jwt.sign(
62
+ {
63
+ userId: user.id,
64
+ email: user.email,
65
+ // ... other required fields from the payload structure above
66
+ },
67
+ MyGlobal.env.JWT_SECRET_KEY,
68
+ {
69
+ expiresIn: '1h',
70
+ issuer: 'autobe' // MUST use 'autobe' as issuer
71
+ }
72
+ );
73
+
74
+ // Generate refresh token (optional)
75
+ const refreshToken = jwt.sign(
76
+ {
77
+ userId: user.id,
78
+ tokenType: 'refresh'
79
+ },
80
+ MyGlobal.env.JWT_SECRET_KEY,
81
+ {
82
+ expiresIn: '7d',
83
+ issuer: 'autobe' // MUST use 'autobe' as issuer
84
+ }
85
+ );
86
+
87
+ // Decode tokens if needed (e.g., for verification)
88
+ const decoded = jwt.verify(token, MyGlobal.env.JWT_SECRET_KEY, {
89
+ issuer: 'autobe' // Verify issuer is 'autobe'
90
+ });
91
+
92
+ **DO NOT**:
93
+ - Implement your own password hashing logic
94
+ - Use bcrypt, argon2, or any other hashing library directly
95
+ - Try to hash and compare manually
96
+
97
+ **IMPORTANT**: Since this is a login operation, it must be publicly accessible without authentication.
98
+ `,
99
+ },
100
+ ]
101
+ : [];
102
+
103
+ // Join (registration) operation 가이드
104
+ const joinGuide =
105
+ operation.authorizationType === "join"
106
+ ? [
107
+ {
108
+ id: v4(),
109
+ created_at: new Date().toISOString(),
110
+ type: "systemMessage" as const,
111
+ text: StringUtil.trim`
112
+ # Authorization Type: Join (Registration)
113
+
114
+ This is a **join** operation for user registration.
115
+
116
+ ## Implementation Guidelines for Join:
117
+
118
+ ### Join (Registration) Operation Requirements
119
+ - This is a user registration endpoint
120
+ - Must validate all required user information
121
+ - Should check for duplicate accounts (email, username, etc.)
122
+ - Must hash passwords before storing (NEVER store plain passwords)
123
+ - Should create a new user record in the database
124
+ - Must NOT require authentication decorator (public endpoint)
125
+
126
+ ### MANDATORY: Use MyGlobal.password for Password Hashing
127
+
128
+ **CRITICAL**: You MUST use MyGlobal.password utilities for password hashing to ensure consistency across all authentication operations:
129
+
130
+ \`\`\`typescript
131
+ // Example: Password hashing in join/registration
132
+ const hashedPassword = await MyGlobal.password.hash(body.password);
133
+
134
+ // Store the hashed password in database
135
+ await MyGlobal.prisma.users.create({
136
+ data: {
137
+ email: body.email,
138
+ password_hash: hashedPassword, // Store the hash, never plain password
139
+ // ... other fields
140
+ }
141
+ });
142
+ \`\`\`
143
+
144
+ **DO NOT**:
145
+ - Store plain passwords in the database
146
+ - Use bcrypt, argon2, or any other hashing library directly
147
+ - Implement your own hashing logic
148
+
149
+ ### JWT Token Generation After Registration
150
+
151
+ **NOTE**: The jsonwebtoken library is automatically imported as jwt. After successful registration, generate tokens with the EXACT payload structure:
152
+
153
+ **CRITICAL**: Use the predefined payload structures for consistency:
154
+ ${JSON.stringify(payloads)}
155
+
156
+ // JWT is already imported: import jwt from "jsonwebtoken";
157
+
158
+ // After creating the user, generate tokens with EXACT payload structure
159
+ // DO NOT use type annotations like: const payload: UserPayload = {...}
160
+ // Just create the payload object directly in jwt.sign()
161
+
162
+ const accessToken = jwt.sign(
163
+ {
164
+ userId: newUser.id,
165
+ email: newUser.email,
166
+ // ... other required fields from the payload structure above
167
+ },
168
+ MyGlobal.env.JWT_SECRET_KEY,
169
+ {
170
+ expiresIn: '1h',
171
+ issuer: 'autobe' // MUST use 'autobe' as issuer
172
+ }
173
+ );
174
+
175
+ const refreshToken = jwt.sign(
176
+ {
177
+ userId: newUser.id,
178
+ tokenType: 'refresh'
179
+ },
180
+ MyGlobal.env.JWT_SECRET_KEY,
181
+ {
182
+ expiresIn: '7d',
183
+ issuer: 'autobe' // MUST use 'autobe' as issuer
184
+ }
185
+ );
186
+
187
+ **IMPORTANT**: Since this is a registration operation, it must be publicly accessible. Always hash passwords before storing.
188
+ `,
189
+ },
190
+ ]
191
+ : [];
192
+
193
+ // Refresh token operation 가이드
194
+ const refreshGuide =
195
+ operation.authorizationType === "refresh"
196
+ ? [
197
+ {
198
+ id: v4(),
199
+ created_at: new Date().toISOString(),
200
+ type: "systemMessage" as const,
201
+ text: StringUtil.trim`
202
+ # Authorization Type: Refresh Token
203
+
204
+ This is a **refresh** token operation for renewing expired access tokens.
205
+
206
+ ## Implementation Guidelines for Refresh:
207
+
208
+ ### Refresh Token Operation Requirements
209
+ - This endpoint refreshes expired access tokens
210
+ - Must validate the refresh token first
211
+ - Should check if refresh token is not expired or revoked
212
+ - Must generate a new access token with THE SAME payload structure
213
+ - May also rotate the refresh token for security
214
+ - Should handle invalid/expired refresh tokens gracefully
215
+ - Typically requires the refresh token in request body or headers
216
+ - Must NOT require standard authentication (uses refresh token instead)
217
+
218
+ ### CRITICAL: Refresh Token Implementation
219
+
220
+ **IMPORTANT**: When refreshing tokens, you MUST:
221
+ 1. Decode and verify the refresh token
222
+ 2. Extract the user information from the decoded token
223
+ 3. Generate a new access token with THE SAME payload structure as the original
224
+
225
+ **CRITICAL**: Use the predefined payload structures for consistency:
226
+ ${JSON.stringify(payloads)}
227
+
228
+ // JWT is already imported: import jwt from "jsonwebtoken";
229
+
230
+ // Step 1: Verify and decode the refresh token
231
+ const decoded = jwt.verify(body.refreshToken, MyGlobal.env.JWT_SECRET_KEY, {
232
+ issuer: 'autobe'
233
+ });
234
+
235
+ // Step 2: Get user data (from decoded token or database)
236
+ const user = await MyGlobal.prisma.users.findUnique({
237
+ where: { id: decoded.userId }
238
+ });
239
+
240
+ if (!user) {
241
+ throw new Error("User not found");
242
+ }
243
+
244
+ // Step 3: Generate new access token with SAME payload structure as login/join
245
+ const newAccessToken = jwt.sign(
246
+ {
247
+ userId: user.id,
248
+ email: user.email,
249
+ // ... other required fields from the payload structure above
250
+ // MUST match the structure used in login/join operations
251
+ },
252
+ MyGlobal.env.JWT_SECRET_KEY,
253
+ {
254
+ expiresIn: '1h',
255
+ issuer: 'autobe'
256
+ }
257
+ );
258
+
259
+ // Optional: Rotate refresh token
260
+ const newRefreshToken = jwt.sign(
261
+ {
262
+ userId: user.id,
263
+ tokenType: 'refresh'
264
+ },
265
+ MyGlobal.env.JWT_SECRET_KEY,
266
+ {
267
+ expiresIn: '7d',
268
+ issuer: 'autobe'
269
+ }
270
+ );
271
+
272
+ **DO NOT**:
273
+ - Generate new access tokens with different payload structures
274
+ - Use random IDs like v4() in the payload
275
+ - Create tokens without verifying the refresh token first
276
+ - Use type annotations like: const payload: UserPayload = {...}
277
+
278
+ **IMPORTANT**: The new access token MUST have the same payload structure as the original token from login/join operations.
279
+ `,
280
+ },
281
+ ]
282
+ : [];
283
+
284
+ return [...loginGuide, ...joinGuide, ...refreshGuide];
285
+ };
@@ -6,15 +6,20 @@ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromp
6
6
  import { AutoBeState } from "../../../context/AutoBeState";
7
7
  import { IAutoBeTestScenarioArtifacts } from "../../test/structures/IAutoBeTestScenarioArtifacts";
8
8
  import { IAutoBeRealizeScenarioApplication } from "../structures/IAutoBeRealizeScenarioApplication";
9
+ import { transformRealizeWriteAuthorizationsHistories } from "./transformRealizeWriteAuthorizationsHistories";
9
10
 
10
- export const transformRealizeWriteHistories = (props: {
11
- state: AutoBeState;
12
- scenario: IAutoBeRealizeScenarioApplication.IProps;
13
- artifacts: IAutoBeTestScenarioArtifacts;
14
- authorization: AutoBeRealizeAuthorization | null;
15
- }): Array<
11
+ export const transformRealizeWriteHistories = (
12
+ props: IProps,
13
+ ): Array<
16
14
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
17
15
  > => {
16
+ const payloads = Object.fromEntries(
17
+ props.totalAuthorizations.map((el) => [
18
+ el.payload.location,
19
+ el.payload.content,
20
+ ]),
21
+ );
22
+
18
23
  const [operation] = props.artifacts.document.operations;
19
24
 
20
25
  const propsFields: string[] = [];
@@ -113,18 +118,24 @@ export const transformRealizeWriteHistories = (props: {
113
118
  },
114
119
  ];
115
120
 
121
+ // Get authorization-specific histories if authorizationType is set
122
+ const authorizationHistories = operation.authorizationType
123
+ ? transformRealizeWriteAuthorizationsHistories(operation, payloads)
124
+ : [];
125
+
116
126
  return [
117
127
  {
118
128
  id: v4(),
119
129
  created_at: new Date().toISOString(),
120
130
  type: "systemMessage",
121
- text: AutoBeSystemPromptConstant.REALIZE_CODER_TOTAL,
131
+ text: AutoBeSystemPromptConstant.REALIZE_WRITE_TOTAL,
122
132
  },
133
+ ...authorizationHistories,
123
134
  {
124
135
  id: v4(),
125
136
  created_at: new Date().toISOString(),
126
137
  type: "systemMessage",
127
- text: AutoBeSystemPromptConstant.REALIZE_CODER_ARTIFACT.replaceAll(
138
+ text: AutoBeSystemPromptConstant.REALIZE_WRITE_ARTIFACT.replaceAll(
128
139
  `{prisma_schemas}`,
129
140
  JSON.stringify(props.state.prisma.schemas),
130
141
  )
@@ -132,7 +143,6 @@ export const transformRealizeWriteHistories = (props: {
132
143
  .replaceAll(`{artifacts_dto}`, JSON.stringify(props.artifacts.dto))
133
144
  .replaceAll(`{input}`, input),
134
145
  },
135
-
136
146
  {
137
147
  id: v4(),
138
148
  created_at: new Date().toISOString(),
@@ -162,23 +172,13 @@ export const transformRealizeWriteHistories = (props: {
162
172
  `I'll make sure to follow all these rules strictly. Let’s proceed with this in mind.`,
163
173
  ].join("\n"),
164
174
  },
165
- {
166
- id: v4(),
167
- created_at: new Date().toISOString(),
168
- type: "assistantMessage",
169
- text: [
170
- `I understand your request.`,
171
- ``,
172
- `To summarize:`,
173
- `- I must **never use the native \`Date\` type** in any code or type definitions.`,
174
- `- Instead, all date and datetime values must be handled as \`string & tags.Format<'date-time'>\`.`,
175
- `- This rule is **strict** and applies everywhere, including domain types, API inputs/outputs, and Prisma models.`,
176
- `- Even if a library or tool returns a \`Date\`, I must convert it to the correct string format before use.`,
177
- ``,
178
- `Especially regarding the \`Date\` type: I understand that using it can lead to type inconsistency and runtime issues, so I will completely avoid it in all circumstances.`,
179
- ``,
180
- `I'll make sure to follow all these rules strictly. Let’s proceed with this in mind.`,
181
- ].join("\n"),
182
- },
183
175
  ];
184
176
  };
177
+
178
+ interface IProps {
179
+ state: AutoBeState;
180
+ scenario: IAutoBeRealizeScenarioApplication.IProps;
181
+ artifacts: IAutoBeTestScenarioArtifacts;
182
+ authorization: AutoBeRealizeAuthorization | null;
183
+ totalAuthorizations: AutoBeRealizeAuthorization[];
184
+ }
@@ -1,47 +1,53 @@
1
1
  import {
2
2
  AutoBeRealizeAuthorization,
3
+ AutoBeRealizeFunction,
3
4
  AutoBeRealizeValidateEvent,
4
5
  IAutoBeTypeScriptCompileResult,
5
6
  } from "@autobe/interface";
6
7
  import { ILlmSchema } from "@samchon/openapi";
7
8
 
8
9
  import { AutoBeContext } from "../../../context/AutoBeContext";
9
- import { IAutoBeRealizeCompile } from "../structures/IAutoBeRealizeCompile";
10
10
 
11
11
  export async function compile<Model extends ILlmSchema.Model>(
12
12
  ctx: AutoBeContext<Model>,
13
13
  props: {
14
14
  authorizations: AutoBeRealizeAuthorization[];
15
- providers: Record<string, string>;
15
+ functions: AutoBeRealizeFunction[];
16
16
  },
17
- ): Promise<
18
- IAutoBeTypeScriptCompileResult.ISuccess | AutoBeRealizeValidateEvent
19
- > {
17
+ ): Promise<IAutoBeTypeScriptCompileResult> {
20
18
  const prisma = ctx.state().prisma?.compiled;
21
19
  const payloads: Record<string, string> = Object.fromEntries(
22
20
  props.authorizations.map((el) => [el.payload.location, el.payload.content]),
23
21
  );
24
- const templateFiles = await getTemplates(ctx);
25
- const nodeModules = prisma?.type === "success" ? prisma.nodeModules : {};
26
22
  const compiler = await ctx.compiler();
27
- const compiled = await compiler.typescript.compile({
28
- files: {
29
- ...nodeModules,
30
- ...payloads,
31
- ...Object.fromEntries(
32
- Object.entries(await ctx.files({ dbms: "sqlite" })).filter(([key]) =>
33
- key.startsWith("src"),
34
- ),
35
- ),
36
- ...Object.fromEntries(
37
- templateFiles.map((file) => [file.location, file.content]),
23
+ const templateFiles = await compiler.realize.getTemplate();
24
+ const nodeModules = prisma?.type === "success" ? prisma.nodeModules : {};
25
+
26
+ const filterTsFiles = (location: string) => location.endsWith(".ts");
27
+
28
+ const files: Record<string, string> = {
29
+ ...nodeModules,
30
+ ...payloads,
31
+ ...Object.fromEntries(
32
+ Object.entries(await ctx.files({ dbms: "sqlite" })).filter(([key]) =>
33
+ filterTsFiles(key),
38
34
  ),
39
- ...props.providers,
40
- },
35
+ ),
36
+ ...Object.fromEntries(
37
+ Object.entries(templateFiles).filter(([key]) => filterTsFiles(key)),
38
+ ),
39
+ ...Object.fromEntries(
40
+ props.functions.map((el) => [el.location, el.content]),
41
+ ),
42
+ };
43
+
44
+ const compiled = await compiler.typescript.compile({
45
+ files: files,
41
46
  });
42
47
 
43
48
  if (compiled.type === "success") {
44
49
  return compiled;
50
+ } else if (compiled.type === "failure") {
45
51
  }
46
52
 
47
53
  const event: AutoBeRealizeValidateEvent = {
@@ -55,30 +61,7 @@ export async function compile<Model extends ILlmSchema.Model>(
55
61
  step: ctx.state().analyze?.step ?? 0,
56
62
  created_at: new Date().toISOString(),
57
63
  };
64
+ ctx.dispatch(event);
58
65
 
59
- return event;
60
- }
61
-
62
- /**
63
- * Loads template files for the realize agent These files are essential for the
64
- * realize coder to pass compilation
65
- *
66
- * @param ctx Context of agent
67
- * @returns Template file infomations
68
- */
69
- async function getTemplates<Model extends ILlmSchema.Model>(
70
- ctx: AutoBeContext<Model>,
71
- ): Promise<IAutoBeRealizeCompile.CodeArtifact[]> {
72
- const compiler = await ctx.compiler();
73
- const templateFiles = await compiler.realize.getTemplate();
74
- const pathnames = ["src/MyGlobal.ts", "src/util/toISOStringSafe.ts"] as const;
75
-
76
- return pathnames.map((pathname): IAutoBeRealizeCompile.CodeArtifact => {
77
- return {
78
- content: templateFiles[pathname],
79
- result: "success",
80
- location: pathname,
81
- role: null, // template files doesn't have role.
82
- } as const;
83
- });
66
+ return compiled;
84
67
  }