@autobe/agent 0.19.1 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. package/lib/agent/src/AutoBeAgent.js +3 -2
  2. package/lib/agent/src/AutoBeAgent.js.map +1 -1
  3. package/lib/agent/src/AutoBeMockAgent.js +4 -3
  4. package/lib/agent/src/AutoBeMockAgent.js.map +1 -1
  5. package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +12 -11
  6. package/lib/agent/src/constants/AutoBeSystemPromptConstant.js.map +1 -1
  7. package/lib/agent/src/context/AutoBeContext.d.ts +3 -2
  8. package/lib/agent/src/factory/consentFunctionCall.js +3 -2
  9. package/lib/agent/src/factory/consentFunctionCall.js.map +1 -1
  10. package/lib/agent/src/factory/createAutoBeContext.js +11 -6
  11. package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
  12. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.d.ts +6 -0
  13. package/lib/agent/src/orchestrate/analyze/histories/{transformAnalyzeReviewerHistories.js → transformAnalyzeReviewHistories.js} +24 -29
  14. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -0
  15. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +12 -9
  16. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  17. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +31 -29
  18. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  19. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js +19 -5
  20. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  21. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +7 -1
  22. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +9 -6
  23. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
  24. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +11 -9
  25. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  26. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +6 -4
  27. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +5 -1
  28. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  29. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js +45 -46
  30. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
  31. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +13 -13
  32. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  33. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +31 -30
  34. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  35. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +23 -22
  36. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  37. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
  38. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +33 -0
  39. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -0
  40. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
  41. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +27 -26
  42. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  43. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +13 -12
  44. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  45. package/lib/agent/src/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js +4 -4
  46. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +11 -10
  47. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  48. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +32 -31
  49. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  50. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +3 -1
  51. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
  52. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +28 -24
  53. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  54. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +2 -0
  55. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  56. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js +11 -5
  57. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  58. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
  59. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +365 -0
  60. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -0
  61. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js +2 -0
  62. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  63. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +80 -54
  64. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  65. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +1635 -1180
  66. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  67. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +30 -24
  68. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  69. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +2 -5
  70. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +178 -0
  71. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
  72. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
  73. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js +3 -0
  74. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js.map +1 -0
  75. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +38 -0
  76. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +78 -0
  77. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +54 -54
  78. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  79. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +18 -29
  80. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
  81. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +37 -34
  82. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  83. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +38 -25
  84. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  85. package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js +3 -1
  86. package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  87. package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js +2 -0
  88. package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  89. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +3 -0
  90. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  91. package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js +19 -9
  92. package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
  93. package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js +28 -21
  94. package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  95. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +24 -21
  96. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
  97. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +58 -56
  98. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  99. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +17 -13
  100. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  101. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +12 -3
  102. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
  103. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +35 -30
  104. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  105. package/lib/{orchestrate/realize/internal/compile.d.ts → agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts} +1 -1
  106. package/lib/agent/src/orchestrate/realize/internal/{compile.js → compileRealizeFiles.js} +6 -6
  107. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -0
  108. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +26 -12
  109. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
  110. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +9 -3
  111. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  112. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +3 -1
  113. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  114. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +2 -6
  115. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +12 -8
  116. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  117. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +0 -66
  118. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js +2 -2
  119. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
  120. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +3 -6
  121. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +25 -21
  122. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  123. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +2 -2
  124. package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +7 -2
  125. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js +13 -10
  126. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
  127. package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js +1 -1
  128. package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
  129. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.d.ts +3 -1
  130. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +44 -27
  131. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  132. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +63 -60
  133. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  134. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
  135. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +118 -96
  136. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  137. package/lib/agent/src/orchestrate/test/orchestrateTest.js +6 -5
  138. package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
  139. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +17 -8
  140. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  141. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +30 -18
  142. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  143. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +18 -18
  144. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  145. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +2 -2
  146. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
  147. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +2 -2
  148. package/lib/agent/src/utils/executeCachedBatch.d.ts +1 -0
  149. package/lib/agent/src/utils/executeCachedBatch.js +23 -0
  150. package/lib/agent/src/utils/executeCachedBatch.js.map +1 -0
  151. package/lib/constants/AutoBeSystemPromptConstant.d.ts +12 -11
  152. package/lib/context/AutoBeContext.d.ts +3 -2
  153. package/lib/index.mjs +3265 -1702
  154. package/lib/index.mjs.map +1 -1
  155. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.d.ts +6 -0
  156. package/lib/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +7 -1
  157. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +6 -4
  158. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
  159. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
  160. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +2 -5
  161. package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
  162. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +38 -0
  163. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +78 -0
  164. package/lib/{agent/src/orchestrate/realize/internal/compile.d.ts → orchestrate/realize/internal/compileRealizeFiles.d.ts} +1 -1
  165. package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +2 -6
  166. package/lib/orchestrate/realize/orchestrateRealizeScenario.d.ts +0 -66
  167. package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +3 -6
  168. package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +2 -2
  169. package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +7 -2
  170. package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +3 -1
  171. package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
  172. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +2 -2
  173. package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
  174. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +2 -2
  175. package/lib/utils/executeCachedBatch.d.ts +1 -0
  176. package/package.json +7 -7
  177. package/src/AutoBeAgent.ts +4 -3
  178. package/src/AutoBeMockAgent.ts +5 -4
  179. package/src/constants/AutoBeSystemPromptConstant.ts +12 -11
  180. package/src/context/AutoBeContext.ts +3 -0
  181. package/src/factory/consentFunctionCall.ts +4 -3
  182. package/src/factory/createAutoBeContext.ts +11 -7
  183. package/src/orchestrate/analyze/histories/{transformAnalyzeReviewerHistories.ts → transformAnalyzeReviewHistories.ts} +23 -30
  184. package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +13 -10
  185. package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +60 -61
  186. package/src/orchestrate/analyze/orchestrateAnalyze.ts +20 -13
  187. package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +20 -9
  188. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +13 -11
  189. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +10 -5
  190. package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +47 -48
  191. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +14 -14
  192. package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +31 -30
  193. package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +20 -19
  194. package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +39 -0
  195. package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +3 -3
  196. package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +23 -22
  197. package/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.ts +12 -11
  198. package/src/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.ts +5 -5
  199. package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +11 -10
  200. package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +31 -30
  201. package/src/orchestrate/interface/orchestrateInterface.ts +4 -2
  202. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +36 -29
  203. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +2 -0
  204. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +18 -10
  205. package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +95 -0
  206. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +2 -0
  207. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +53 -50
  208. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +120 -10
  209. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +47 -23
  210. package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +85 -1
  211. package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.ts +65 -0
  212. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +39 -0
  213. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +82 -1
  214. package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +57 -55
  215. package/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.ts +19 -30
  216. package/src/orchestrate/prisma/histories/transformPrismaReviewHistories.ts +38 -35
  217. package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +36 -23
  218. package/src/orchestrate/prisma/orchestratePrisma.ts +4 -2
  219. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +2 -0
  220. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +3 -0
  221. package/src/orchestrate/prisma/orchestratePrismaReview.ts +26 -13
  222. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +25 -17
  223. package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +24 -21
  224. package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +42 -40
  225. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +17 -13
  226. package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +14 -5
  227. package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +35 -30
  228. package/src/orchestrate/realize/internal/{compile.ts → compileRealizeFiles.ts} +15 -11
  229. package/src/orchestrate/realize/orchestrateRealize.ts +59 -40
  230. package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +19 -10
  231. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +3 -0
  232. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +10 -10
  233. package/src/orchestrate/realize/orchestrateRealizeScenario.ts +7 -77
  234. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +24 -23
  235. package/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.ts +6 -2
  236. package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +10 -5
  237. package/src/orchestrate/test/compile/completeTestCode.ts +17 -13
  238. package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +2 -0
  239. package/src/orchestrate/test/experimental/transformTestCorrectHistories.ast +4 -4
  240. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +50 -37
  241. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +62 -57
  242. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +27 -7
  243. package/src/orchestrate/test/orchestrateTest.ts +7 -9
  244. package/src/orchestrate/test/orchestrateTestCorrect.ts +39 -25
  245. package/src/orchestrate/test/orchestrateTestScenario.ts +28 -21
  246. package/src/orchestrate/test/orchestrateTestWrite.ts +17 -18
  247. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +3 -3
  248. package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +28 -1
  249. package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +2 -2
  250. package/src/utils/executeCachedBatch.ts +15 -0
  251. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +0 -6
  252. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.js.map +0 -1
  253. package/lib/agent/src/orchestrate/realize/internal/compile.js.map +0 -1
  254. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
  255. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js +0 -74
  256. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js.map +0 -1
  257. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +0 -6
  258. package/lib/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
  259. package/src/orchestrate/test/histories/transformTestHistories.ts +0 -77
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  IAgenticaVendor,
3
3
  IMicroAgenticaHistoryJson,
