@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
@@ -1,358 +0,0 @@
1
- import { AutoBeOpenApi } from "@autobe/interface";
2
-
3
- import { FAILED } from "./IAutoBeRealizeFailedSymbol";
4
-
5
- export interface IAutoBeRealizeCoderApplication {
6
- programming: (input: IAutoBeRealizeCoderApplication.IProps) => void;
7
- }
8
-
9
- export namespace IAutoBeRealizeCoderApplication {
10
- /**
11
- * Properties for the component or function that consumes the output of the
12
- * code generation pipeline.
13
- */
14
- export interface IProps {
15
- /**
16
- * The detailed output of the code generation process, containing all phases
17
- * from planning to final implementation of a TypeScript provider function.
18
- */
19
- output: Omit<IAutoBeRealizeCoderApplication.RealizeCoderOutput, "filename">;
20
- }
21
-
22
- /**
23
- * Represents the complete output of a code generation pipeline. Each field
24
- * corresponds to a stage in the Chain of Thought (CoT) process for generating
25
- * a production-quality TypeScript function.
26
- *
27
- * All fields contain TypeScript code strings and follow these rules:
28
- *
29
- * - All code must be valid TypeScript or structurally valid even if incomplete.
30
- * - Each phase builds upon the previous one and must resolve specific concerns.
31
- * - All phases must follow system conventions around structure, typing, and
32
- * logic.
33
- */
34
- export interface RealizeCoderOutput {
35
- /** @ignore */
36
- filename: string;
37
-
38
- /**
39
- * Error Analysis Phase (Optional)
40
- *
41
- * 🔍 Analyzes TypeScript compilation errors from previous attempts.
42
- *
43
- * This field should contain a detailed analysis of any TypeScript errors
44
- * encountered, with root cause identification and resolution strategies:
45
- *
46
- * Common Error Patterns to Analyze:
47
- *
48
- * 1. **"Property does not exist" (TS2353)**:
49
- *
50
- * - Root Cause: Using fields that don't exist in Prisma schema
51
- * - Example: Using `deleted_at` when the field doesn't exist in the model
52
- * - Resolution: Remove the non-existent field or use hard delete instead
53
- * 2. **"Type 'void' is not assignable" (TS2322)**:
54
- *
55
- * - Root Cause: Using `typia.assertGuard` instead of `typia.assert`
56
- * - `assertGuard` returns void, `assert` returns the validated value
57
- * - Resolution: Change `typia.assertGuard<T>()` to `typia.assert<T>()`
58
- * 3. **"Type 'Date' is not assignable to type 'string &
59
- * Format<'date-time'>'"**:
60
- *
61
- * - Root Cause: Assigning native Date objects to string fields
62
- * - Resolution: Use `toISOStringSafe(dateValue)` for all date conversions
63
- * 4. **Complex Prisma Type Errors**:
64
- *
65
- * - Root Cause: Nested operations with incompatible types
66
- * - Resolution: Use separate queries and application-level joins
67
- *
68
- * Analysis Format:
69
- *
70
- * - List each error with its TypeScript error code
71
- * - Identify the root cause (schema mismatch, wrong function usage, etc.)
72
- * - Provide specific resolution steps
73
- * - Note any schema limitations discovered
74
- */
75
- errorAnalysis?: string;
76
-
77
- /**
78
- * Step 1.
79
- *
80
- * 🧠 Provider Function Implementation Plan
81
- *
82
- * This field outlines the strategic plan for implementing the provider
83
- * function according to the Realize Coder Agent specification. Before
84
- * writing the actual code, think through the logic and structure.
85
- *
86
- * The plan MUST follow MANDATORY SCHEMA-FIRST APPROACH:
87
- *
88
- * 📋 STEP 1 - PRISMA SCHEMA VERIFICATION (MOST CRITICAL):
89
- *
90
- * - EXAMINE the actual Prisma schema model definition
91
- * - LIST EVERY field that exists in the model with exact types
92
- * - EXPLICITLY NOTE fields that DO NOT exist (e.g., "Note: deleted_at field
93
- * DOES NOT EXIST")
94
- * - Common assumption errors to avoid: `deleted_at`, `created_by`,
95
- * `updated_by`, `is_deleted`, `is_active`
96
- *
97
- * 📋 STEP 2 - FIELD INVENTORY:
98
- *
99
- * - List ONLY fields confirmed to exist in schema
100
- * - Example: "Verified fields in user model: id (String), email (String),
101
- * created_at (DateTime), updated_at (DateTime)"
102
- * - Example: "Fields that DO NOT exist: deleted_at, is_active, created_by"
103
- *
104
- * 📋 STEP 3 - FIELD ACCESS STRATEGY:
105
- *
106
- * - Plan which verified fields will be used in select, update, create
107
- * operations
108
- * - For complex operations with type errors, plan to use separate queries
109
- * instead of nested operations
110
- *
111
- * 📋 STEP 4 - TYPE COMPATIBILITY:
112
- *
113
- * - Plan DateTime to ISO string conversions using toISOStringSafe()
114
- * - Plan handling of nullable vs required fields
115
- *
116
- * 📋 STEP 5 - IMPLEMENTATION APPROACH:
117
- *
118
- * - 🧩 Required business entities (e.g., users, posts, logs) and their
119
- * relationships
120
- * - 🛠 Operations needed to fulfill the business scenario (e.g., fetch,
121
- * create, update) using ONLY verified fields
122
- * - 🔄 Data dependencies between steps (e.g., use userId to fetch related
123
- * data)
124
- * - ✅ Validation points (based on business rules, not field presence)
125
- * - 🚧 Error and edge cases that must be handled explicitly (e.g., missing
126
- * records)
127
- * - 🏗 Structure: always a single `async function`, using only `parameters`
128
- * and `body`
129
- *
130
- * ⚠️ Important Constraints:
131
- *
132
- * - Do NOT perform input validation — assume `parameters` and `body` are
133
- * already valid
134
- * - Use `typia.random<T>()` with an explanatory comment if logic can't be
135
- * implemented
136
- * - Never use `any` or make assumptions without sufficient context
137
- * - Use only allowed imports — DTOs and Prisma types
138
- * - Use `MyGlobal.prisma` for DB access and respect Prisma typing rules
139
- *
140
- * ⚠️ TypeScript-specific considerations:
141
- *
142
- * - Do **not** use native `Date` objects directly; always convert all dates
143
- * using `toISOStringSafe()` and brand as `string &
144
- * tags.Format<'date-time'>`. This rule applies throughout all phases.
145
- * - Prefer `satisfies` for DTO conformance instead of unsafe `as` casts
146
- * - Avoid weak typing such as `any`, `as any`, or `satisfies any`
147
- * - Use branded types (e.g., `tags.Format<'uuid'>`) and literal unions where
148
- * applicable
149
- *
150
- * ✅ Example Structure:
151
- *
152
- * ```ts
153
- * export async function doSomething(
154
- * user: { id: string & tags.Format<"uuid">; type: string },
155
- * parameters: IParams,
156
- * body: IBody
157
- * ): Promise<IReturn> {
158
- * const { id } = parameters;
159
- * const { name } = body;
160
- * const user = await MyGlobal.prisma.users.findFirst({ where: { id } });
161
- * if (!user) throw new Error("User not found");
162
- * ...
163
- * return result;
164
- * }
165
- * ```
166
- *
167
- * 🔍 Feasibility Analysis Requirement:
168
- *
169
- * - Before generating any code, the agent **must analyze** whether the
170
- * requested implementation is **feasible based on the given Prisma schema
171
- * and DTO types**.
172
- * - If required fields or relationships are **missing or incompatible**, the
173
- * plan should explicitly state that the implementation is **not
174
- * possible** with the current schema/DTO, and no code should be generated
175
- * in later stages.
176
- * - In such cases, only a detailed **comment in the `implementationCode`**
177
- * should be returned explaining why the logic cannot be implemented.
178
- *
179
- * 🔥 Error Handling Plan:
180
- *
181
- * If an error is expected or encountered during implementation:
182
- *
183
- * - Clearly document the error message(s) and TypeScript error codes.
184
- * - Analyze the root cause (e.g., type mismatch, missing field, nullability
185
- * issue).
186
- * - Define concrete steps to resolve the issue, such as:
187
- *
188
- * - Adjusting type declarations or using Prisma-generated input types.
189
- * - Using `?? undefined` to normalize nullable fields.
190
- * - Applying correct relation handling (e.g., `connect` instead of direct
191
- * foreign key assignment).
192
- * - Ensuring all date fields use `.toISOString()` and proper branding.
193
- * - Include fallback or workaround plans if a direct fix is complex.
194
- * - If no error is present, simply omit this section.
195
- *
196
- * This plan ensures the function will:
197
- *
198
- * - Respect the global architecture and coding conventions
199
- * - Be safe, predictable, and aligned with upstream logic
200
- */
201
- plan: string;
202
-
203
- /**
204
- * Step 2.
205
- *
206
- * The Prisma schema string that will be used to validate the implementation
207
- * logic in this file.
208
- *
209
- * You must **explicitly specify only the relevant models and fields** from
210
- * your full schema that are used in this implementation. This ensures that
211
- * your logic is aligned with the expected database structure without
212
- * accidentally introducing unrelated fields or models.
213
- *
214
- * ⚠️ Important: The value of this field must be a valid Prisma schema
215
- * string containing only the models used in this code — not the entire
216
- * schema.
217
- *
218
- * This acts as a safeguard against:
219
- *
220
- * - Forgetting required fields used in this implementation
221
- * - Including fields or models that are not actually used
222
- */
223
- prisma_schemas: string;
224
-
225
- /**
226
- * Step 3.
227
- *
228
- * Draft WITHOUT using native Date type.
229
- *
230
- * This is the initial drafting phase where you outline the basic skeleton
231
- * of the function. CRITICAL: This draft must NEVER use the native Date
232
- * type.
233
- *
234
- * - The function signature must correctly include `user`, `parameters`, and
235
- * `body` arguments.
236
- * - Design the main flow of business logic, such as DB fetches and early
237
- * returns based on conditions.
238
- * - Mark any incomplete or missing parts clearly with placeholders (e.g.,
239
- * comments or temporary values).
240
- *
241
- * ⚠️ Import rules:
242
- *
243
- * - Do NOT add any new import statements manually.
244
- * - All necessary imports are provided globally or by the system
245
- * automatically.
246
- * - Writing import statements directly is prohibited and may cause compile
247
- * errors. If import errors occur, check your environment configuration.
248
- *
249
- * ✅ Requirements:
250
- *
251
- * - Avoid using the `any` type at all costs to ensure type safety.
252
- * - NEVER declare variables with `: Date` type
253
- * - ALWAYS use `string & tags.Format<'date-time'>` for date values
254
- * - Use `toISOStringSafe(new Date())` for current timestamps
255
- * - Maintain a single-function structure; avoid using classes.
256
- */
257
- draft_without_date_type: string;
258
-
259
- /**
260
- * Step 4.
261
- *
262
- * A refined version of the draft with improved completeness.
263
- *
264
- * - Replace placeholder logic with real DTO-conformant operations.
265
- * - Add error handling (`throw new Error(...)`) where necessary.
266
- * - Begin resolving structural or type mismatches.
267
- *
268
- * ✅ Requirements:
269
- *
270
- * - Use `satisfies` to ensure DTO conformity.
271
- * - Avoid unsafe `as` casts unless only for branding or literal narrowing.
272
- * - Use `toISOStringSafe()` for all date conversions (NOT `.toISOString()`).
273
- * - Ensure all object keys strictly conform to the expected type definitions.
274
- */
275
- review: string;
276
-
277
- /**
278
- * 🛠 Phase 4-2: With compiler feedback (optional)
279
- *
280
- * A correction pass that applies fixes for compile-time errors that arose
281
- * during the review stage (if any).
282
- *
283
- * ✅ Must:
284
- *
285
- * - Only include this field if TypeScript errors are detected in the Review
286
- * phase.
287
- * - Resolve all TypeScript errors without using `as any`.
288
- * - Provide safe brand casting only if required (e.g., `as string &
289
- * tags.Format<'uuid'>`).
290
- * - If no TypeScript errors exist, this field MUST contain the text: "No
291
- * TypeScript errors detected - skipping this phase"
292
- */
293
- withCompilerFeedback: string;
294
-
295
- /**
296
- * Step 5.
297
- *
298
- * The complete and fully correct TypeScript function implementation.
299
- *
300
- * - Passes strict type checking without errors.
301
- * - Uses only safe branding or literal type assertions.
302
- * - Converts all date values properly using `toISOStringSafe()`.
303
- * - Follows DTO structures using `satisfies`.
304
- * - Avoids any weak typing such as `any`, `as any`, or `satisfies any`.
305
- * - Uses only allowed imports (e.g., from `../api/structures` and
306
- * `MyGlobal.prisma`).
307
- * - NEVER creates intermediate variables for Prisma operations.
308
- *
309
- * ⚠️ Fallback Behavior:
310
- *
311
- * - If the `plan` phase explicitly determines that the requested logic is
312
- * **not feasible** due to mismatches or limitations in the provided
313
- * Prisma schema and DTO types:
314
- *
315
- * - The implementation must still return a syntactically valid function.
316
- * - In such cases, return mock data using `typia.random<T>()` wrapped in the
317
- * correct structure, along with a comment explaining the limitation.
318
- *
319
- * Example fallback:
320
- *
321
- * ```ts
322
- * // ⚠️ Cannot implement logic due to missing relation between A and B
323
- * export async function someFunction(...) {
324
- * return typia.random<IReturn>(); // mocked output
325
- * }
326
- * ```
327
- *
328
- * ⚠️ Prohibited Practices:
329
- *
330
- * - Do NOT add or modify import statements manually. Imports are handled
331
- * automatically by the system.
332
- * - Do NOT use `any`, `as any`, or `satisfies any` to bypass type checking.
333
- * - Do NOT assign native `Date` objects directly; always convert them using
334
- * `toISOStringSafe()`.
335
- * - Do NOT use unsafe type assertions except for safe branding or literal
336
- * narrowing.
337
- * - Do NOT write code outside the single async function structure (e.g., no
338
- * classes or multiple functions).
339
- * - Do NOT perform any input validation — assume all inputs are already
340
- * validated.
341
- * - Do NOT use dynamic import expressions (`import()`); all imports must be
342
- * static.
343
- * - Do NOT use Prisma-generated input types; always use types from
344
- * `../api/structures`.
345
- * - Do NOT use `Object.prototype.hasOwnProperty.call()` for field checks.
346
- * - Do NOT escape newlines or quotes in the implementation string (e.g., no
347
- * `\\n` or `\"`); use a properly formatted template literal with actual
348
- * line breaks instead.
349
- */
350
- implementationCode: string;
351
- }
352
-
353
- export interface IPipeOutput {
354
- result: RealizeCoderOutput | FAILED;
355
-
356
- operation: AutoBeOpenApi.IOperation;
357
- }
358
- }
@@ -1,70 +0,0 @@
1
- import {
2
- AutoBeOpenApi,
3
- IAutoBeTypeScriptCompileResult,
4
- } from "@autobe/interface";
5
- import { tags } from "typia";
6
-
7
- import { IAutoBeRealizeCoderApplication } from "./IAutoBeRealizeCoderApplication";
8
- import { FAILED } from "./IAutoBeRealizeFailedSymbol";
9
-
10
- export namespace IAutoBeRealizeCompile {
11
- export type Result =
12
- | IAutoBeRealizeCompile.Success
13
- | IAutoBeRealizeCompile.Fail;
14
-
15
- type IBase<T extends "success" | "failed"> = {
16
- /**
17
- * Indicates whether code generation was attempted. "success" means code was
18
- * generated, but compilation may still fail. "failed" means code generation
19
- * was not possible (e.g., invalid input).
20
- */
21
- type: T;
22
- };
23
-
24
- export interface Success extends IBase<"success"> {
25
- /**
26
- * Operation: An object containing the function specification including the
27
- * endpoint
28
- */
29
- operation: AutoBeOpenApi.IOperation;
30
-
31
- /** Result */
32
- result: IAutoBeRealizeCoderApplication.RealizeCoderOutput;
33
- }
34
-
35
- export interface Fail extends IBase<"failed"> {
36
- /**
37
- * Operation: An object containing the function specification including the
38
- * endpoint
39
- */
40
- operation: AutoBeOpenApi.IOperation;
41
-
42
- /** Result */
43
- result: FAILED;
44
- }
45
-
46
- export interface CodeArtifact {
47
- result: "failed" | "success";
48
- content: string;
49
- role?: (string & tags.MinLength<1>) | null;
50
- endpoint?: AutoBeOpenApi.IEndpoint;
51
- location: string;
52
- name?: string;
53
- }
54
-
55
- export type FileContentMap = Record<string, CodeArtifact>;
56
-
57
- export interface CompileDiagnostics {
58
- /**
59
- * Array containing all errors including previous attempts. Includes errors
60
- * that have already been resolved. Used to preserve error context and
61
- * identify recurring error patterns.
62
- */
63
- total: IAutoBeTypeScriptCompileResult.IDiagnostic[];
64
- /**
65
- * Array containing errors from the most recent code compilation. These are
66
- * the errors that need to be resolved in the current iteration.
67
- */
68
- current: IAutoBeTypeScriptCompileResult.IDiagnostic[];
69
- }
70
- }
@@ -1,2 +0,0 @@
1
- export const FAILED = Symbol("FAILED");
2
- export type FAILED = typeof FAILED;
package/src/utils/pipe.ts DELETED
@@ -1,39 +0,0 @@
1
- import { FAILED } from "../orchestrate/realize/structures/IAutoBeRealizeFailedSymbol";
2
-
3
- export function pipe<A, B>(
4
- a: A,
5
- ab: (a: A) => Promise<B | FAILED>,
6
- ): Promise<B | FAILED>;
7
-
8
- export function pipe<A, B, C>(
9
- a: A,
10
- ab: (a: A) => Promise<B | FAILED>,
11
- bc: (b: B) => Promise<C | FAILED>,
12
- ): Promise<C | FAILED>;
13
-
14
- export function pipe<A, B, C, D>(
15
- a: A,
16
- ab: (a: A) => Promise<B | FAILED>,
17
- bc: (b: B) => Promise<C | FAILED>,
18
- cd: (c: C) => Promise<D | FAILED>,
19
- ): Promise<D | FAILED>;
20
-
21
- export function pipe<A, B, C, D, E>(
22
- a: A,
23
- ab: (a: A) => Promise<B | FAILED>,
24
- bc: (b: B) => Promise<C | FAILED>,
25
- cd: (c: C) => Promise<D | FAILED>,
26
- de: (d: D) => Promise<E | FAILED>,
27
- ): Promise<E | FAILED>;
28
-
29
- export function pipe(
30
- a: any,
31
- ...fns: Array<(arg: any) => Promise<any>>
32
- ): Promise<any> {
33
- return fns.reduce((prev, fn) => {
34
- return prev.then((result) => {
35
- if (result === FAILED) return FAILED;
36
- return fn(result);
37
- });
38
- }, Promise.resolve(a));
39
- }