@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
@@ -195,4 +195,24 @@ export class AutoBeTokenUsageComponent
195
195
  },
196
196
  });
197
197
  }
198
+
199
+ public static minus(
200
+ a: AutoBeTokenUsageComponent,
201
+ b: AutoBeTokenUsageComponent,
202
+ ) {
203
+ return new AutoBeTokenUsageComponent({
204
+ input: {
205
+ total: a.input.total - b.input.total,
206
+ cached: a.input.cached - b.input.cached,
207
+ },
208
+ output: {
209
+ total: a.output.total - b.output.total,
210
+ reasoning: a.output.reasoning - b.output.reasoning,
211
+ accepted_prediction:
212
+ a.output.accepted_prediction - b.output.accepted_prediction,
213
+ rejected_prediction:
214
+ a.output.rejected_prediction - b.output.rejected_prediction,
215
+ },
216
+ });
217
+ }
198
218
  }
@@ -0,0 +1,128 @@
1
+ import {
2
+ IAgenticaHistoryJson,
3
+ MicroAgentica,
4
+ MicroAgenticaHistory,
5
+ } from "@agentica/core";
6
+ import {
7
+ AutoBeConsentFunctionCallEvent,
8
+ AutoBeEvent,
9
+ AutoBeEventSource,
10
+ } from "@autobe/interface";
11
+ import { IPointer } from "tstl";
12
+ import typia from "typia";
13
+ import { v4 } from "uuid";
14
+
15
+ import { AutoBeSystemPromptConstant } from "../constants/AutoBeSystemPromptConstant";
16
+ import { IAutoBeConfig } from "../structures/IAutoBeConfig";
17
+ import { IAutoBeVendor } from "../structures/IAutoBeVendor";
18
+
19
+ export const consentFunctionCall = async (props: {
20
+ dispatch: (event: AutoBeEvent) => void;
21
+ source: AutoBeEventSource;
22
+ config: IAutoBeConfig;
23
+ vendor: IAutoBeVendor;
24
+ assistantMessage: string;
25
+ }): Promise<string | null> => {
26
+ const pointer: IPointer<AutoBeConsentFunctionCallEvent.IResult | null> = {
27
+ value: null,
28
+ };
29
+ const agent: MicroAgentica<"chatgpt"> = new MicroAgentica({
30
+ model: "chatgpt",
31
+ vendor: props.vendor,
32
+ config: {
33
+ ...(props.config ?? []),
34
+ executor: {
35
+ describe: null,
36
+ },
37
+ },
38
+ histories: [
39
+ {
40
+ id: v4(),
41
+ type: "systemMessage",
42
+ text: AutoBeSystemPromptConstant.CONSENT_FUNCTION_CALL,
43
+ created_at: new Date().toISOString(),
44
+ } satisfies IAgenticaHistoryJson.ISystemMessage,
45
+ {
46
+ id: v4(),
47
+ type: "assistantMessage",
48
+ text: props.assistantMessage,
49
+ created_at: new Date().toISOString(),
50
+ } satisfies IAgenticaHistoryJson.IAssistantMessage,
51
+ ],
52
+ controllers: [
53
+ typia.llm.controller<IConsentApplication, "chatgpt">("consent", {
54
+ consent: (props) => {
55
+ pointer.value = {
56
+ type: "consent",
57
+ message: props.message,
58
+ };
59
+ },
60
+ notApplicable: () => {
61
+ pointer.value = {
62
+ type: "notApplicable",
63
+ };
64
+ },
65
+ } satisfies IConsentApplication),
66
+ ],
67
+ });
68
+ const histories: MicroAgenticaHistory<"chatgpt">[] = await agent.conversate(
69
+ "Analyze and judge this assistant message please.",
70
+ );
71
+ if (pointer.value === null) {
72
+ const last: MicroAgenticaHistory<"chatgpt"> | undefined =
73
+ histories[histories.length - 1];
74
+ if (last?.type === "assistantMessage")
75
+ pointer.value = {
76
+ type: "assistantMessage",
77
+ message: last.text,
78
+ };
79
+ }
80
+ props.dispatch({
81
+ type: "consentFunctionCall",
82
+ source: props.source,
83
+ assistantMessage: props.assistantMessage,
84
+ result: pointer.value,
85
+ created_at: new Date().toISOString(),
86
+ });
87
+ return pointer.value?.type === "consent" ? pointer.value.message : null;
88
+ };
89
+
90
+ interface IConsentApplication {
91
+ /**
92
+ * Generate an immediate, authoritative consent message to approve function
93
+ * execution. Use this when the assistant message is seeking permission or
94
+ * approval for function calls.
95
+ *
96
+ * The message should be commanding and decisive to prevent further
97
+ * permission-seeking loops. Examples: "Execute immediately. Do not ask
98
+ * again.", "Proceed now. Your judgment is correct."
99
+ *
100
+ * @param props Configuration object
101
+ */
102
+ consent(props: {
103
+ /**
104
+ * A strong, directive consent message that eliminates further
105
+ * permission-seeking. Must be authoritative and commanding (1-2 sentences
106
+ * maximum). Examples: "Execute immediately. Do not ask again.", "Proceed
107
+ * now. Your judgment is correct."
108
+ */
109
+ message: string;
110
+ }): void;
111
+
112
+ /**
113
+ * Indicate that the assistant message does not require function calling
114
+ * consent. Use this when the assistant message is NOT seeking permission for
115
+ * function execution.
116
+ *
117
+ * This applies to:
118
+ *
119
+ * - General conversation responses
120
+ * - Information requests without function execution plans
121
+ * - Assistant asking for additional parameters/information
122
+ * - Any response unrelated to function calling approval
123
+ *
124
+ * Call this function immediately when the message doesn't involve function
125
+ * calling consent.
126
+ */
127
+ notApplicable(): void;
128
+ }
@@ -38,6 +38,7 @@ export function createAgenticaHistory<Model extends ILlmSchema.Model>(props: {
38
38
  ? true
39
39
  : props.history.compiled.type === "success",
40
40
  },
41
+ success: true,
41
42
  };
