@autobe/agent 0.25.7 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/lib/AutoBeAgent.js +3 -0
  2. package/lib/AutoBeAgent.js.map +1 -1
  3. package/lib/AutoBeMockAgent.js +15 -12
  4. package/lib/AutoBeMockAgent.js.map +1 -1
  5. package/lib/constants/AutoBeSystemPromptConstant.d.ts +26 -19
  6. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  7. package/lib/factory/consentFunctionCall.js +3 -0
  8. package/lib/factory/consentFunctionCall.js.map +1 -1
  9. package/lib/factory/createAutoBeContext.js +4 -1
  10. package/lib/factory/createAutoBeContext.js.map +1 -1
  11. package/lib/factory/getCommonPrompt.d.ts +2 -0
  12. package/lib/factory/getCommonPrompt.js +20 -0
  13. package/lib/factory/getCommonPrompt.js.map +1 -0
  14. package/lib/index.mjs +2636 -2258
  15. package/lib/index.mjs.map +1 -1
  16. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
  17. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
  18. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
  19. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  20. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +6 -6
  21. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  22. package/lib/orchestrate/analyze/orchestrateAnalyze.js +1 -1
  23. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  24. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +73 -73
  25. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  26. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -2
  27. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +9 -9
  28. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +1 -1
  29. package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +2 -17
  30. package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
  31. package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.d.ts +6 -0
  32. package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js +58 -0
  33. package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js.map +1 -0
  34. package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
  35. package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
  36. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +2 -2
  37. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +8 -8
  38. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  39. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
  40. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  41. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
  42. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  43. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +1 -1
  44. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
  45. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
  46. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  47. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
  48. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  49. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
  50. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  51. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +1 -0
  52. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +46 -20
  53. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  54. package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.d.ts +5 -0
  55. package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js +51 -0
  56. package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js.map +1 -0
  57. package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.d.ts +11 -0
  58. package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js +81 -0
  59. package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js.map +1 -0
  60. package/lib/orchestrate/interface/orchestrateInterface.js +24 -4
  61. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  62. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +52 -52
  63. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  64. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +2 -2
  65. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  66. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +2 -2
  67. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -1
  68. package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
  69. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +2 -2
  70. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  71. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +57 -57
  72. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  73. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +43 -43
  74. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  75. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +4 -4
  76. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -1
  77. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.d.ts +7 -0
  78. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +444 -0
  79. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -0
  80. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.d.ts +12 -0
  81. package/lib/orchestrate/interface/{orchestrateInterfaceSchemasReview.js → orchestrateInterfaceSchemaReview.js} +66 -57
  82. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -0
  83. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +9 -6
  84. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  85. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +22 -22
  86. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +7 -7
  87. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.d.ts +101 -0
  88. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.js +3 -0
  89. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.js.map +1 -0
  90. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.d.ts +97 -0
  91. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js +3 -0
  92. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js.map +1 -0
  93. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.d.ts +44 -0
  94. package/lib/orchestrate/interface/structures/{IAutobeInterfaceSchemasReviewApplication.js → IAutoBeInterfaceSchemaRenameApplication.js} +1 -1
  95. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.js.map +1 -0
  96. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.d.ts +92 -0
  97. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js +3 -0
  98. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js.map +1 -0
  99. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +42 -1
  100. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
  101. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +94 -0
  102. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
  103. package/lib/orchestrate/interface/utils/OperationValidator.d.ts +1 -1
  104. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +13 -13
  105. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  106. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
  107. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  108. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
  109. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  110. package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +2 -2
  111. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +2 -2
  112. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  113. package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +2 -2
  114. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +2 -2
  115. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  116. package/lib/orchestrate/realize/histories/transformRealizeAuthorization.d.ts +2 -2
  117. package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js +8 -7
  118. package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
  119. package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +4 -4
  120. package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  121. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.d.ts +4 -7
  122. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +8 -18
  123. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -1
  124. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +0 -1
  125. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +8 -28
  126. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  127. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +1 -1
  128. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +16 -280
  129. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
  130. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +1 -1
  131. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  132. package/lib/orchestrate/realize/orchestrateRealize.js +2 -2
  133. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  134. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +12 -12
  135. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  136. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +9 -9
  137. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  138. package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +1 -1
  139. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +43 -22
  140. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  141. package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.js → orchestrateRealizeCorrectCasting.js} +58 -46
  142. package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -0
  143. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
  144. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.d.ts +2 -2
  145. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js +6 -6
  146. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js.map +1 -1
  147. package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -1
  148. package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
  149. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +2 -2
  150. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
  151. package/lib/orchestrate/realize/utils/getRealizeWriteDto.js +1 -1
  152. package/lib/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -1
  153. package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js +2 -2
  154. package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -1
  155. package/lib/orchestrate/realize/utils/printErrorHints.js +1 -1
  156. package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -1
  157. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +1 -1
  158. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
  159. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +5 -22
  160. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  161. package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +10 -10
  162. package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
  163. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +5 -5
  164. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  165. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +2 -2
  166. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
  167. package/lib/orchestrate/test/orchestrateTestCorrect.js +2 -0
  168. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  169. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +1 -0
  170. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
  171. package/lib/orchestrate/test/orchestrateTestScenario.js +26 -26
  172. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  173. package/lib/orchestrate/test/orchestrateTestScenarioReview.js +2 -2
  174. package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
  175. package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.d.ts → IAutoBeTestScenarioAuthorizationActor.d.ts} +1 -1
  176. package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.js → IAutoBeTestScenarioAuthorizationActor.js} +1 -1
  177. package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationActor.js.map +1 -0
  178. package/package.json +5 -5
  179. package/src/AutoBeAgent.ts +3 -0
  180. package/src/AutoBeMockAgent.ts +15 -12
  181. package/src/constants/AutoBeSystemPromptConstant.ts +26 -19
  182. package/src/factory/consentFunctionCall.ts +4 -0
  183. package/src/factory/createAutoBeContext.ts +5 -1
  184. package/src/factory/getCommonPrompt.ts +25 -0
  185. package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +5 -5
  186. package/src/orchestrate/analyze/orchestrateAnalyze.ts +1 -1
  187. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +3 -3
  188. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +9 -9
  189. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +1 -1
  190. package/src/orchestrate/common/histories/transformCommonCorrectCastingHistories.ts +2 -20
  191. package/src/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.ts +65 -0
  192. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +9 -9
  193. package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +45 -20
  194. package/src/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.ts +55 -0
  195. package/src/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.ts +90 -0
  196. package/src/orchestrate/interface/orchestrateInterface.ts +34 -14
  197. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +18 -18
  198. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +4 -4
  199. package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +2 -2
  200. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +5 -5
  201. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +23 -23
  202. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +4 -4
  203. package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +2 -2
  204. package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +269 -0
  205. package/src/orchestrate/interface/{orchestrateInterfaceSchemasReview.ts → orchestrateInterfaceSchemaReview.ts} +88 -70
  206. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +16 -8
  207. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +26 -22
  208. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +7 -7
  209. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.ts +108 -0
  210. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.ts +104 -0
  211. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.ts +45 -0
  212. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.ts +99 -0
  213. package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +45 -3
  214. package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +110 -0
  215. package/src/orchestrate/interface/utils/OperationValidator.ts +1 -1
  216. package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +12 -12
  217. package/src/orchestrate/prisma/orchestratePrisma.ts +4 -4
  218. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +4 -4
  219. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +7 -7
  220. package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +8 -7
  221. package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +4 -4
  222. package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +14 -28
  223. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -30
  224. package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +20 -285
  225. package/src/orchestrate/realize/orchestrateRealize.ts +1 -1
  226. package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +9 -9
  227. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +3 -3
  228. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +74 -60
  229. package/src/orchestrate/realize/{orchestRateRealizeCorrectCasting.ts → orchestrateRealizeCorrectCasting.ts} +86 -85
  230. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +3 -3
  231. package/src/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.ts +10 -7
  232. package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -1
  233. package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +2 -2
  234. package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +1 -1
  235. package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +2 -2
  236. package/src/orchestrate/realize/utils/printErrorHints.ts +1 -1
  237. package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +1 -1
  238. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +6 -24
  239. package/src/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.ts +10 -10
  240. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +12 -10
  241. package/src/orchestrate/test/orchestrateTestCorrect.ts +2 -0
  242. package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +1 -0
  243. package/src/orchestrate/test/orchestrateTestScenario.ts +30 -30
  244. package/src/orchestrate/test/orchestrateTestScenarioReview.ts +2 -2
  245. package/src/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.ts → IAutoBeTestScenarioAuthorizationActor.ts} +1 -1
  246. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +0 -4
  247. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +0 -60
  248. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +0 -1
  249. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +0 -9
  250. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +0 -1
  251. package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +0 -91
  252. package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.js.map +0 -1
  253. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +0 -1
  254. package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.js.map +0 -1
  255. package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +0 -67
  256. package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +0 -96
  257. /package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.d.ts → orchestrateRealizeCorrectCasting.d.ts} +0 -0