4
+ MicroAgentica,
4
5
  MicroAgenticaHistory,
5
6
  } from "@agentica/core";
6
7
  import {
@@ -49,6 +50,7 @@ export interface AutoBeContext<Model extends ILlmSchema.Model> {
49
50
  // factories
50
51
  conversate(
51
52
  props: AutoBeContext.IConversate<Model>,
53
+ closure?: (agent: MicroAgentica<Model>) => void,
52
54
  ): Promise<AutoBeContext.IResult<Model>>;
53
55
  }
54
56
  export namespace AutoBeContext {
@@ -71,6 +73,7 @@ export namespace AutoBeContext {
71
73
  histories: Array<IMicroAgenticaHistoryJson>;
72
74
  enforceFunctionCall: boolean;
73
75
  message: string;
76
+ promptCacheKey?: string;
74
77
  }
75
78
  export interface IResult<Model extends ILlmSchema.Model> {
76
79
  histories: MicroAgenticaHistory<Model>[];
@@ -10,7 +10,7 @@ import {
10
10
  } from "@autobe/interface";
11
11
  import { IPointer } from "tstl";
12
12
  import typia from "typia";
13
- import { v4 } from "uuid";
13
+ import { v7 } from "uuid";
14
14
 
15
15
  import { AutoBeSystemPromptConstant } from "../constants/AutoBeSystemPromptConstant";
16
16
  import { IAutoBeConfig } from "../structures/IAutoBeConfig";
@@ -37,13 +37,13 @@ export const consentFunctionCall = async (props: {
37
37
  },
38
38
  histories: [
39
39
  {
40
- id: v4(),
40
+ id: v7(),
41
41
  type: "systemMessage",
42
42
  text: AutoBeSystemPromptConstant.CONSENT_FUNCTION_CALL,
43
43
  created_at: new Date().toISOString(),
44
44
  } satisfies IAgenticaHistoryJson.ISystemMessage,
45
45
  {
46
- id: v4(),
46
+ id: v7(),
47
47
  type: "assistantMessage",
48
48
  text: props.assistantMessage,
49
49
  created_at: new Date().toISOString(),
@@ -79,6 +79,7 @@ export const consentFunctionCall = async (props: {
79
79
  }
80
80
  props.dispatch({
81
81
  type: "consentFunctionCall",
82
+ id: v7(),
82
83
  source: props.source,
83
84
  assistantMessage: props.assistantMessage,
84
85
  result: pointer.value,
@@ -25,7 +25,7 @@ import {
25
25
  } from "@autobe/interface";
26
26
  import { ILlmSchema } from "@samchon/openapi";
27
27
  import typia from "typia";
28
- import { v4 } from "uuid";
28
+ import { v7 } from "uuid";
29
29
 
30
30
  import { AutoBeContext } from "../context/AutoBeContext";
31
31
  import { AutoBeState } from "../context/AutoBeState";
@@ -63,7 +63,7 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
63
63
  setTimeout(() => props.dispatch(message).catch(() => {}));
64
64
  return message;
65
65
  },
66
- conversate: async (next) => {
66
+ conversate: async (next, closure) => {
67
67
  const execute = async (): Promise<AutoBeContext.IResult<Model>> => {
68
68
  const agent: MicroAgentica<Model> = new MicroAgentica<Model>({
69
69
  model: props.model,
@@ -82,6 +82,8 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
82
82
  event.body.tool_choice = "required";
83
83
  if (event.body.parallel_tool_calls !== undefined)
84
84
  delete event.body.parallel_tool_calls;
85
+ if (next.promptCacheKey)
86
+ event.body.prompt_cache_key = next.promptCacheKey;
85
87
  await props.dispatch({
86
88
  ...event,
87
89
  type: "vendorRequest",
@@ -109,12 +111,14 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
109
111
  void props
110
112
  .dispatch({
111
113
  type: "jsonValidateError",
114
+ id: v7(),
112
115
  source: next.source,
113
116
  result: event.result,
114
117
  created_at: event.created_at,
115
118
  })
116
119
  .catch(() => {});
117
120
  });
121
+ if (closure) closure(agent);
118
122
 
119
123
  const histories: MicroAgenticaHistory<Model>[] = await agent.conversate(
120
124
  next.message,
@@ -218,7 +222,7 @@ const createDispatch = (props: {
218
222
  event,
219
223
  history: {
220
224
  type: "analyze",
221
- id: v4(),
225
+ id: v7(),
222
226
  reason: analyzeStart?.reason ?? "",
223
227
  prefix: event.prefix,
224
228
  roles: event.roles,
@@ -236,7 +240,7 @@ const createDispatch = (props: {
236
240
  event,
237
241
  history: {
238
242
  type: "prisma",
239
- id: v4(),
243
+ id: v7(),
240
244
  reason: prismaStart?.reason ?? "",
241
245
  schemas: event.schemas,
242
246
  result: event.result,
@@ -254,7 +258,7 @@ const createDispatch = (props: {
254
258
  event,
255
259
  history: {
256
260
  type: "interface",
257
- id: v4(),
261
+ id: v7(),
258
262
  reason: interfaceStart?.reason ?? "",
259
263
  authorizations: event.authorizations,
260
264
  document: event.document,
@@ -271,7 +275,7 @@ const createDispatch = (props: {
271
275
  event,
272
276
  history: {
273
277
  type: "test",
274
- id: v4(),
278
+ id: v7(),
275
279
  reason: testStart?.reason ?? "",
276
280
  files: event.files,
277
281
  compiled: event.compiled,
@@ -288,7 +292,7 @@ const createDispatch = (props: {
288
292
  event,
289
293
  history: {
290
294
  type: "realize",
291
- id: v4(),
295
+ id: v7(),
292
296
  reason: realizeStart?.reason ?? "",
293
297
  authorizations: event.authorizations,
294
298
  functions: event.functions,
@@ -1,19 +1,18 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { AutoBeAnalyzeScenarioEvent } from "@autobe/interface";
3
3
  import { AutoBeAnalyzeFile } from "@autobe/interface/src/histories/contents/AutoBeAnalyzeFile";
4
+ import { StringUtil } from "@autobe/utils";
4
5
  import { ILlmSchema } from "@samchon/openapi";
5
- import { v4 } from "uuid";
6
+ import { v7 } from "uuid";
6
7
 
7
8
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
8
9
  import { AutoBeContext } from "../../../context/AutoBeContext";
9
10
  import { transformAnalyzeWriteHistories } from "./transformAnalyzeWriteHistories";
10
11
 
11
- export const transformAnalyzeReviewerHistories = <
12
- Model extends ILlmSchema.Model,
13
- >(
12
+ export const transformAnalyzeReviewHistories = <Model extends ILlmSchema.Model>(
14
13
  ctx: AutoBeContext<Model>,
15
14
  scenario: AutoBeAnalyzeScenarioEvent,
16
- otherFiles: AutoBeAnalyzeFile[],
15
+ allFiles: AutoBeAnalyzeFile[],
17
16
  myFile: AutoBeAnalyzeFile,
18
17
  ): Array<
19
18
  | IAgenticaHistoryJson.IUserMessage
@@ -21,40 +20,34 @@ export const transformAnalyzeReviewerHistories = <
21
20
  | IAgenticaHistoryJson.ISystemMessage
22
21
  > => {
23
22
  return [
24
- ...transformAnalyzeWriteHistories(ctx, scenario, myFile),
23
+ ...transformAnalyzeWriteHistories(ctx, scenario, myFile).slice(0, -1),
25
24
  {
26
- id: v4(),
25
+ id: v7(),
27
26
  created_at: new Date().toISOString(),
28
- type: "assistantMessage",
29
- text: [
30
- "Here are the other documents written in other agents:",
31
- "",
32
- "```json",
33
- JSON.stringify(otherFiles),
34
- "```",
35
- "",
36
- "And here is the target document to review what you have written:",
37
- "",
38
- "```json",
39
- JSON.stringify(myFile),
40
- "```",
41
- ].join("\n"),
27
+ type: "systemMessage",
28
+ text: AutoBeSystemPromptConstant.ANALYZE_REVIEW,
42
29
  },
43
30
  {
44
- id: v4(),
31
+ id: v7(),
45
32
  created_at: new Date().toISOString(),
46
- type: "systemMessage",
47
- text: AutoBeSystemPromptConstant.ANALYZE_REVIEW,
33
+ type: "assistantMessage",
34
+ text: StringUtil.trim`
35
+ Here are the all documents written:
36
+
37
+ \`\`\`json
38
+ ${JSON.stringify(allFiles)}
39
+ \`\`\`
40
+ `,
48
41
  },
49
42
  {
50
- id: v4(),
43
+ id: v7(),
51
44
  created_at: new Date().toISOString(),
52
45
  type: "assistantMessage",
53
- text: [
54
- `Review the ${myFile.filename} document.`,
55
- "",
56
- "Note that, never review others.",
57
- ].join("\n"),
46
+ text: StringUtil.trim`
47
+ Review the ${myFile.filename} document.
48
+
49
+ Note that, never review others.
50
+ `,
58
51
  },
59
52
  ];
60
53
  };
@@ -1,6 +1,7 @@
1
1
  import { IMicroAgenticaHistoryJson } from "@agentica/core";
2
+ import { StringUtil } from "@autobe/utils";
2
3
  import { ILlmSchema } from "@samchon/openapi";
3
- import { v4 } from "uuid";
4
+ import { v7 } from "uuid";
4
5
 
5
6
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
6
7
  import { AutoBeContext } from "../../../context/AutoBeContext";
@@ -13,21 +14,23 @@ export function transformAnalyzeSceHistories<Model extends ILlmSchema.Model>(
13
14
  .histories()
14
15
  .filter((h) => h.type === "userMessage" || h.type === "assistantMessage"),
15
16
  {
16
- id: v4(),
17
+ id: v7(),
17
18
  type: "systemMessage",
18
19
  text: AutoBeSystemPromptConstant.ANALYZE_SCENARIO,
19
20
  created_at: new Date().toISOString(),
20
21
  },
21
22
  {
22
- id: v4(),
23
+ id: v7(),
23
24
  type: "systemMessage",
24
- text: [
25
- "One agent per page of the document you specify will write according to the instructions below.",
26
- "You should also refer to the content to define the document list.",
27
- "```",
28
- AutoBeSystemPromptConstant.ANALYZE_WRITE,
29
- "```",
30
- ].join("\n"),
25
+ text: StringUtil.trim`
26
+ > One agent per page of the document you specify will
27
+ > write according to the instructions below. You should also refer
28
+ > to the content to define the document list.
29
+
30
+ ----------------------
31
+
32
+ ${AutoBeSystemPromptConstant.ANALYZE_WRITE}
33
+ `,
31
34
  created_at: new Date().toISOString(),
32
35
  },
33
36
  ];
@@ -1,8 +1,9 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { AutoBeAnalyzeScenarioEvent } from "@autobe/interface";
3
3
  import { AutoBeAnalyzeFile } from "@autobe/interface/src/histories/contents/AutoBeAnalyzeFile";
4
+ import { StringUtil } from "@autobe/utils";
4
5
  import { ILlmSchema } from "@samchon/openapi";
5
- import { v4 } from "uuid";
6
+ import { v7 } from "uuid";
6
7
 
7
8
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
8
9
  import { AutoBeContext } from "../../../context/AutoBeContext";
@@ -15,64 +16,62 @@ export const transformAnalyzeWriteHistories = <Model extends ILlmSchema.Model>(
15
16
  | IAgenticaHistoryJson.IUserMessage
16
17
  | IAgenticaHistoryJson.IAssistantMessage
17
18
  | IAgenticaHistoryJson.ISystemMessage
18
- > => {
19
- return [
20
- ...ctx
21
- .histories()
22
- .filter((h) => h.type === "userMessage" || h.type === "assistantMessage")
23
- .map((h) => {
24
- const text =
25
- h.type === "userMessage"
26
- ? h.contents
27
- .filter((el) => el.type === "text")
28
- .map((el) => el.text)
29
- .join("\n")
30
- : h.text;
19
+ > => [
20
+ ...ctx
21
+ .histories()
22
+ .filter((h) => h.type === "userMessage" || h.type === "assistantMessage")
23
+ .map((h) => {
24
+ const text =
25
+ h.type === "userMessage"
26
+ ? h.contents
27
+ .filter((el) => el.type === "text")
28
+ .map((el) => el.text)
29
+ .join("\n")
30
+ : h.text;
31
+ return {
32
+ ...h,
33
+ text,
34
+ };
35
+ }),
36
+ {
37
+ id: v7(),
38
+ created_at: new Date().toISOString(),
39
+ type: "systemMessage",
40
+ text: AutoBeSystemPromptConstant.ANALYZE_WRITE,
41
+ },
42
+ {
43
+ id: v7(),
44
+ created_at: new Date().toISOString(),
45
+ type: "assistantMessage",
46
+ text: StringUtil.trim`
47
+ ## Language
48
+
49
+ The language of the document is ${JSON.stringify(scenario.language ?? "en-US")}.
50
+
51
+ ## Metadata
52
+
53
+ Prefix name of the service to create is ${scenario.prefix}
54
+ and here is the list of the roles to reference.
55
+
56
+ \`\`\`json
57
+ ${JSON.stringify(scenario.roles)}
58
+ \`\`\`
59
+
60
+ Here is the entire list of the documents that would be published
61
+ in someday, and your role is to writing a document of them:
62
+
63
+ ## The other documents that would be published in someday
31
64
 
32
- return {
33
- ...h,
34
- text,
35
- };
36
- }),
37
- {
38
- id: v4(),
39
- created_at: new Date().toISOString(),
40
- type: "systemMessage",
41
- text: AutoBeSystemPromptConstant.ANALYZE_WRITE,
42
- },
43
- {
44
- id: v4(),
45
- created_at: new Date().toISOString(),
46
- type: "assistantMessage",
47
- text: [
48
- "## Metadata",
49
- "",
50
- `Prefix name of the service to create is ${scenario.prefix},`,
51
- "and here is the list of the roles to reference:",
52
- "",
53
- "```json",
54
- JSON.stringify(scenario.roles),
55
- "```",
56
- "",
57
- "Here is the entire list of the documents that would be published",
58
- "in someday, and your role is to writing a document of them:",
59
- "",
60
- "## The other documents that would be published in someday",
61
- "```json",
62
- JSON.stringify(
63
- scenario.files.filter((f) => f.filename !== file.filename),
64
- ),
65
- "```",
66
- "",
67
- "## The document to write",
68
- "```json",
69
- JSON.stringify(file),
70
- "```",
71
- "",
72
- "## Language",
73
- "",
74
- `The language of the document is ${scenario.language ?? "en-US"}.`,
75
- ].join("\n"),
76
- },
77
- ];
78
- };
65
+ \`\`\`json
66
+ ${JSON.stringify(
67
+ scenario.files.filter((f) => f.filename !== file.filename),
68
+ )}
69
+ \`\`\`
70
+
71
+ ## The document to write
72
+ \`\`\`json
73
+ ${JSON.stringify(file)}
74
+ \`\`\`
75
+ `,
76
+ },
77
+ ];
@@ -8,9 +8,11 @@ import {
8
8
  } from "@autobe/interface";
9
9
  import { AutoBeAnalyzeFile } from "@autobe/interface/src/histories/contents/AutoBeAnalyzeFile";
10
10
  import { ILlmSchema } from "@samchon/openapi";
11
+ import { v7 } from "uuid";
11
12
 
12
13
  import { AutoBeContext } from "../../context/AutoBeContext";
13
14
  import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
15
+ import { executeCachedBatch } from "../../utils/executeCachedBatch";
14
16
  import { orchestrateAnalyzeReview } from "./orchestrateAnalyzeReview";
15
17
  import { orchestrateAnalyzeScenario } from "./orchestrateAnalyzeScenario";
16
18
  import { orchestrateAnalyzeWrite } from "./orchestrateAnalyzeWrite";
@@ -26,6 +28,7 @@ export const orchestrateAnalyze =
26
28
 
27
29
  ctx.dispatch({
28
30
  type: "analyzeStart",
31
+ id: v7(),
29
32
  reason: props.reason,
30
33
  step,
31
34
  created_at: startTime.toISOString(),
@@ -43,13 +46,16 @@ export const orchestrateAnalyze =
43
46
  total: scenario.files.length,
44
47
  completed: 0,
45
48
  };
46
- const fileList: AutoBeAnalyzeFile[] = await Promise.all(
47
- scenario.files.map(async (file) => {
49
+ const fileList: AutoBeAnalyzeFile[] = await executeCachedBatch(
50
+ scenario.files.map((file) => async (promptCacheKey) => {
48
51
  const event: AutoBeAnalyzeWriteEvent = await orchestrateAnalyzeWrite(
49
52
  ctx,
50
- scenario,
51
- file,
52
- writeProgress,
53
+ {
54
+ scenario,
55
+ file,
56
+ progress: writeProgress,
57
+ promptCacheKey,
58
+ },
53
59
  );
54
60
  return event.file;
55
61
  }),
@@ -60,17 +66,17 @@ export const orchestrateAnalyze =
60
66
  total: fileList.length,
61
67
  completed: 0,
62
68
  };
63
- const newFiles: AutoBeAnalyzeFile[] = await Promise.all(
64
- fileList.map(async (file, i) => {
69
+ const newFiles: AutoBeAnalyzeFile[] = await executeCachedBatch(
70
+ fileList.map((file) => async (promptCacheKey) => {
65
71
  try {
66
72
  const event: AutoBeAnalyzeReviewEvent =
67
- await orchestrateAnalyzeReview(
68
- ctx,
73
+ await orchestrateAnalyzeReview(ctx, {
69
74
  scenario,
70
- fileList.filter((_, j) => j !== i), // other files
71
- file,
72
- reviewProgress,
73
- );
75
+ allFiles: fileList, // all files
76
+ myFile: file,
77
+ progress: reviewProgress,
78
+ promptCacheKey,
79
+ });
74
80
  return {
75
81
  ...event.file,
76
82
  content: event.content,
@@ -84,6 +90,7 @@ export const orchestrateAnalyze =
84
90
  // Complete the analysis
85
91
  return ctx.dispatch({
86
92
  type: "analyzeComplete",
93
+ id: v7(),
87
94
  roles: scenario.roles,
88
95
  prefix: scenario.prefix,
89
96
  files: newFiles,
@@ -8,18 +8,22 @@ import { AutoBeAnalyzeFile } from "@autobe/interface/src/histories/contents/Auto
8
8
  import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
9
9
  import { IPointer } from "tstl";
10
10
  import typia from "typia";
11
+ import { v7 } from "uuid";
11
12
 
12
13
  import { AutoBeContext } from "../../context/AutoBeContext";
13
14
  import { assertSchemaModel } from "../../context/assertSchemaModel";
14
- import { transformAnalyzeReviewerHistories } from "./histories/transformAnalyzeReviewerHistories";
15
+ import { transformAnalyzeReviewHistories } from "./histories/transformAnalyzeReviewHistories";
15
16
  import { IAutoBeAnalyzeReviewApplication } from "./structures/IAutoBeAnalyzeReviewApplication";
16
17
 
17
18
  export const orchestrateAnalyzeReview = async <Model extends ILlmSchema.Model>(
18
19
  ctx: AutoBeContext<Model>,
19
- scenario: AutoBeAnalyzeScenarioEvent,
20
- otherFiles: AutoBeAnalyzeFile[],
21
- myFile: AutoBeAnalyzeFile,
22
- progress: AutoBeProgressEventBase,
20
+ props: {
21
+ scenario: AutoBeAnalyzeScenarioEvent;
22
+ allFiles: AutoBeAnalyzeFile[];
23
+ myFile: AutoBeAnalyzeFile;
24
+ progress: AutoBeProgressEventBase;
25
+ promptCacheKey: string;
26
+ },
23
27
  ): Promise<AutoBeAnalyzeReviewEvent> => {
24
28
  const pointer: IPointer<IAutoBeAnalyzeReviewApplication.IProps | null> = {
25
29
  value: null,
@@ -31,9 +35,15 @@ export const orchestrateAnalyzeReview = async <Model extends ILlmSchema.Model>(
31
35
  pointer,
32
36
  }),
33
37
  histories: [
34
- ...transformAnalyzeReviewerHistories(ctx, scenario, otherFiles, myFile),
38
+ ...transformAnalyzeReviewHistories(
39
+ ctx,
40
+ props.scenario,
41
+ props.allFiles,
42
+ props.myFile,
43
+ ),
35
44
  ],
36
45
  enforceFunctionCall: true,
46
+ promptCacheKey: props.promptCacheKey,
37
47
  message: "Review the requirement document",
38
48
  });
39
49
  if (pointer.value === null)
@@ -41,13 +51,14 @@ export const orchestrateAnalyzeReview = async <Model extends ILlmSchema.Model>(
41
51
 
42
52
  const event: AutoBeAnalyzeReviewEvent = {
43
53
  type: "analyzeReview",
44
- file: myFile,
54
+ id: v7(),
55
+ file: props.myFile,
45
56
  plan: pointer.value.plan,
46
57
  review: pointer.value.review,
47
58
  content: pointer.value.content,
48
59
  tokenUsage,
49
- total: progress.total,
50
- completed: ++progress.completed,
60
+ total: props.progress.total,
61
+ completed: ++props.progress.completed,
51
62
  step: (ctx.state().analyze?.step ?? -1) + 1,
52
63
  created_at: new Date().toISOString(),
53
64
  };
@@ -6,10 +6,11 @@ import {
6
6
  AutoBeAnalyzeScenarioEvent,
7
7
  AutoBeAssistantMessageHistory,
8
8
  } from "@autobe/interface";
9
+ import { StringUtil } from "@autobe/utils";
9
10
  import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
10
11
  import { IPointer } from "tstl";
11
12
  import typia from "typia";
12
- import { v4 } from "uuid";
13
+ import { v7 } from "uuid";
13
14
 
14
15
  import { AutoBeContext } from "../../context/AutoBeContext";
15
16
  import { assertSchemaModel } from "../../context/assertSchemaModel";
@@ -29,23 +30,23 @@ export const orchestrateAnalyzeScenario = async <
29
30
  source: "analyzeScenario",
30
31
  controller: createController<Model>({
31
32
  model: ctx.model,
32
- pointer,
33
+ build: (value) => (pointer.value = value),
33
34
  }),
34
35
  histories: transformAnalyzeSceHistories(ctx),
35
36
  enforceFunctionCall: false,
36
- message: [
37
- `Design a complete list of documents and user roles for this project.`,
38
- `Define user roles that can authenticate via API and create appropriate documentation files.`,
39
- `You must respect the number of documents specified by the user.`,
40
- `Note that the user's locale is in ${ctx.locale}.`,
41
- ].join("\n"),
37
+ message: StringUtil.trim`
38
+ Design a complete list of documents and user roles for this project.
39
+ Define user roles that can authenticate via API and create appropriate documentation files.
40
+ You must respect the number of documents specified by the user.
41
+ Note that the user's locale is in ${ctx.locale}.
42
+ `,
42
43
  });
43
44
  if (histories.at(-1)?.type === "assistantMessage")
44
45
  return {
45
46
  ...(histories.at(-1)! as AgenticaAssistantMessageHistory),
46
47
  created_at: start.toISOString(),
47
48
  completed_at: new Date().toISOString(),
48
- id: v4(),
49
+ id: v7(),
49
50
  } satisfies AutoBeAssistantMessageHistory;
50
51
  else if (pointer.value === null) {
51
52
  // unreachable
@@ -53,6 +54,7 @@ export const orchestrateAnalyzeScenario = async <
53
54
  }
54
55
  return {
55
56
  type: "analyzeScenario",
57
+ id: v7(),
56
58
  prefix: pointer.value.prefix,
57
59
  language: pointer.value.language,
58
60
  roles: pointer.value.roles,
@@ -65,7 +67,7 @@ export const orchestrateAnalyzeScenario = async <
65
67
 
66
68
  function createController<Model extends ILlmSchema.Model>(props: {
67
69
  model: Model;
68
- pointer: IPointer<IAutoBeAnalyzeScenarioApplication.IProps | null>;
70
+ build: (value: IAutoBeAnalyzeScenarioApplication.IProps) => void;
69
71
  }): IAgenticaController.IClass<Model> {
70
72
  assertSchemaModel(props.model);
71
73
  const application: ILlmApplication<Model> = collection[
@@ -77,7 +79,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
77
79
  application,
78
80
  execute: {
79
81
  compose: (input) => {
80
- props.pointer.value = input;
82
+ props.build(input);
81
83
  },
82
84
  } satisfies IAutoBeAnalyzeScenarioApplication,
83
85
  };
@@ -2,11 +2,13 @@ import { IAgenticaController } from "@agentica/core";
2
2
  import {
3
3
  AutoBeAnalyzeScenarioEvent,
4
4
  AutoBeAnalyzeWriteEvent,
5
+ AutoBeProgressEventBase,
5
6
  } from "@autobe/interface";
6
7
  import { AutoBeAnalyzeFile } from "@autobe/interface/src/histories/contents/AutoBeAnalyzeFile";
7
8
  import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
8
9
  import { IPointer } from "tstl";
9
10
  import typia from "typia";
11
+ import { v7 } from "uuid";
10
12
 
11
13
  import { AutoBeContext } from "../../context/AutoBeContext";
12
14
  import { assertSchemaModel } from "../../context/assertSchemaModel";
@@ -15,13 +17,14 @@ import { IAutoBeAnalyzeWriteApplication } from "./structures/IAutoBeAnalyzeWrite
15
17
 
16
18
  export const orchestrateAnalyzeWrite = async <Model extends ILlmSchema.Model>(
17
19
  ctx: AutoBeContext<Model>,
18
- scenario: AutoBeAnalyzeScenarioEvent,
19
- file: AutoBeAnalyzeFile.Scenario,
20
- progress: {
21
- total: number;
22
- completed: number;
20
+ props: {
21
+ scenario: AutoBeAnalyzeScenarioEvent;
22
+ file: AutoBeAnalyzeFile.Scenario;
23
+ progress: AutoBeProgressEventBase;
24
+ promptCacheKey: string;
23
25
  },
24
26
  ): Promise<AutoBeAnalyzeWriteEvent> => {
27
+ const { scenario, file, progress, promptCacheKey } = props;
25
28
  const pointer: IPointer<IAutoBeAnalyzeWriteApplication.IProps | null> = {
26
29
  value: null,
27
30
  };
@@ -33,6 +36,7 @@ export const orchestrateAnalyzeWrite = async <Model extends ILlmSchema.Model>(
33
36
  }),
34
37
  histories: transformAnalyzeWriteHistories(ctx, scenario, file),
35
38
  enforceFunctionCall: true,
39
+ promptCacheKey,
36
40
  message: "Write requirement analysis report.",
37
41
  });
38
42
  if (pointer.value === null) {
@@ -42,6 +46,7 @@ export const orchestrateAnalyzeWrite = async <Model extends ILlmSchema.Model>(
42
46
 
43
47
  const event: AutoBeAnalyzeWriteEvent = {
44
48
  type: "analyzeWrite",
49
+ id: v7(),
45
50
  file: {
46
51
  ...file,
47
52
  content: pointer.value.content,