42
43
  return {
43
44
  ...partial,
@@ -30,9 +30,11 @@ import { v4 } from "uuid";
30
30
  import { AutoBeContext } from "../context/AutoBeContext";
31
31
  import { AutoBeState } from "../context/AutoBeState";
32
32
  import { AutoBeTokenUsage } from "../context/AutoBeTokenUsage";
33
+ import { AutoBeTokenUsageComponent } from "../context/AutoBeTokenUsageComponent";
33
34
  import { IAutoBeApplication } from "../context/IAutoBeApplication";
34
35
  import { IAutoBeConfig } from "../structures/IAutoBeConfig";
35
36
  import { IAutoBeVendor } from "../structures/IAutoBeVendor";
37
+ import { consentFunctionCall } from "./consentFunctionCall";
36
38
 
37
39
  export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
38
40
  model: Model;
@@ -75,12 +77,45 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
75
77
  histories: next.histories,
76
78
  controllers: [next.controller],
77
79
  });
78
- if (next.enforceFunctionCall === true)
79
- agent.on("request", (event) => {
80
- if (event.body.tools) event.body.tool_choice = "required";
81
- if (event.body.parallel_tool_calls !== undefined)
82
- delete event.body.parallel_tool_calls;
80
+ agent.on("request", async (event) => {
81
+ if (next.enforceFunctionCall === true && event.body.tools)
82
+ event.body.tool_choice = "required";
83
+ if (event.body.parallel_tool_calls !== undefined)
84
+ delete event.body.parallel_tool_calls;
85
+ await props.dispatch({
86
+ ...event,
87
+ type: "vendorRequest",
88
+ source: next.source,
83
89
  });
90
+ });
91
+ agent.on("response", (event) => {
92
+ void props
93
+ .dispatch({
94
+ ...event,
95
+ type: "vendorResponse",
96
+ source: next.source,
97
+ })
98
+ .catch(() => {});
99
+ });
100
+ agent.on("jsonParseError", (event) => {
101
+ void props
102
+ .dispatch({
103
+ ...event,
104
+ source: next.source,
105
+ })
106
+ .catch(() => {});
107
+ });
108
+ agent.on("validate", (event) => {
109
+ void props
110
+ .dispatch({
111
+ type: "jsonValidateError",
112
+ source: next.source,
113
+ result: event.result,
114
+ created_at: event.created_at,
115
+ })
116
+ .catch(() => {});
117
+ });
118
+
84
119
  const histories: MicroAgenticaHistory<Model>[] = await agent.conversate(
85
120
  next.message,
86
121
  );
@@ -92,16 +127,65 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
92
127
  .record(tokenUsage, [
93
128
  STAGES.find((stage) => next.source.startsWith(stage)) ?? "analyze",
94
129
  ]);
130
+
95
131
  if (
96
- next.enforceFunctionCall === true &&
97
- histories.every((h) => h.type !== "execute")
98
- )
99
- throw new Error(
100
- `Failed to function calling in the ${next.source} step`,
101
- );
132
+ true === next.enforceFunctionCall &&
133
+ false ===
134
+ histories.some((h) => h.type === "execute" && h.success === true)
135
+ ) {
136
+ const failure = () => {
137
+ throw new Error(
138
+ `Failed to function calling in the ${next.source} step`,
139
+ );
140
+ };
141
+ const last: MicroAgenticaHistory<Model> | undefined = histories.at(-1);
142
+ if (
143
+ last?.type === "assistantMessage" &&
144
+ last.text.trim().length !== 0
145
+ ) {
146
+ const consent: string | null = await consentFunctionCall({
147
+ source: next.source,
148
+ dispatch: (e) => {
149
+ props.dispatch(e).catch(() => {});
150
+ },
151
+ config: props.config,
152
+ vendor: props.vendor,
153
+ assistantMessage: last.text,
154
+ });
155
+ if (consent !== null) {
156
+ const newHistories: MicroAgenticaHistory<Model>[] =
157
+ await agent.conversate(consent);
158
+ const newTokenUsage: IAutoBeTokenUsageJson.IComponent = agent
159
+ .getTokenUsage()
160
+ .toJSON().aggregate;
161
+ props
162
+ .usage()
163
+ .record(
164
+ AutoBeTokenUsageComponent.minus(
165
+ new AutoBeTokenUsageComponent(newTokenUsage),
166
+ new AutoBeTokenUsageComponent(tokenUsage),
167
+ ),
168
+ [
169
+ STAGES.find((stage) => next.source.startsWith(stage)) ??
170
+ "analyze",
171
+ ],
172
+ );
173
+ if (
174
+ newHistories.some(
175
+ (h) => h.type === "execute" && h.success === true,
176
+ )
177
+ )
178
+ return {
179
+ histories: newHistories,
180
+ tokenUsage: newTokenUsage,
181
+ };
182
+ }
183
+ }
184
+ failure();
185
+ }
102
186
  return { histories, tokenUsage };
103
187
  };