@@ -34,7 +34,7 @@ export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
34
34
  scenarios: IAutoBeRealizeScenarioResult[],
35
35
  authorizations: AutoBeRealizeAuthorization[],
36
36
  functions: AutoBeRealizeFunction[],
37
- failures: IAutoBeRealizeFunctionFailure[],
37
+ previousFailures: IAutoBeRealizeFunctionFailure[][],
38
38
  progress: AutoBeProgressEventBase,
39
39
  life: number = ctx.retry,
40
40
  ): Promise<AutoBeRealizeFunction[]> {
@@ -92,32 +92,26 @@ export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
92
92
  diagnosticsByFile[location].diagnostics.push(diagnostic);
93
93
  });
94
94
 
95
- const newFailures: IAutoBeRealizeFunctionFailure[] = [
96
- ...failures,
97
- ...Object.values(diagnosticsByFile),
98
- ];
99
-
100
- const corrected: AutoBeRealizeFunction[] = await correct(
101
- ctx,
95
+ const newFailures: IAutoBeRealizeFunctionFailure[] =
96
+ Object.values(diagnosticsByFile);
97
+ const corrected: AutoBeRealizeFunction[] = await correct(ctx, {
102
98
  locations,
103
99
  scenarios,
104
100
  authorizations,
105
101
  functions,
106
- filterDiagnostics(
102
+ previousFailures,
103
+ failures: filterDiagnostics(
107
104
  newFailures,
108
105
  functions.map((fn) => fn.location),
109
106
  ),
110
107
  progress,
111
- );
108
+ });
112
109
  return orchestrateRealizeCorrect(
113
110
  ctx,
114
111
  scenarios,
115
112
  authorizations,
116
113
  corrected,
117
- filterDiagnostics(
118
- newFailures,
119
- corrected.map((c) => c.location),
120
- ),
114
+ [...previousFailures, newFailures],
121
115
  progress,
122
116
  life - 1,
123
117
  );
@@ -125,61 +119,82 @@ export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
125
119
 
126
120
  async function correct<Model extends ILlmSchema.Model>(
127
121
  ctx: AutoBeContext<Model>,
128
- locations: string[],
129
- scenarios: IAutoBeRealizeScenarioResult[],
130
- authorizations: AutoBeRealizeAuthorization[],
131
- functions: AutoBeRealizeFunction[],
132
- failures: IAutoBeRealizeFunctionFailure[],
133
- progress: AutoBeProgressEventBase,
122
+ props: {
123
+ locations: string[];
124
+ scenarios: IAutoBeRealizeScenarioResult[];
125
+ authorizations: AutoBeRealizeAuthorization[];
126
+ functions: AutoBeRealizeFunction[];
127
+ previousFailures: IAutoBeRealizeFunctionFailure[][];
128
+ failures: IAutoBeRealizeFunctionFailure[];
129
+ progress: AutoBeProgressEventBase;
130
+ },
134
131
  ): Promise<AutoBeRealizeFunction[]> {
135
- if (locations.length === 0) {
136
- return functions;
132
+ if (props.locations.length === 0) {
133
+ return props.functions;
137
134
  }
138
135
 
139
136
  const corrected: AutoBeRealizeFunction[] = await executeCachedBatch(
140
- locations.map((location) => async (): Promise<AutoBeRealizeFunction> => {
141
- const scenario = scenarios.find((el) => el.location === location);
142
- const func = functions.find((el) => el.location === location);
143
-
144
- if (!func) {
145
- throw new Error("No function found for location: " + location);
146
- }
147
-
148
- const RealizeFunctionFailures: IAutoBeRealizeFunctionFailure[] =
149
- failures.filter((f) => f.function?.location === location);
137
+ props.locations.map(
138
+ (location) => async (): Promise<AutoBeRealizeFunction> => {
139
+ const scenario = props.scenarios.find((el) => el.location === location);
140
+ const func = props.functions.find((el) => el.location === location);
150
141
 
151
- if (RealizeFunctionFailures.length && scenario) {
152
- try {
153
- const correctEvent: AutoBeRealizeCorrectEvent | null = await step(
154
- ctx,
155
- {
156
- totalAuthorizations: authorizations,
157
- authorization: scenario.decoratorEvent ?? null,
158
- scenario,
159
- function: func,
160
- failures: RealizeFunctionFailures,
161
- progress: progress,
162
- },
163
- );
142
+ if (!func) {
143
+ throw new Error("No function found for location: " + location);
144
+ }
164
145
 
165
- return {
166
- ...func,
167
- content: correctEvent === null ? "" : correctEvent.content,
168
- };
169
- } catch (err) {
170
- return func;
146
+ const failures: IAutoBeRealizeFunctionFailure[] = props.failures.filter(
147
+ (f) => f.function?.location === location,
148
+ );
149
+ if (failures.length && scenario) {
150
+ try {
151
+ const correctEvent: AutoBeRealizeCorrectEvent | null = await step(
152
+ ctx,
153
+ {
154
+ totalAuthorizations: props.authorizations,
155
+ authorization: scenario.decoratorEvent ?? null,
156
+ scenario,
157
+ function: func,
158
+ previousFailures: props.previousFailures
159
+ .map((pf) => {
160
+ const previousFailures: IAutoBeRealizeFunctionFailure[] =
161
+ pf.filter((f) => f.function.location === location);
162
+ if (previousFailures.length === 0) return null;
163
+ return {
164
+ function: previousFailures[0].function,
165
+ diagnostics: previousFailures
166
+ .map((f) => f.diagnostics)
167
+ .flat(),
168
+ };
169
+ })
170
+ .filter((f) => f !== null),
171
+ failure: {
172
+ function: failures[0].function,
173
+ diagnostics: failures.map((f) => f.diagnostics).flat(),
174
+ },
175
+ progress: props.progress,
176
+ },
177
+ );
178
+
179
+ return {
180
+ ...func,
181
+ content: correctEvent === null ? "" : correctEvent.content,
182
+ };
183
+ } catch (err) {
184
+ return func;
185
+ }
171
186
  }
172
- }
173
187
 
174
- return func;
175
- }),
188
+ return func;
189
+ },
190
+ ),
176
191
  );
177
192
 
178
193
  // Create a map of corrected functions for efficient lookup
179
194
  const correctedMap = new Map(corrected.map((f) => [f.location, f]));
180
195
 
181
196
  // Return all functions, with corrected ones replaced
182
- return functions.map((func) => correctedMap.get(func.location) || func);
197
+ return props.functions.map((func) => correctedMap.get(func.location) || func);
183
198
  }
184
199
 
185
200
  async function step<Model extends ILlmSchema.Model>(
@@ -189,7 +204,8 @@ async function step<Model extends ILlmSchema.Model>(
189
204
  totalAuthorizations: AutoBeRealizeAuthorization[];
190
205
  scenario: IAutoBeRealizeScenarioResult;
191
206
  function: AutoBeRealizeFunction;
192
- failures: IAutoBeRealizeFunctionFailure[];
207
+ previousFailures: IAutoBeRealizeFunctionFailure[];
208
+ failure: IAutoBeRealizeFunctionFailure;
193
209
  progress: AutoBeProgressEventBase;
194
210
  },
195
211
  ): Promise<AutoBeRealizeCorrectEvent | null> {
@@ -211,11 +227,8 @@ async function step<Model extends ILlmSchema.Model>(
211
227
  state: ctx.state(),
212
228
  scenario: props.scenario,
213
229
  authorization: props.authorization,
214
- code: props.function.content,
215
230
  dto,
216
- failures: props.failures.filter(
217
- (f) => f.function.location === props.function.location,
218
- ),
231
+ failures: [...props.previousFailures, props.failure],
219
232
  totalAuthorizations: props.totalAuthorizations,
220
233
  }),
221
234
  enforceFunctionCall: true,
@@ -261,6 +274,7 @@ async function step<Model extends ILlmSchema.Model>(
261
274
 
262
275
  const event: AutoBeRealizeCorrectEvent = {
263
276
  type: "realizeCorrect",
277
+ kind: "overall",
264
278
  id: v7(),
265
279
  location: props.scenario.location,
266
280
  content: pointer.value.revise.final ?? pointer.value.draft,
@@ -24,6 +24,7 @@ import { validateEmptyCode } from "../../utils/validateEmptyCode";
24
24
  import { IAutoBeCommonCorrectCastingApplication } from "../common/structures/IAutoBeCommonCorrectCastingApplication";
25
25
  import { transformRealizeCorrectCastingHistories } from "./histories/transformRealizeCorrectCastingHistories";
26
26
  import { compileRealizeFiles } from "./internal/compileRealizeFiles";
27
+ import { IAutoBeRealizeFunctionFailure } from "./structures/IAutoBeRealizeFunctionFailure";
27
28
  import { IAutoBeRealizeScenarioResult } from "./structures/IAutoBeRealizeScenarioResult";
28
29
  import { getRealizeWriteCodeTemplate } from "./utils/getRealizeWriteCodeTemplate";
29
30
  import { replaceImportStatements } from "./utils/replaceImportStatements";
@@ -53,94 +54,103 @@ export const orchestrateRealizeCorrectCasting = async <
53
54
  );
54
55
  return predicate(
55
56
  ctx,
56
- scenarios,
57
- authorizations,
58
- functions,
59
- [],
60
- progress,
61
- validateEvent,
57
+ {
58
+ scenarios,
59
+ authorizations,
60
+ functions,
61
+ previousFailures: [],
62
+ progress,
63
+ event: validateEvent,
64
+ },
62
65
  life,
63
66
  );
64
67
  };
65
68
 
66
69
  const predicate = async <Model extends ILlmSchema.Model>(
67
70
  ctx: AutoBeContext<Model>,
68
- scenarios: IAutoBeRealizeScenarioResult[],
69
- authorizations: AutoBeRealizeAuthorization[],
70
- functions: AutoBeRealizeFunction[],
71
- failures: IAutoBeTypeScriptCompileResult.IDiagnostic[],
72
- progress: AutoBeProgressEventBase,
73
- event: AutoBeRealizeValidateEvent,
71
+ props: {
72
+ scenarios: IAutoBeRealizeScenarioResult[];
73
+ authorizations: AutoBeRealizeAuthorization[];
74
+ functions: AutoBeRealizeFunction[];
75
+ previousFailures: IAutoBeRealizeFunctionFailure[][];
76
+ progress: AutoBeProgressEventBase;
77
+ event: AutoBeRealizeValidateEvent;
78
+ },
74
79
  life: number,
75
80
  ): Promise<AutoBeRealizeFunction[]> => {
76
- if (event.result.type === "failure") {
77
- ctx.dispatch(event);
78
- return await correct(
79
- ctx,
80
- scenarios,
81
- authorizations,
82
- functions,
83
- [...failures, ...event.result.diagnostics],
84
- progress,
85
- event,
86
- life,
87
- );
81
+ if (props.event.result.type === "failure") {
82
+ ctx.dispatch(props.event);
83
+ return await correct(ctx, props, life);
88
84
  }
89
- return functions;
85
+ return props.functions;
90
86
  };
91
87
 
92
88
  const correct = async <Model extends ILlmSchema.Model>(
93
89
  ctx: AutoBeContext<Model>,
94
- scenarios: IAutoBeRealizeScenarioResult[],
95
- authorizations: AutoBeRealizeAuthorization[],
96
- functions: AutoBeRealizeFunction[],
97
- failures: IAutoBeTypeScriptCompileResult.IDiagnostic[],
98
- progress: AutoBeProgressEventBase,
99
- event: AutoBeRealizeValidateEvent,
90
+ props: {
91
+ scenarios: IAutoBeRealizeScenarioResult[];
92
+ authorizations: AutoBeRealizeAuthorization[];
93
+ functions: AutoBeRealizeFunction[];
94
+ previousFailures: IAutoBeRealizeFunctionFailure[][];
95
+ progress: AutoBeProgressEventBase;
96
+ event: AutoBeRealizeValidateEvent;
97
+ },
100
98
  life: number,
101
99
  ): Promise<AutoBeRealizeFunction[]> => {
102
100
  // Early returns for non-correctable cases
103
- if (event.result.type !== "failure" || life < 0) {
104
- return functions;
101
+ if (props.event.result.type !== "failure" || life < 0) {
102
+ return props.functions;
105
103
  }
106
104
 
107
- const locations: string[] = diagnose(event).filter((l) =>
108
- functions.map((f) => f.location).includes(l),
105
+ const failure = props.event.result;
106
+ const locations: string[] = diagnose(props.event).filter((l) =>
107
+ props.functions.map((f) => f.location).includes(l),
109
108
  );
110
109
 
111
110
  // If no locations to correct, return original functions
112
111
  if (locations.length === 0) {
113
- return functions;
112
+ return props.functions;
114
113
  }
115
114
 
116
- progress.total += locations.length;
115
+ props.progress.total += locations.length;
117
116
 
118
117
  const converted: CorrectionResult[] = await executeCachedBatch(
119
118
  locations.map((location) => async (): Promise<CorrectionResult> => {
120
- const func: AutoBeRealizeFunction = functions.find(
119
+ const func: AutoBeRealizeFunction = props.functions.find(
121
120
  (f) => f.location === location,
122
121
  )!;
123
- const scenario: IAutoBeRealizeScenarioResult = scenarios.find(
122
+ const scenario: IAutoBeRealizeScenarioResult = props.scenarios.find(
124
123
  (s) => s.location === func.location,
125
124
  )!;
126
125
  const operation: AutoBeOpenApi.IOperation = scenario.operation;
127
126
  const authorization: AutoBeRealizeAuthorization | undefined =
128
- authorizations.find((a) => a.role.name === operation.authorizationRole);
127
+ props.authorizations.find(
128
+ (a) => a.actor.name === operation.authorizationActor,
129
+ );
129
130
 
130
131
  const pointer: IPointer<
131
132
  IAutoBeCommonCorrectCastingApplication.IProps | false | null
132
133
  > = {
133
134
  value: null,
134
135
  };
135
-
136
136
  const { tokenUsage } = await ctx.conversate({
137
137
  source: "realizeCorrect",
138
- histories: transformRealizeCorrectCastingHistories([
139
- {
140
- script: func.content,
141
- diagnostics: failures.filter((d) => d.file === location),
142
- },
143
- ]),
138
+ histories: transformRealizeCorrectCastingHistories({
139
+ failures: [
140
+ ...props.previousFailures
141
+ .map(
142
+ (pf) =>
143
+ pf.find((f) => f.function.location === func.location) ?? null,
144
+ )
145
+ .filter((x) => x !== null),
146
+ {
147
+ function: func,
148
+ diagnostics: failure.diagnostics.filter(
149
+ (d) => d.file === func.location,
150
+ ),
151
+ },
152
+ ],
153
+ }),
144
154
  controller: createController({
145
155
  model: ctx.model,
146
156
  functionName: scenario.functionName,
@@ -194,7 +204,7 @@ const correct = async <Model extends ILlmSchema.Model>(
194
204
  I repeat that, never assert the Prisma type. It's not your mission.
195
205
  `,
196
206
  });
197
- ++progress.completed;
207
+ ++props.progress.completed;
198
208
 
199
209
  if (pointer.value === null)
200
210
  return { result: "exception" as const, func: func };
@@ -218,13 +228,14 @@ const correct = async <Model extends ILlmSchema.Model>(
218
228
  ctx.dispatch({
219
229
  id: v7(),
220
230
  type: "realizeCorrect",
231
+ kind: "casting",
221
232
  content: pointer.value.revise.final ?? pointer.value.draft,
222
233
  created_at: new Date().toISOString(),
223
234
  location: func.location,
224
235
  step: ctx.state().analyze?.step ?? 0,
225
236
  tokenUsage,
226
- completed: progress.completed,
227
- total: progress.total,
237
+ completed: props.progress.completed,
238
+ total: props.progress.total,
228
239
  });
229
240
  return {
230
241
  result: "success" as const,
@@ -237,7 +248,7 @@ const correct = async <Model extends ILlmSchema.Model>(
237
248
  );
238
249
 
239
250
  // Get functions that were not modified (not in locations array)
240
- const unchangedFunctions: AutoBeRealizeFunction[] = functions.filter(
251
+ const unchangedFunctions: AutoBeRealizeFunction[] = props.functions.filter(
241
252
  (f) => !locations.includes(f.location),
242
253
  );
243
254
 
@@ -250,7 +261,7 @@ const correct = async <Model extends ILlmSchema.Model>(
250
261
  const newValidate: AutoBeRealizeValidateEvent = await compileRealizeFiles(
251
262
  ctx,
252
263
  {
253
- authorizations,
264
+ authorizations: props.authorizations,
254
265
  functions: allFunctionsForValidation,
255
266
  },
256
267
  );
@@ -260,7 +271,7 @@ const correct = async <Model extends ILlmSchema.Model>(
260
271
  return allFunctionsForValidation;
261
272
  } else if (newResult.type === "exception") {
262
273
  // Compilation exception, return current functions. because retrying won't help.
263
- return functions;
274
+ return props.functions;
264
275
  }
265
276
 
266
277
  if (
@@ -283,27 +294,33 @@ const correct = async <Model extends ILlmSchema.Model>(
283
294
  return [...success, ...ignored, ...unchangedFunctions];
284
295
  }
285
296
 
286
- // Collect diagnostics relevant to failed functions
287
- const failedLocations: string[] = failed.map((f) => f.location);
288
- const allDiagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[] = [
289
- ...failures,
290
- ...(newResult.type === "failure" ? newResult.diagnostics : []),
291
- ];
292
- const relevantDiagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[] =
293
- filterRelevantDiagnostics(allDiagnostics, failedLocations);
294
-
295
297
  // Recursively retry failed functions
296
298
  const retriedFunctions: AutoBeRealizeFunction[] = await predicate(
297
299
  ctx,
298
- scenarios,
299
- authorizations,
300
- failed,
301
- relevantDiagnostics,
302
- progress,
303
- newValidate,
300
+ {
301
+ scenarios: props.scenarios,
302
+ authorizations: props.authorizations,
303
+ functions: failed,
304
+ previousFailures: [
305
+ ...props.previousFailures,
306
+ failed.map(
307
+ (f) =>
308
+ ({
309
+ function: f,
310
+ diagnostics:
311
+ newValidate.result.type === "failure"
312
+ ? newValidate.result.diagnostics.filter(
313
+ (d) => d.file === f.location,
314
+ )
315
+ : [],
316
+ }) satisfies IAutoBeRealizeFunctionFailure,
317
+ ),
318
+ ],
319
+ progress: props.progress,
320
+ event: newValidate,
321
+ },
304
322
  life - 1,
305
323
  );
306
-
307
324
  return [...success, ...ignored, ...retriedFunctions, ...unchangedFunctions];
308
325
  };
309
326
 
@@ -362,22 +379,6 @@ const separateCorrectionResults = (
362
379
  return { success, failed, ignored };
363
380
  };
364
381
 
365
- /**
366
- * Filter diagnostics to only include those relevant to specific functions
367
- *
368
- * @param diagnostics - All diagnostics
369
- * @param functionLocations - Locations of functions to filter for
370
- * @returns Filtered diagnostics
371
- */
372
- const filterRelevantDiagnostics = (
373
- diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[],
374
- functionLocations: string[],
375
- ): IAutoBeTypeScriptCompileResult.IDiagnostic[] => {
376
- return diagnostics.filter(
377
- (d) => d.file && functionLocations.includes(d.file),
378
- );
379
- };
380
-
381
382
  const createController = <Model extends ILlmSchema.Model>(props: {
382
383
  model: Model;
383
384
  functionName: string;
@@ -83,7 +83,7 @@ export namespace IAutoBeRealizeAuthorizationApplication {
83
83
 
84
84
  export interface IDecorator {
85
85
  /**
86
- * The name of the Decorator to be generated in {Role}Auth format (e.g.,
86
+ * The name of the Decorator to be generated in {Actor}Auth format (e.g.,
87
87
  * AdminAuth, UserAuth). This decorator will be used as a parameter
88
88
  * decorator in Controller methods to automatically authenticate and
89
89
  * authorize users for the specific role, injecting the authenticated user
@@ -106,7 +106,7 @@ export namespace IAutoBeRealizeAuthorizationApplication {
106
106
 
107
107
  export interface IPayloadType {
108
108
  /**
109
- * The name of the Payload type to be generated in {Role}Payload format
109
+ * The name of the Payload type to be generated in {Actor}Payload format
110
110
  * (e.g., AdminPayload, UserPayload). This type defines the structure of the
111
111
  * authenticated user data that will be injected into Controller methods
112
112
  * when using the decorator.
@@ -116,7 +116,7 @@ export namespace IAutoBeRealizeAuthorizationApplication {
116
116
  name: string & PascalCasePattern;
117
117
 
118
118
  /**
119
- * Complete TypeScript code for the Payload type interface in {Role}Payload
119
+ * Complete TypeScript code for the Payload type interface in {Actor}Payload
120
120
  * format (e.g., AdminPayload, UserPayload). Must include: id field with
121
121
  * UUID format validation, type field as role discriminator, and proper
122
122
  * typia tags for validation. This interface defines the structure of the
@@ -1,9 +1,12 @@
1
1
  export namespace AutoBeRealizeAuthorizationReplaceImport {
2
- export function replaceProviderImport(role: string, content: string): string {
2
+ export function replaceProviderImport(
3
+ actor: string,
4
+ content: string,
5
+ ): string {
3
6
  let updatedContent = content;
4
7
 
5
- const roleCapitalized =
6
- role.charAt(0).toUpperCase() + role.slice(1).toLowerCase();
8
+ const actorCapitalized =
9
+ actor.charAt(0).toUpperCase() + actor.slice(1).toLowerCase();
7
10
 
8
11
  const nestjsCommonPattern =
9
12
  /import\s+{\s*[^}]*\s*}\s+from\s+"@nestjs\/common";/g;
@@ -19,7 +22,7 @@ export namespace AutoBeRealizeAuthorizationReplaceImport {
19
22
  'import { jwtAuthorize } from "./jwtAuthorize";';
20
23
 
21
24
  const payloadPattern = /import\s+{\s*\w*Payload\s*}\s+from\s+[^;]+;/g;
22
- const payloadReplacement = `import { ${roleCapitalized}Payload } from "../../decorators/payload/${roleCapitalized}Payload";`;
25
+ const payloadReplacement = `import { ${actorCapitalized}Payload } from "../../decorators/payload/${actorCapitalized}Payload";`;
23
26
 
24
27
  // 각 패턴을 순차적으로 적용
25
28
  updatedContent = updatedContent.replace(
@@ -40,18 +43,18 @@ export namespace AutoBeRealizeAuthorizationReplaceImport {
40
43
  }
41
44
 
42
45
  export function replaceDecoratorImport(
43
- role: string,
46
+ actor: string,
44
47
  content: string,
45
48
  ): string {
46
49
  let updatedContent = content;
47
50
 
48
- const roleLowercase = role.toLowerCase();
51
+ const actorLowercase = actor.toLowerCase();
49
52
 
50
53
  // ~Authorize로 끝나는 import 구문을 특정 경로로 변경하는 정규표현식
51
54
  const authorizePattern = /import\s+{\s*\w*Authorize\s*}\s+from\s+[^;]+;/g;
52
55
 
53
56
  // role을 기반으로 동적으로 replacement 생성
54
- const authorizeReplacement = `import { ${roleLowercase}Authorize } from "../providers/authorize/${roleLowercase}Authorize";`;
57
+ const authorizeReplacement = `import { ${actorLowercase}Authorize } from "../providers/authorize/${actorLowercase}Authorize";`;
55
58
 
56
59
  // 패턴 적용
57
60
  updatedContent = updatedContent.replace(
@@ -34,7 +34,7 @@ export function generateRealizeScenario<Model extends ILlmSchema.Model>(
34
34
  authorizations: AutoBeRealizeAuthorization[],
35
35
  ): IAutoBeRealizeScenarioResult {
36
36
  const authorization = authorizations.find(
37
- (el) => el.role.name === operation.authorizationRole,
37
+ (el) => el.actor.name === operation.authorizationActor,
38
38
  );
39
39
 
40
40
  const testFiles: AutoBeTestFile[] =
@@ -42,9 +42,9 @@ export function getRealizeWriteCodeTemplate(props: {
42
42
  const functionParameters: string[] = [];
43
43
 
44
44
  // Add authentication parameter if needed (e.g., user: IUser, admin: IAdmin)
45
- if (props.authorization && props.authorization.role.name) {
45
+ if (props.authorization && props.authorization.actor.name) {
46
46
  // Debug: Log the values to check what's being used
47
- const authParameter = `${props.authorization.role.name}: ${props.authorization.payload.name}`;
47
+ const authParameter = `${props.authorization.actor.name}: ${props.authorization.payload.name}`;
48
48
  functionParameters.push(authParameter);
49
49
  }
50
50
 
@@ -37,7 +37,7 @@ function filterDocument(
37
37
  document: AutoBeOpenApi.IDocument,
38
38
  ): AutoBeOpenApi.IDocument {
39
39
  const components: AutoBeOpenApi.IComponents = {
40
- authorization: document.components.authorization,
40
+ authorizations: document.components.authorizations,
41
41
  schemas: {},
42
42
  };
43
43
 
@@ -36,9 +36,9 @@ export function getRealizeWriteInputType(
36
36
  const functionParameterFields: string[] = [];
37
37
 
38
38
  // Add authentication field (user/admin/member) if endpoint requires auth
39
- const hasAuthentication = authorization && operation.authorizationRole;
39
+ const hasAuthentication = authorization && operation.authorizationActor;
40
40
  if (hasAuthentication) {
41
- const authFieldName = operation.authorizationRole;
41
+ const authFieldName = operation.authorizationActor;
42
42
  const authFieldType = authorization.payload.name;
43
43
  functionParameterFields.push(`${authFieldName}: ${authFieldType};`);
44
44
  }
@@ -51,5 +51,5 @@ export function printErrorHints(
51
51
  \`\`\`
52
52
  `;
53
53
  })
54
- .join("\n");
54
+ .join("\n\n");
55
55
  }
@@ -57,7 +57,7 @@ function filterDocument(
57
57
  ),
58
58
  );
59
59
  const components: AutoBeOpenApi.IComponents = {
60
- authorization: document.components.authorization,
60
+ authorizations: document.components.authorizations,
61
61
  schemas: {},
62
62
  };
63
63
  const visit = (typeName: string) => {
@@ -1,10 +1,10 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
- import { StringUtil } from "@autobe/utils";
3
2
  import { ILlmSchema } from "@samchon/openapi";
4
3
  import { v7 } from "uuid";
5
4
 
6
5
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
7
6
  import { AutoBeContext } from "../../../context/AutoBeContext";
7
+ import { transformPreviousAndLatestCorrectHistories } from "../../common/histories/transformPreviousAndLatestCorrectHistories";
8
8
  import { IAutoBeTestFunction } from "../structures/IAutoBeTestFunction";
9
9
  import { IAutoBeTestFunctionFailure } from "../structures/IAutoBeTestFunctionFailure";
10
10
  import { transformTestWriteHistories } from "./transformTestWriteHistories";
@@ -39,29 +39,11 @@ export const transformTestCorrectHistories = async <
39
39
  text: AutoBeSystemPromptConstant.TEST_CORRECT,
40
40
  },
41
41
  previous.at(-1)!,
42
- ...props.failures.map(
43
- (f, i, array) =>
44
- ({
45
- id: v7(),
46
- created_at: new Date().toISOString(),
47
- type: "assistantMessage",
48
- text: StringUtil.trim`
49
- ## ${i === array.length - 1 ? "Latest Failure" : "Previous Failure"}
50
- ### Generated TypeScript Code
51
-
52
- \`\`\`typescript
53
- ${f.function.script}
54
- \`\`\`
55
-
56
- ### Compile Errors
57
-
58
- Fix the compilation error in the provided code.
59
-
60
- \`\`\`json
61
- ${JSON.stringify(f.failure.diagnostics)}
62
- \`\`\`
63
- `,
64
- }) satisfies IAgenticaHistoryJson.IAssistantMessage,
42
+ ...transformPreviousAndLatestCorrectHistories(
43
+ props.failures.map((f) => ({
44
+ script: f.function.script,
45
+ diagnostics: f.failure.diagnostics,
46
+ })),
65
47
  ),
66
48
  ];
67
49
  };