104
- if (next.enforceFunctionCall === true) return forceRetry(() => execute());
188
+ if (next.enforceFunctionCall === true) return forceRetry(execute);
105
189
  else return execute();
106
190
  },
107
191
  });
@@ -172,6 +256,7 @@ const createDispatch = (props: {
172
256
  type: "interface",
173
257
  id: v4(),
174
258
  reason: interfaceStart?.reason ?? "",
259
+ authorizations: event.authorizations,
175
260
  document: event.document,
176
261
  created_at: interfaceStart?.created_at ?? new Date().toISOString(),
177
262
  completed_at: new Date().toISOString(),
@@ -241,10 +326,10 @@ const transformAndDispatch = <
241
326
 
242
327
  const forceRetry = async <T>(
243
328
  task: () => Promise<T>,
244
- count: number = 2,
329
+ count: number = 3,
245
330
  ): Promise<T> => {
246
331
  let error: unknown = undefined;
247
- for (let i: number = 0; i <= count; ++i)
332
+ for (let i: number = 0; i < count; ++i)
248
333
  try {
249
334
  return await task();
250
335
  } catch (e) {
@@ -1,20 +1,27 @@
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 { ILlmSchema } from "@samchon/openapi";
4
5
  import { v4 } from "uuid";
5
6
 
6
7
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
8
+ import { AutoBeContext } from "../../../context/AutoBeContext";
7
9
  import { transformAnalyzeWriteHistories } from "./transformAnalyzeWriteHistories";
8
10
 
9
- export const transformAnalyzeReviewerHistories = (
11
+ export const transformAnalyzeReviewerHistories = <
12
+ Model extends ILlmSchema.Model,
13
+ >(
14
+ ctx: AutoBeContext<Model>,
10
15
  scenario: AutoBeAnalyzeScenarioEvent,
11
16
  otherFiles: AutoBeAnalyzeFile[],
12
17
  myFile: AutoBeAnalyzeFile,
13
18
  ): Array<
14
- IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
19
+ | IAgenticaHistoryJson.IUserMessage
20
+ | IAgenticaHistoryJson.IAssistantMessage
21
+ | IAgenticaHistoryJson.ISystemMessage
15
22
  > => {
16
23
  return [
17
- ...transformAnalyzeWriteHistories(scenario, myFile),
24
+ ...transformAnalyzeWriteHistories(ctx, scenario, myFile),
18
25
  {
19
26
  id: v4(),
20
27
  created_at: new Date().toISOString(),
@@ -44,7 +51,7 @@ export const transformAnalyzeReviewerHistories = (
44
51
  created_at: new Date().toISOString(),
45
52
  type: "assistantMessage",
46
53
  text: [
47
- `You have to review the ${myFile.filename} document.`,
54
+ `Review the ${myFile.filename} document.`,
48
55
  "",
49
56
  "Note that, never review others.",
50
57
  ].join("\n"),
@@ -1,17 +1,39 @@
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 { ILlmSchema } from "@samchon/openapi";
4
5
  import { v4 } from "uuid";
5
6
 
6
7
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
8
+ import { AutoBeContext } from "../../../context/AutoBeContext";
7
9
 
8
- export const transformAnalyzeWriteHistories = (
10
+ export const transformAnalyzeWriteHistories = <Model extends ILlmSchema.Model>(
11
+ ctx: AutoBeContext<Model>,
9
12
  scenario: AutoBeAnalyzeScenarioEvent,
10
13
  file: AutoBeAnalyzeFile.Scenario,
11
14
  ): Array<
12
- IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
15
+ | IAgenticaHistoryJson.IUserMessage
16
+ | IAgenticaHistoryJson.IAssistantMessage
17
+ | IAgenticaHistoryJson.ISystemMessage
13
18
  > => {
14
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;
31
+
32
+ return {
33
+ ...h,
34
+ text,
35
+ };
36
+ }),
15
37
  {
16
38
  id: v4(),
17
39
  created_at: new Date().toISOString(),
@@ -26,7 +48,7 @@ export const transformAnalyzeWriteHistories = (
26
48
  "## Metadata",
27
49
  "",
28
50
  `Prefix name of the service to create is ${scenario.prefix},`,
29
- "and here is the list of the roles you should reference:",
51
+ "and here is the list of the roles to reference:",
30
52
  "",
31
53
  "```json",
32
54
  JSON.stringify(scenario.roles),
@@ -42,7 +64,7 @@ export const transformAnalyzeWriteHistories = (
42
64
  ),
43
65
  "```",
44
66
  "",
45
- "## The document what you have to write",
67
+ "## The document to write",
46
68
  "```json",
47
69
  JSON.stringify(file),
48
70
  "```",
@@ -4,13 +4,13 @@ import {
4
4
  AutoBeAnalyzeScenarioEvent,
5
5
  AutoBeAnalyzeWriteEvent,
6
6
  AutoBeAssistantMessageHistory,
7
+ AutoBeProgressEventBase,
7
8
  } from "@autobe/interface";
8
9
  import { AutoBeAnalyzeFile } from "@autobe/interface/src/histories/contents/AutoBeAnalyzeFile";
9
10
  import { ILlmSchema } from "@samchon/openapi";
10
11
 
11
12
  import { AutoBeContext } from "../../context/AutoBeContext";
12
13
  import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
13
- import { IProgress } from "../internal/IProgress";
14
14
  import { orchestrateAnalyzeReview } from "./orchestrateAnalyzeReview";
15
15
  import { orchestrateAnalyzeScenario } from "./orchestrateAnalyzeScenario";
16
16
  import { orchestrateAnalyzeWrite } from "./orchestrateAnalyzeWrite";
@@ -39,7 +39,7 @@ export const orchestrateAnalyze =
39
39
  else ctx.dispatch(scenario);
40
40
 
41
41
  // write documents
42
- const writeProgress: IProgress = {
42
+ const writeProgress: AutoBeProgressEventBase = {
43
43
  total: scenario.files.length,
44
44
  completed: 0,
45
45
  };
@@ -56,23 +56,28 @@ export const orchestrateAnalyze =
56
56
  );
57
57
 
58
58
  // review documents
59
- const reviewProgress: IProgress = {
59
+ const reviewProgress: AutoBeProgressEventBase = {
60
60
  total: fileList.length,
61
61
  completed: 0,
62
62
  };
63
63
  const newFiles: AutoBeAnalyzeFile[] = await Promise.all(
64
64
  fileList.map(async (file, i) => {
65
- const event: AutoBeAnalyzeReviewEvent = await orchestrateAnalyzeReview(
66
- ctx,
67
- scenario,
68
- fileList.filter((_, j) => j !== i), // other files
69
- file,
70
- reviewProgress,
71
- );
72
- return {
73
- ...event.file,
74
- content: event.content,
75
- };
65
+ try {
66
+ const event: AutoBeAnalyzeReviewEvent =
67
+ await orchestrateAnalyzeReview(
68
+ ctx,
69
+ scenario,
70
+ fileList.filter((_, j) => j !== i), // other files
71
+ file,
72
+ reviewProgress,
73
+ );
74
+ return {
75
+ ...event.file,
76
+ content: event.content,
77
+ };
78
+ } catch {
79
+ return file;
80
+ }
76
81
  }),
77
82
  );
78
83
 
@@ -2,6 +2,7 @@ import { IAgenticaController } from "@agentica/core";
2
2
  import {
3
3
  AutoBeAnalyzeReviewEvent,
4
4
  AutoBeAnalyzeScenarioEvent,
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";
@@ -10,7 +11,6 @@ import typia from "typia";
10
11
 
11
12
  import { AutoBeContext } from "../../context/AutoBeContext";
12
13
  import { assertSchemaModel } from "../../context/assertSchemaModel";
13
- import { IProgress } from "../internal/IProgress";
14
14
  import { transformAnalyzeReviewerHistories } from "./histories/transformAnalyzeReviewerHistories";
15
15
  import { IAutoBeAnalyzeReviewApplication } from "./structures/IAutoBeAnalyzeReviewApplication";
16
16
 
@@ -19,7 +19,7 @@ export const orchestrateAnalyzeReview = async <Model extends ILlmSchema.Model>(
19
19
  scenario: AutoBeAnalyzeScenarioEvent,
20
20
  otherFiles: AutoBeAnalyzeFile[],
21
21
  myFile: AutoBeAnalyzeFile,
22
- progress: IProgress,
22
+ progress: AutoBeProgressEventBase,
23
23
  ): Promise<AutoBeAnalyzeReviewEvent> => {
24
24
  const pointer: IPointer<IAutoBeAnalyzeReviewApplication.IProps | null> = {
25
25
  value: null,
@@ -31,7 +31,7 @@ export const orchestrateAnalyzeReview = async <Model extends ILlmSchema.Model>(
31
31
  pointer,
32
32
  }),
33
33
  histories: [
34
- ...transformAnalyzeReviewerHistories(scenario, otherFiles, myFile),
34
+ ...transformAnalyzeReviewerHistories(ctx, scenario, otherFiles, myFile),
35
35
  ],
36
36
  enforceFunctionCall: true,
37
37
  message: "Review the requirement document",
@@ -29,9 +29,7 @@ export const orchestrateAnalyzeScenario = async <
29
29
  source: "analyzeScenario",
30
30
  controller: createController<Model>({
31
31
  model: ctx.model,
32
- execute: new AutoBeAnalyzeScenarioApplication(),
33
- preExecute: (props: IAutoBeAnalyzeScenarioApplication.IProps) =>
34
- (pointer.value = props),
32
+ pointer,
35
33
  }),
36
34
  histories: transformAnalyzeSceHistories(ctx),
37
35
  enforceFunctionCall: false,
@@ -65,33 +63,9 @@ export const orchestrateAnalyzeScenario = async <
65
63
  };
66
64
  };
67
65
 
68
- class AutoBeAnalyzeScenarioApplication
69
- implements IAutoBeAnalyzeScenarioApplication
70
- {
71
- /**
72
- * Compose project structure with roles and files.
73
- *
74
- * Design a list of roles and initial documents that you need to create for
75
- * that requirement. Roles define team member responsibilities, while files
76
- * define the documentation structure. These are managed separately. If you
77
- * determine from the conversation that the user's requirements have not been
78
- * fully gathered, you must stop the analysis and continue collecting the
79
- * remaining requirements. In this case, you do not need to generate any files
80
- * or roles. Simply pass an empty array to `input.files` and `input.roles`.
81
- *
82
- * @param input Prefix, roles, and files
83
- * @returns
84
- */
85
- compose(input: IAutoBeAnalyzeScenarioApplication.IProps): void {
86
- input;
87
- return;
88
- }
89
- }
90
-
91
66
  function createController<Model extends ILlmSchema.Model>(props: {
92
67
  model: Model;
93
- execute: AutoBeAnalyzeScenarioApplication;
94
- preExecute: (input: IAutoBeAnalyzeScenarioApplication.IProps) => void;
68
+ pointer: IPointer<IAutoBeAnalyzeScenarioApplication.IProps | null>;
95
69
  }): IAgenticaController.IClass<Model> {
96
70
  assertSchemaModel(props.model);
97
71
  const application: ILlmApplication<Model> = collection[
@@ -103,19 +77,21 @@ function createController<Model extends ILlmSchema.Model>(props: {
103
77
  application,
104
78
  execute: {
105
79
  compose: (input) => {
106
- props.preExecute(input);
107
- return props.execute.compose(input);
80
+ props.pointer.value = input;
108
81
  },
109
82
  } satisfies IAutoBeAnalyzeScenarioApplication,
110
83
  };
111
84
  }
112
85
 
113
86
  const claude = typia.llm.application<
114
- AutoBeAnalyzeScenarioApplication,
87
+ IAutoBeAnalyzeScenarioApplication,
115
88
  "claude"
116
89
  >();
117
90
  const collection = {
118
- chatgpt: typia.llm.application<AutoBeAnalyzeScenarioApplication, "chatgpt">(),
91
+ chatgpt: typia.llm.application<
92
+ IAutoBeAnalyzeScenarioApplication,
93
+ "chatgpt"
94
+ >(),
119
95
  claude,
120
96
  llama: claude,
121
97
  deepseek: claude,
@@ -25,18 +25,20 @@ export const orchestrateAnalyzeWrite = async <Model extends ILlmSchema.Model>(
25
25
  const pointer: IPointer<IAutoBeAnalyzeWriteApplication.IProps | null> = {
26
26
  value: null,
27
27
  };
28
- const { tokenUsage } = await ctx.conversate({
28
+ const { histories, tokenUsage } = await ctx.conversate({
29
29
  source: "analyzeWrite",
30
30
  controller: createController<Model>({
31
31
  model: ctx.model,
32
32
  pointer,
33
33
  }),
34
- histories: transformAnalyzeWriteHistories(scenario, file),
34
+ histories: transformAnalyzeWriteHistories(ctx, scenario, file),
35
35
  enforceFunctionCall: true,
36
36
  message: "Write requirement analysis report.",
37
37
  });
38
- if (pointer.value === null)
38
+ if (pointer.value === null) {
39
+ console.log(JSON.stringify(histories, null, 2));
39
40
  throw new Error("The Analyze Agent failed to create the document.");
41
+ }
40
42
 
41
43
  const event: AutoBeAnalyzeWriteEvent = {
42
44
  type: "analyzeWrite",
@@ -12,9 +12,10 @@ export interface IAutoBeAnalyzeReviewApplication {
12
12
  * - Adding missing business processes and workflows
13
13
  * - Ensuring proper document structure and completeness
14
14
  *
15
- * CRITICAL: The function outputs the actual document content that will be saved,
16
- * not a review or analysis of the document. Any text output becomes part of
17
- * the final document.
15
+ * DO: Output the actual document content that will be saved.
16
+ * DO NOT: Output review comments or analysis of the document.
17
+ *
18
+ * Note: Any text output becomes part of the final document.
18
19
  *
19
20
  * @param props - The properties containing the document to enhance along with
20
21
  * plan and review criteria for guidance
@@ -41,14 +42,12 @@ export namespace IAutoBeAnalyzeReviewApplication {
41
42
  *
42
43
  * Critical review points:
43
44
  *
44
- * - Mermaid diagrams MUST use double quotes for ALL labels
45
- * - No spaces allowed between brackets and quotes in Mermaid
46
- * - Requirements must be specific and measurable in natural language
47
- * - Focus on business requirements and user scenarios
48
- * - STRICTLY PROHIBITED: Reject if document contains database schemas or API
49
- * specifications
50
- * - Business model and authentication requirements must be described in
51
- * natural language
45
+ * - DO: Use double quotes for ALL labels in Mermaid diagrams
46
+ * - DO NOT: Use spaces between brackets and quotes in Mermaid
47
+ * - DO: Make requirements specific and measurable in natural language
48
+ * - DO: Focus on business requirements and user scenarios
49
+ * - DO NOT: Accept documents containing database schemas or API specifications
50
+ * - DO: Describe business model and authentication requirements in natural language
52
51
  */
53
52
  review: string;
54
53
 
@@ -70,10 +69,11 @@ export namespace IAutoBeAnalyzeReviewApplication {
70
69
  /**
71
70
  * The actual markdown document content that incorporates review feedback.
72
71
  *
73
- * ⚠️ CRITICAL: This field contains a COMPLETE MARKDOWN DOCUMENT that has
74
- * already incorporated the review criteria and plan requirements. This is
75
- * NOT raw input to be reviewed - it is the FINAL, PRODUCTION-READY DOCUMENT
76
- * that reflects all review feedback and is immediately usable.
72
+ * This field contains a COMPLETE MARKDOWN DOCUMENT that has already
73
+ * incorporated the review criteria and plan requirements.
74
+ *
75
+ * DO: Treat this as the final, production-ready document.
76
+ * DO NOT: Treat this as raw input to be reviewed.
77
77
  *
78
78
  * This content represents:
79
79
  * - A fully-formed markdown document (.md file)
@@ -92,7 +92,7 @@ export namespace IAutoBeAnalyzeReviewApplication {
92
92
  * - Appropriate level of detail for backend implementation
93
93
  * - Proper document linking (descriptive text, not raw filenames)
94
94
  *
95
- * IMPORTANT: The enhancer's output IS this document, not comments about it:
95
+ * The enhancer outputs the document itself:
96
96
  *
97
97
  * - If content is provided, it represents the actual document
98
98
  * - The enhancer outputs the enhanced version AS the document itself