@autobe/agent 0.30.4-dev.20260324 → 0.30.5

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 (221) hide show
  1. package/LICENSE +661 -661
  2. package/lib/constants/AutoBeSystemPromptConstant.d.ts +5 -4
  3. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  4. package/lib/describe/image/orchestrateImageDescribeDraft.js +6 -6
  5. package/lib/describe/image/structures/IAutoBeImageDescribeDraftApplication.d.ts +12 -63
  6. package/lib/index.mjs +2918 -2842
  7. package/lib/index.mjs.map +1 -1
  8. package/lib/orchestrate/analyze/orchestrateAnalyzeExtractDecisions.js +8 -8
  9. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +36 -37
  10. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  11. package/lib/orchestrate/analyze/orchestrateAnalyzeScenarioReview.js +7 -7
  12. package/lib/orchestrate/analyze/orchestrateAnalyzeSectionCrossFileReview.js +55 -42
  13. package/lib/orchestrate/analyze/orchestrateAnalyzeSectionCrossFileReview.js.map +1 -1
  14. package/lib/orchestrate/analyze/orchestrateAnalyzeSectionReview.js +67 -54
  15. package/lib/orchestrate/analyze/orchestrateAnalyzeSectionReview.js.map +1 -1
  16. package/lib/orchestrate/analyze/orchestrateAnalyzeWriteSection.js +24 -25
  17. package/lib/orchestrate/analyze/orchestrateAnalyzeWriteSection.js.map +1 -1
  18. package/lib/orchestrate/analyze/orchestrateAnalyzeWriteSectionPatch.js +24 -25
  19. package/lib/orchestrate/analyze/orchestrateAnalyzeWriteSectionPatch.js.map +1 -1
  20. package/lib/orchestrate/analyze/orchestrateAnalyzeWriteUnit.js +30 -31
  21. package/lib/orchestrate/analyze/orchestrateAnalyzeWriteUnit.js.map +1 -1
  22. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeExtractDecisionsApplication.d.ts +14 -52
  23. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +23 -96
  24. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioReviewApplication.d.ts +12 -40
  25. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeSectionCrossFileReviewApplication.d.ts +30 -88
  26. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeSectionReviewApplication.d.ts +35 -94
  27. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteSectionApplication.d.ts +23 -93
  28. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteUnitApplication.d.ts +15 -88
  29. package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistory.js +76 -31
  30. package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistory.js.map +1 -1
  31. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +7 -7
  32. package/lib/orchestrate/common/structures/IAnalysisSectionEntry.d.ts +2 -8
  33. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.d.ts +8 -50
  34. package/lib/orchestrate/common/structures/IAutoBePreliminaryCollection.d.ts +1 -9
  35. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetAnalysisSections.d.ts +4 -23
  36. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetDatabaseSchemas.d.ts +3 -21
  37. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceOperations.d.ts +4 -22
  38. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceSchemas.d.ts +4 -22
  39. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPreviousAnalysisSections.d.ts +5 -17
  40. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPreviousDatabaseSchemas.d.ts +7 -76
  41. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPreviousInterfaceOperations.d.ts +6 -89
  42. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPreviousInterfaceSchemas.d.ts +7 -93
  43. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetRealizeCollectors.d.ts +3 -22
  44. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetRealizeTransformers.d.ts +3 -22
  45. package/lib/orchestrate/interface/orchestrateInterfaceAuthorization.js +114 -139
  46. package/lib/orchestrate/interface/orchestrateInterfaceAuthorization.js.map +1 -1
  47. package/lib/orchestrate/interface/orchestrateInterfaceEndpointReview.js +90 -91
  48. package/lib/orchestrate/interface/orchestrateInterfaceEndpointReview.js.map +1 -1
  49. package/lib/orchestrate/interface/orchestrateInterfaceEndpointWrite.js +58 -59
  50. package/lib/orchestrate/interface/orchestrateInterfaceEndpointWrite.js.map +1 -1
  51. package/lib/orchestrate/interface/orchestrateInterfaceGroup.js +58 -59
  52. package/lib/orchestrate/interface/orchestrateInterfaceGroup.js.map +1 -1
  53. package/lib/orchestrate/interface/orchestrateInterfaceOperation.js +108 -132
  54. package/lib/orchestrate/interface/orchestrateInterfaceOperation.js.map +1 -1
  55. package/lib/orchestrate/interface/orchestrateInterfaceOperationReview.js +72 -72
  56. package/lib/orchestrate/interface/orchestrateInterfacePrerequisite.js +76 -77
  57. package/lib/orchestrate/interface/orchestrateInterfacePrerequisite.js.map +1 -1
  58. package/lib/orchestrate/interface/orchestrateInterfaceSchemaCasting.js +130 -159
  59. package/lib/orchestrate/interface/orchestrateInterfaceSchemaCasting.js.map +1 -1
  60. package/lib/orchestrate/interface/orchestrateInterfaceSchemaComplement.js +126 -155
  61. package/lib/orchestrate/interface/orchestrateInterfaceSchemaComplement.js.map +1 -1
  62. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRefine.js +114 -142
  63. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRefine.js.map +1 -1
  64. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +5 -5
  65. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js +100 -129
  66. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -1
  67. package/lib/orchestrate/interface/orchestrateInterfaceSchemaWrite.js +120 -149
  68. package/lib/orchestrate/interface/orchestrateInterfaceSchemaWrite.js.map +1 -1
  69. package/lib/orchestrate/interface/structures/IAutoBeInterfaceAuthorizationApplication.d.ts +10 -97
  70. package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointReviewApplication.d.ts +14 -83
  71. package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointWriteApplication.d.ts +12 -90
  72. package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +12 -80
  73. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +21 -116
  74. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationReviewApplication.d.ts +24 -112
  75. package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisiteApplication.d.ts +11 -83
  76. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +11 -76
  77. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaCastingApplication.d.ts +18 -96
  78. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaComplementApplication.d.ts +11 -76
  79. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRefineApplication.d.ts +25 -107
  80. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.d.ts +5 -31
  81. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaReviewApplication.d.ts +6 -42
  82. package/lib/orchestrate/interface/utils/AutoBeJsonSchemaValidator.js +283 -283
  83. package/lib/orchestrate/prisma/orchestratePrismaAuthorization.js +41 -41
  84. package/lib/orchestrate/prisma/orchestratePrismaAuthorizationReview.js +62 -63
  85. package/lib/orchestrate/prisma/orchestratePrismaAuthorizationReview.js.map +1 -1
  86. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +40 -41
  87. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  88. package/lib/orchestrate/prisma/orchestratePrismaComponentReview.js +60 -61
  89. package/lib/orchestrate/prisma/orchestratePrismaComponentReview.js.map +1 -1
  90. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +112 -116
  91. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  92. package/lib/orchestrate/prisma/orchestratePrismaGroup.js +48 -49
  93. package/lib/orchestrate/prisma/orchestratePrismaGroup.js.map +1 -1
  94. package/lib/orchestrate/prisma/orchestratePrismaGroupReview.js +70 -71
  95. package/lib/orchestrate/prisma/orchestratePrismaGroupReview.js.map +1 -1
  96. package/lib/orchestrate/prisma/orchestratePrismaSchema.js +118 -122
  97. package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -1
  98. package/lib/orchestrate/prisma/orchestratePrismaSchemaReview.js +126 -131
  99. package/lib/orchestrate/prisma/orchestratePrismaSchemaReview.js.map +1 -1
  100. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseAuthorizationApplication.d.ts +22 -99
  101. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseAuthorizationReviewApplication.d.ts +12 -109
  102. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseComponentApplication.d.ts +14 -100
  103. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseComponentReviewApplication.d.ts +15 -108
  104. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseCorrectApplication.d.ts +24 -106
  105. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseGroupApplication.d.ts +13 -76
  106. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseGroupReviewApplication.d.ts +13 -111
  107. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseSchemaApplication.d.ts +26 -97
  108. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseSchemaReviewApplication.d.ts +16 -93
  109. package/lib/orchestrate/realize/histories/transformRealizeOperationCorrectHistory.js +1 -1
  110. package/lib/orchestrate/realize/histories/transformRealizeOperationCorrectHistory.js.map +1 -1
  111. package/lib/orchestrate/realize/histories/transformRealizeOperationWriteHistory.js +1 -1
  112. package/lib/orchestrate/realize/histories/transformRealizeOperationWriteHistory.js.map +1 -1
  113. package/lib/orchestrate/realize/histories/transformRealizeTransformerCorrectHistory.js +20 -2
  114. package/lib/orchestrate/realize/histories/transformRealizeTransformerCorrectHistory.js.map +1 -1
  115. package/lib/orchestrate/realize/histories/transformRealizeTransformerWriteHistory.js +22 -2
  116. package/lib/orchestrate/realize/histories/transformRealizeTransformerWriteHistory.js.map +1 -1
  117. package/lib/orchestrate/realize/internal/orchestrateRealizeCorrectCasting.js +7 -7
  118. package/lib/orchestrate/realize/internal/orchestrateRealizeCorrectOverall.js +86 -6
  119. package/lib/orchestrate/realize/internal/orchestrateRealizeCorrectOverall.js.map +1 -1
  120. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +38 -38
  121. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationWrite.js +34 -34
  122. package/lib/orchestrate/realize/orchestrateRealizeCollectorCorrectOverall.js +38 -38
  123. package/lib/orchestrate/realize/orchestrateRealizeCollectorPlan.js +54 -54
  124. package/lib/orchestrate/realize/orchestrateRealizeCollectorWrite.js +36 -36
  125. package/lib/orchestrate/realize/orchestrateRealizeOperationCorrectOverall.js +44 -44
  126. package/lib/orchestrate/realize/orchestrateRealizeOperationWrite.js +42 -42
  127. package/lib/orchestrate/realize/orchestrateRealizeTransformerCorrectCasting.js +1 -0
  128. package/lib/orchestrate/realize/orchestrateRealizeTransformerCorrectCasting.js.map +1 -1
  129. package/lib/orchestrate/realize/orchestrateRealizeTransformerCorrectOverall.js +46 -46
  130. package/lib/orchestrate/realize/orchestrateRealizeTransformerPlan.js +36 -36
  131. package/lib/orchestrate/realize/orchestrateRealizeTransformerWrite.js +44 -44
  132. package/lib/orchestrate/realize/programmers/AutoBeRealizeTransformerProgrammer.d.ts +18 -0
  133. package/lib/orchestrate/realize/programmers/AutoBeRealizeTransformerProgrammer.js +167 -8
  134. package/lib/orchestrate/realize/programmers/AutoBeRealizeTransformerProgrammer.js.map +1 -1
  135. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +17 -71
  136. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationWriteApplication.d.ts +32 -92
  137. package/lib/orchestrate/realize/structures/IAutoBeRealizeCollectorCorrectApplication.d.ts +32 -114
  138. package/lib/orchestrate/realize/structures/IAutoBeRealizeCollectorPlanApplication.d.ts +29 -106
  139. package/lib/orchestrate/realize/structures/IAutoBeRealizeCollectorWriteApplication.d.ts +38 -131
  140. package/lib/orchestrate/realize/structures/IAutoBeRealizeOperationCorrectApplication.d.ts +16 -71
  141. package/lib/orchestrate/realize/structures/IAutoBeRealizeOperationWriteApplication.d.ts +16 -73
  142. package/lib/orchestrate/realize/structures/IAutoBeRealizeTransformerCorrectApplication.d.ts +37 -155
  143. package/lib/orchestrate/realize/structures/IAutoBeRealizeTransformerPlanApplication.d.ts +25 -88
  144. package/lib/orchestrate/realize/structures/IAutoBeRealizeTransformerWriteApplication.d.ts +48 -181
  145. package/lib/orchestrate/realize/utils/generateTS2339Hints.d.ts +5 -3
  146. package/lib/orchestrate/realize/utils/generateTS2339Hints.js +37 -19
  147. package/lib/orchestrate/realize/utils/generateTS2339Hints.js.map +1 -1
  148. package/lib/orchestrate/test/histories/transformTestOperationWriteHistory.js +2 -2
  149. package/lib/orchestrate/test/orchestrateTestScenario.js +22 -22
  150. package/lib/orchestrate/test/orchestrateTestScenarioReview.js +22 -22
  151. package/package.json +5 -5
  152. package/src/AutoBeMockAgent.ts +283 -283
  153. package/src/constants/AutoBeSystemPromptConstant.ts +5 -4
  154. package/src/describe/image/structures/IAutoBeImageDescribeDraftApplication.ts +12 -63
  155. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeExtractDecisionsApplication.ts +14 -52
  156. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +23 -96
  157. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioReviewApplication.ts +12 -40
  158. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeSectionCrossFileReviewApplication.ts +30 -88
  159. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeSectionReviewApplication.ts +35 -94
  160. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteSectionApplication.ts +23 -93
  161. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteUnitApplication.ts +15 -88
  162. package/src/orchestrate/common/histories/transformPreviousAndLatestCorrectHistory.ts +92 -31
  163. package/src/orchestrate/common/structures/IAnalysisSectionEntry.ts +2 -8
  164. package/src/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.ts +8 -50
  165. package/src/orchestrate/common/structures/IAutoBePreliminaryCollection.ts +1 -9
  166. package/src/orchestrate/common/structures/IAutoBePreliminaryGetAnalysisSections.ts +4 -23
  167. package/src/orchestrate/common/structures/IAutoBePreliminaryGetDatabaseSchemas.ts +3 -21
  168. package/src/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceOperations.ts +4 -22
  169. package/src/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceSchemas.ts +4 -22
  170. package/src/orchestrate/common/structures/IAutoBePreliminaryGetPreviousAnalysisSections.ts +5 -17
  171. package/src/orchestrate/common/structures/IAutoBePreliminaryGetPreviousDatabaseSchemas.ts +7 -76
  172. package/src/orchestrate/common/structures/IAutoBePreliminaryGetPreviousInterfaceOperations.ts +6 -89
  173. package/src/orchestrate/common/structures/IAutoBePreliminaryGetPreviousInterfaceSchemas.ts +7 -93
  174. package/src/orchestrate/common/structures/IAutoBePreliminaryGetRealizeCollectors.ts +3 -22
  175. package/src/orchestrate/common/structures/IAutoBePreliminaryGetRealizeTransformers.ts +3 -22
  176. package/src/orchestrate/interface/orchestrateInterfaceSchemaRefine.ts +291 -291
  177. package/src/orchestrate/interface/orchestrateInterfaceSchemaReview.ts +309 -309
  178. package/src/orchestrate/interface/structures/IAutoBeInterfaceAuthorizationApplication.ts +10 -97
  179. package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointReviewApplication.ts +14 -83
  180. package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointWriteApplication.ts +12 -90
  181. package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +12 -80
  182. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +21 -116
  183. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationReviewApplication.ts +24 -112
  184. package/src/orchestrate/interface/structures/IAutoBeInterfacePrerequisiteApplication.ts +11 -83
  185. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +11 -76
  186. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaCastingApplication.ts +18 -96
  187. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaComplementApplication.ts +11 -76
  188. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRefineApplication.ts +25 -107
  189. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.ts +5 -31
  190. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaReviewApplication.ts +6 -42
  191. package/src/orchestrate/interface/utils/AutoBeJsonSchemaValidator.ts +763 -763
  192. package/src/orchestrate/prisma/structures/IAutoBeDatabaseAuthorizationApplication.ts +22 -99
  193. package/src/orchestrate/prisma/structures/IAutoBeDatabaseAuthorizationReviewApplication.ts +12 -109
  194. package/src/orchestrate/prisma/structures/IAutoBeDatabaseComponentApplication.ts +14 -100
  195. package/src/orchestrate/prisma/structures/IAutoBeDatabaseComponentReviewApplication.ts +15 -108
  196. package/src/orchestrate/prisma/structures/IAutoBeDatabaseCorrectApplication.ts +24 -106
  197. package/src/orchestrate/prisma/structures/IAutoBeDatabaseGroupApplication.ts +13 -76
  198. package/src/orchestrate/prisma/structures/IAutoBeDatabaseGroupReviewApplication.ts +13 -111
  199. package/src/orchestrate/prisma/structures/IAutoBeDatabaseSchemaApplication.ts +26 -97
  200. package/src/orchestrate/prisma/structures/IAutoBeDatabaseSchemaReviewApplication.ts +16 -93
  201. package/src/orchestrate/realize/histories/transformRealizeTransformerCorrectHistory.ts +21 -1
  202. package/src/orchestrate/realize/histories/transformRealizeTransformerWriteHistory.ts +26 -4
  203. package/src/orchestrate/realize/internal/orchestrateRealizeCorrectOverall.ts +125 -9
  204. package/src/orchestrate/realize/orchestrateRealizeTransformerCorrectCasting.ts +1 -0
  205. package/src/orchestrate/realize/programmers/AutoBeRealizeTransformerProgrammer.ts +210 -7
  206. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +17 -71
  207. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationWriteApplication.ts +32 -92
  208. package/src/orchestrate/realize/structures/IAutoBeRealizeCollectorCorrectApplication.ts +32 -114
  209. package/src/orchestrate/realize/structures/IAutoBeRealizeCollectorPlanApplication.ts +29 -106
  210. package/src/orchestrate/realize/structures/IAutoBeRealizeCollectorWriteApplication.ts +38 -131
  211. package/src/orchestrate/realize/structures/IAutoBeRealizeOperationCorrectApplication.ts +16 -71
  212. package/src/orchestrate/realize/structures/IAutoBeRealizeOperationWriteApplication.ts +16 -73
  213. package/src/orchestrate/realize/structures/IAutoBeRealizeTransformerCorrectApplication.ts +37 -155
  214. package/src/orchestrate/realize/structures/IAutoBeRealizeTransformerPlanApplication.ts +25 -88
  215. package/src/orchestrate/realize/structures/IAutoBeRealizeTransformerWriteApplication.ts +48 -181
  216. package/src/orchestrate/realize/utils/generateTS2339Hints.ts +39 -19
  217. package/src/orchestrate/test/experimental/orchestrateTestCorrect.ast +237 -237
  218. package/src/orchestrate/test/experimental/orchestrateTestWrite.ast +322 -322
  219. package/src/orchestrate/test/experimental/transformTestCorrectHistories.ast +52 -52
  220. package/src/structures/IAutoBeVendor.ts +127 -127
  221. package/README.md +0 -261
@@ -1,322 +1,322 @@
1
- import {
2
- AgenticaSystemPrompt,
3
- IAgenticaController,
4
- MicroAgentica,
5
- } from "@agentica/core";
6
- import {
7
- AutoBeOpenApi,
8
- AutoBeTest,
9
- AutoBeTestScenario,
10
- AutoBeTestWriteEvent,
11
- } from "@autobe/interface";
12
- import {
13
- AutoBeEndpointComparator,
14
- IAutoBeTextValidateContext,
15
- validateTestFunction,
16
- } from "@autobe/utils";
17
- import {
18
- ILlmApplication,
19
- ILlmSchema,
20
- IValidation,
21
- OpenApi,
22
- OpenApiTypeChecker,
23
- } from "@samchon/openapi";
24
- import { HashMap, IPointer, Pair } from "tstl";
25
- import typia, { IJsonSchemaUnit } from "typia";
26
-
27
- import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
28
- import { AutoBeContext } from "../../context/AutoBeContext";
29
- import { assertSchemaModel } from "../../context/assertSchemaModel";
30
- import { enforceToolCall } from "../../utils/enforceToolCall";
31
- import { compileTestScenario } from "./compile/compileTestScenario";
32
- import { IAutoBeTestScenarioArtifacts } from "./structures/IAutoBeTestScenarioArtifacts";
33
- import { IAutoBeTestWriteResult } from "./structures/IAutoBeTestWriteResult";
34
- import { transformTestWriteHistories } from "./transformTestWriteHistories";
35
-
36
- export async function orchestrateTestWrite<Model extends ILlmSchema.Model>(
37
- ctx: AutoBeContext<Model>,
38
- scenarios: AutoBeTestScenario[],
39
- life: number = 4,
40
- ): Promise<IAutoBeTestWriteResult[]> {
41
- const start: Date = new Date();
42
- let complete: number = 0;
43
-
44
- const writes: Array<IAutoBeTestWriteResult | null> = await Promise.all(
45
- /**
46
- * Generate test code for each scenario. Maps through plans array to create
47
- * individual test code implementations. Each scenario is processed to
48
- * generate corresponding test code and progress events.
49
- */
50
- scenarios.map(
51
- async (
52
- scenario: AutoBeTestScenario,
53
- ): Promise<IAutoBeTestWriteResult | null> => {
54
- const artifacts: IAutoBeTestScenarioArtifacts =
55
- await compileTestScenario(ctx, scenario);
56
- const result: ICreateTestCodeProps | null = await (async () => {
57
- try {
58
- return await process(ctx, scenario, artifacts, life, null);
59
- } catch {
60
- return null;
61
- }
62
- })();
63
- if (result === null) return null;
64
-
65
- const event: AutoBeTestWriteEvent = {
66
- type: "testWrite",
67
- created_at: start.toISOString(),
68
- file: {
69
- location: `test/features/api/${result.domain}/${scenario.functionName}.ts`,
70
- function: result.function,
71
- content: await ctx.compiler.test.write({
72
- scenario,
73
- document: ctx.state().interface!.document,
74
- function: result.function,
75
- }),
76
- scenario,
77
- },
78
- completed: ++complete,
79
- total: scenarios.length,
80
- step: ctx.state().interface?.step ?? 0,
81
- };
82
- ctx.dispatch(event);
83
- return {
84
- artifacts,
85
- file: event.file,
86
- };
87
- },
88
- ),
89
- );
90
- return writes.filter((w) => w !== null);
91
- }
92
-
93
- /**
94
- * Process function that generates test code for each individual scenario. Takes
95
- * the AutoBeContext and scenario information as input and uses MicroAgentica to
96
- * generate appropriate test code through LLM interaction.
97
- *
98
- * @param ctx - The AutoBeContext containing model, vendor and configuration
99
- * @param scenario - The test scenario information to generate code for
100
- * @param artifacts - The artifacts containing the reference files and schemas
101
- * @returns Promise resolving to ICreateTestCodeProps containing the generated
102
- * test code
103
- */
104
- async function process<Model extends ILlmSchema.Model>(
105
- ctx: AutoBeContext<Model>,
106
- scenario: AutoBeTestScenario,
107
- artifacts: IAutoBeTestScenarioArtifacts,
108
- life: number,
109
- failure: IValidation.IFailure | null,
110
- ): Promise<ICreateTestCodeProps | null> {
111
- // function calling
112
- const trials: IValidation.IFailure[] = [];
113
- const pointer: IPointer<ICreateTestCodeProps | null> = {
114
- value: null,
115
- };
116
- const agentica = new MicroAgentica({
117
- model: ctx.model,
118
- vendor: ctx.vendor,
119
- config: {
120
- ...(ctx.config ?? {}),
121
- executor: {
122
- describe: null,
123
- },
124
- systemPrompt: {
125
- validate: (events) =>
126
- [
127
- AgenticaSystemPrompt.VALIDATE_REPEATED.replace(
128
- "${{HISTORICAL_ERRORS}}",
129
- JSON.stringify(events.map((e) => e.result.errors)),
130
- ),
131
- AutoBeSystemPromptConstant.TEST_VALIDATE.replace(
132
- "${{AutoBeTest.IStatement}}",
133
- getUnionTypeName(typia.json.schema<AutoBeTest.IStatement>()),
134
- ).replace(
135
- "${{AutoBeTest.IExpression}}",
136
- getUnionTypeName(typia.json.schema<AutoBeTest.IExpression>()),
137
- ),
138
- ].join("\n\n"),
139
- },
140
- retry: 4,
141
- throw: true,
142
- },
143
- histories: transformTestWriteHistories({
144
- scenario,
145
- artifacts,
146
- failure,
147
- }),
148
- controllers: [
149
- createController({
150
- model: ctx.model,
151
- document: ctx.state().interface!.document,
152
- build: (next) => {
153
- pointer.value = next;
154
- },
155
- }),
156
- ],
157
- });
158
- enforceToolCall(agentica);
159
- agentica.on("validate", (e) => {
160
- trials.push(e.result);
161
- });
162
-
163
- await agentica.conversate("Create e2e test functions.").finally(() => {
164
- const tokenUsage = agentica.getTokenUsage();
165
- ctx.usage().record(tokenUsage, ["test"]);
166
- });
167
- if (pointer.value === null) {
168
- console.log(
169
- "failed to pass validation",
170
- (trials.at(-1)?.data as ICreateTestCodeProps | undefined)?.function.draft,
171
- trials.map((t) => t.errors.map((e) => e.path)),
172
- JSON.stringify(trials.at(-1), null, 2),
173
- );
174
- return null;
175
- }
176
- console.log("Function calling success", trials.length + 1);
177
-
178
- // custom validation by compiler
179
- const document: AutoBeOpenApi.IDocument = ctx.state().interface!.document;
180
- const errors: IValidation.IError[] | null = await ctx.compiler.test.validate({
181
- document,
182
- function: pointer.value.function,
183
- });
184
- return errors === null || life <= 0
185
- ? pointer.value
186
- : process(ctx, scenario, artifacts, --life, {
187
- success: false,
188
- data: pointer.value,
189
- errors,
190
- });
191
- }
192
-
193
- function getUnionTypeName(unit: IJsonSchemaUnit): string {
194
- if (OpenApiTypeChecker.isReference(unit.schema) === false) return "unknown";
195
-
196
- const typeName: string = unit.schema.$ref.split("/").pop() ?? "";
197
- const schema: OpenApi.IJsonSchema | undefined =
198
- unit.components.schemas?.[typeName];
199
- if (schema === undefined || OpenApiTypeChecker.isOneOf(schema) === false)
200
- return "unknown";
201
- return schema.oneOf
202
- .filter(OpenApiTypeChecker.isReference)
203
- .map((r) => r.$ref.split("/").pop() ?? "")
204
- .join(" | ");
205
- }
206
-
207
- function createController<Model extends ILlmSchema.Model>(props: {
208
- model: Model;
209
- document: AutoBeOpenApi.IDocument;
210
- build: (next: ICreateTestCodeProps) => void;
211
- }): IAgenticaController.IClass<Model> {
212
- assertSchemaModel(props.model);
213
-
214
- const endpoints: HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IOperation> =
215
- new HashMap(
216
- props.document.operations.map(
217
- (op) =>
218
- new Pair(
219
- {
220
- method: op.method,
221
- path: op.path,
222
- },
223
- op,
224
- ),
225
- ),
226
- AutoBeEndpointComparator.hashCode,
227
- AutoBeEndpointComparator.equals,
228
- );
229
-
230
- const validate = (input: unknown): IValidation<ICreateTestCodeProps> => {
231
- const result: IValidation<ICreateTestCodeProps> =
232
- typia.validate<ICreateTestCodeProps>(input);
233
- if (result.success === false) return result;
234
-
235
- const context: IAutoBeTextValidateContext = {
236
- function: result.data.function,
237
- document: props.document,
238
- endpoints,
239
- errors: [],
240
- };
241
- validateTestFunction(context);
242
- return context.errors.length === 0
243
- ? result
244
- : {
245
- success: false,
246
- data: result.data,
247
- errors: context.errors,
248
- };
249
- };
250
- const application: ILlmApplication<Model> = collection[
251
- props.model === "chatgpt"
252
- ? "chatgpt"
253
- : props.model === "gemini"
254
- ? "gemini"
255
- : "claude"
256
- ](
257
- validate,
258
- ) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
259
-
260
- return {
261
- protocol: "class",
262
- name: "Create Test Code",
263
- application,
264
- execute: {
265
- createTestCode: (next) => {
266
- props.build(next);
267
- },
268
- } satisfies IApplication,
269
- };
270
- }
271
-
272
- const collection = {
273
- chatgpt: (validate: Validator) =>
274
- typia.llm.application<IApplication, "chatgpt">({
275
- validate: {
276
- createTestCode: validate,
277
- },
278
- }),
279
- claude: (validate: Validator) =>
280
- typia.llm.application<IApplication, "claude">({
281
- validate: {
282
- createTestCode: validate,
283
- },
284
- }),
285
- };
286
-
287
- type Validator = (input: unknown) => IValidation<ICreateTestCodeProps>;
288
-
289
- interface IApplication {
290
- createTestCode(props: ICreateTestCodeProps): void;
291
- }
292
-
293
- interface ICreateTestCodeProps {
294
- /**
295
- * Functional domain classification for test organization.
296
- *
297
- * Determines file structure and test categorization based on API
298
- * functionality. Used for organizing tests into logical groups and directory
299
- * hierarchies.
300
- *
301
- * ### Naming Rules:
302
- *
303
- * - Lowercase English words only
304
- * - Singular nouns (e.g., "article", "user", "comment")
305
- * - Kebab-case for compound words (e.g., "user-profile", "payment-method")
306
- * - Match primary API resource being tested
307
- * - Domain Name must be named only one word.
308
- *
309
- * ### Domain Examples:
310
- *
311
- * - `article` → Article management operations
312
- * - `comment` → Comment-related functionality
313
- * - `auth` → Authentication and authorization
314
- * - `user` → User management operations
315
- * - `payment` → Payment processing
316
- * - `notification` → Notification system
317
- */
318
- domain: string;
319
-
320
- /** E2E test function implementation. */
321
- function: AutoBeTest.IFunction;
322
- }
1
+ import {
2
+ AgenticaSystemPrompt,
3
+ IAgenticaController,
4
+ MicroAgentica,
5
+ } from "@agentica/core";
6
+ import {
7
+ AutoBeOpenApi,
8
+ AutoBeTest,
9
+ AutoBeTestScenario,
10
+ AutoBeTestWriteEvent,
11
+ } from "@autobe/interface";
12
+ import {
13
+ AutoBeEndpointComparator,
14
+ IAutoBeTextValidateContext,
15
+ validateTestFunction,
16
+ } from "@autobe/utils";
17
+ import {
18
+ ILlmApplication,
19
+ ILlmSchema,
20
+ IValidation,
21
+ OpenApi,
22
+ OpenApiTypeChecker,
23
+ } from "@samchon/openapi";
24
+ import { HashMap, IPointer, Pair } from "tstl";
25
+ import typia, { IJsonSchemaUnit } from "typia";
26
+
27
+ import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
28
+ import { AutoBeContext } from "../../context/AutoBeContext";
29
+ import { assertSchemaModel } from "../../context/assertSchemaModel";
30
+ import { enforceToolCall } from "../../utils/enforceToolCall";
31
+ import { compileTestScenario } from "./compile/compileTestScenario";
32
+ import { IAutoBeTestScenarioArtifacts } from "./structures/IAutoBeTestScenarioArtifacts";
33
+ import { IAutoBeTestWriteResult } from "./structures/IAutoBeTestWriteResult";
34
+ import { transformTestWriteHistories } from "./transformTestWriteHistories";
35
+
36
+ export async function orchestrateTestWrite<Model extends ILlmSchema.Model>(
37
+ ctx: AutoBeContext<Model>,
38
+ scenarios: AutoBeTestScenario[],
39
+ life: number = 4,
40
+ ): Promise<IAutoBeTestWriteResult[]> {
41
+ const start: Date = new Date();
42
+ let complete: number = 0;
43
+
44
+ const writes: Array<IAutoBeTestWriteResult | null> = await Promise.all(
45
+ /**
46
+ * Generate test code for each scenario. Maps through plans array to create
47
+ * individual test code implementations. Each scenario is processed to
48
+ * generate corresponding test code and progress events.
49
+ */
50
+ scenarios.map(
51
+ async (
52
+ scenario: AutoBeTestScenario,
53
+ ): Promise<IAutoBeTestWriteResult | null> => {
54
+ const artifacts: IAutoBeTestScenarioArtifacts =
55
+ await compileTestScenario(ctx, scenario);
56
+ const result: ICreateTestCodeProps | null = await (async () => {
57
+ try {
58
+ return await process(ctx, scenario, artifacts, life, null);
59
+ } catch {
60
+ return null;
61
+ }
62
+ })();
63
+ if (result === null) return null;
64
+
65
+ const event: AutoBeTestWriteEvent = {
66
+ type: "testWrite",
67
+ created_at: start.toISOString(),
68
+ file: {
69
+ location: `test/features/api/${result.domain}/${scenario.functionName}.ts`,
70
+ function: result.function,
71
+ content: await ctx.compiler.test.write({
72
+ scenario,
73
+ document: ctx.state().interface!.document,
74
+ function: result.function,
75
+ }),
76
+ scenario,
77
+ },
78
+ completed: ++complete,
79
+ total: scenarios.length,
80
+ step: ctx.state().interface?.step ?? 0,
81
+ };
82
+ ctx.dispatch(event);
83
+ return {
84
+ artifacts,
85
+ file: event.file,
86
+ };
87
+ },
88
+ ),
89
+ );
90
+ return writes.filter((w) => w !== null);
91
+ }
92
+
93
+ /**
94
+ * Process function that generates test code for each individual scenario. Takes
95
+ * the AutoBeContext and scenario information as input and uses MicroAgentica to
96
+ * generate appropriate test code through LLM interaction.
97
+ *
98
+ * @param ctx - The AutoBeContext containing model, vendor and configuration
99
+ * @param scenario - The test scenario information to generate code for
100
+ * @param artifacts - The artifacts containing the reference files and schemas
101
+ * @returns Promise resolving to ICreateTestCodeProps containing the generated
102
+ * test code
103
+ */
104
+ async function process<Model extends ILlmSchema.Model>(
105
+ ctx: AutoBeContext<Model>,
106
+ scenario: AutoBeTestScenario,
107
+ artifacts: IAutoBeTestScenarioArtifacts,
108
+ life: number,
109
+ failure: IValidation.IFailure | null,
110
+ ): Promise<ICreateTestCodeProps | null> {
111
+ // function calling
112
+ const trials: IValidation.IFailure[] = [];
113
+ const pointer: IPointer<ICreateTestCodeProps | null> = {
114
+ value: null,
115
+ };
116
+ const agentica = new MicroAgentica({
117
+ model: ctx.model,
118
+ vendor: ctx.vendor,
119
+ config: {
120
+ ...(ctx.config ?? {}),
121
+ executor: {
122
+ describe: null,
123
+ },
124
+ systemPrompt: {
125
+ validate: (events) =>
126
+ [
127
+ AgenticaSystemPrompt.VALIDATE_REPEATED.replace(
128
+ "${{HISTORICAL_ERRORS}}",
129
+ JSON.stringify(events.map((e) => e.result.errors)),
130
+ ),
131
+ AutoBeSystemPromptConstant.TEST_VALIDATE.replace(
132
+ "${{AutoBeTest.IStatement}}",
133
+ getUnionTypeName(typia.json.schema<AutoBeTest.IStatement>()),
134
+ ).replace(
135
+ "${{AutoBeTest.IExpression}}",
136
+ getUnionTypeName(typia.json.schema<AutoBeTest.IExpression>()),
137
+ ),
138
+ ].join("\n\n"),
139
+ },
140
+ retry: 4,
141
+ throw: true,
142
+ },
143
+ histories: transformTestWriteHistories({
144
+ scenario,
145
+ artifacts,
146
+ failure,
147
+ }),
148
+ controllers: [
149
+ createController({
150
+ model: ctx.model,
151
+ document: ctx.state().interface!.document,
152
+ build: (next) => {
153
+ pointer.value = next;
154
+ },
155
+ }),
156
+ ],
157
+ });
158
+ enforceToolCall(agentica);
159
+ agentica.on("validate", (e) => {
160
+ trials.push(e.result);
161
+ });
162
+
163
+ await agentica.conversate("Create e2e test functions.").finally(() => {
164
+ const tokenUsage = agentica.getTokenUsage();
165
+ ctx.usage().record(tokenUsage, ["test"]);
166
+ });
167
+ if (pointer.value === null) {
168
+ console.log(
169
+ "failed to pass validation",
170
+ (trials.at(-1)?.data as ICreateTestCodeProps | undefined)?.function.draft,
171
+ trials.map((t) => t.errors.map((e) => e.path)),
172
+ JSON.stringify(trials.at(-1), null, 2),
173
+ );
174
+ return null;
175
+ }
176
+ console.log("Function calling success", trials.length + 1);
177
+
178
+ // custom validation by compiler
179
+ const document: AutoBeOpenApi.IDocument = ctx.state().interface!.document;
180
+ const errors: IValidation.IError[] | null = await ctx.compiler.test.validate({
181
+ document,
182
+ function: pointer.value.function,
183
+ });
184
+ return errors === null || life <= 0
185
+ ? pointer.value
186
+ : process(ctx, scenario, artifacts, --life, {
187
+ success: false,
188
+ data: pointer.value,
189
+ errors,
190
+ });
191
+ }
192
+
193
+ function getUnionTypeName(unit: IJsonSchemaUnit): string {
194
+ if (OpenApiTypeChecker.isReference(unit.schema) === false) return "unknown";
195
+
196
+ const typeName: string = unit.schema.$ref.split("/").pop() ?? "";
197
+ const schema: OpenApi.IJsonSchema | undefined =
198
+ unit.components.schemas?.[typeName];
199
+ if (schema === undefined || OpenApiTypeChecker.isOneOf(schema) === false)
200
+ return "unknown";
201
+ return schema.oneOf
202
+ .filter(OpenApiTypeChecker.isReference)
203
+ .map((r) => r.$ref.split("/").pop() ?? "")
204
+ .join(" | ");
205
+ }
206
+
207
+ function createController<Model extends ILlmSchema.Model>(props: {
208
+ model: Model;
209
+ document: AutoBeOpenApi.IDocument;
210
+ build: (next: ICreateTestCodeProps) => void;
211
+ }): IAgenticaController.IClass<Model> {
212
+ assertSchemaModel(props.model);
213
+
214
+ const endpoints: HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IOperation> =
215
+ new HashMap(
216
+ props.document.operations.map(
217
+ (op) =>
218
+ new Pair(
219
+ {
220
+ method: op.method,
221
+ path: op.path,
222
+ },
223
+ op,
224
+ ),
225
+ ),
226
+ AutoBeEndpointComparator.hashCode,
227
+ AutoBeEndpointComparator.equals,
228
+ );
229
+
230
+ const validate = (input: unknown): IValidation<ICreateTestCodeProps> => {
231
+ const result: IValidation<ICreateTestCodeProps> =
232
+ typia.validate<ICreateTestCodeProps>(input);
233
+ if (result.success === false) return result;
234
+
235
+ const context: IAutoBeTextValidateContext = {
236
+ function: result.data.function,
237
+ document: props.document,
238
+ endpoints,
239
+ errors: [],
240
+ };
241
+ validateTestFunction(context);
242
+ return context.errors.length === 0
243
+ ? result
244
+ : {
245
+ success: false,
246
+ data: result.data,
247
+ errors: context.errors,
248
+ };
249
+ };
250
+ const application: ILlmApplication<Model> = collection[
251
+ props.model === "chatgpt"
252
+ ? "chatgpt"
253
+ : props.model === "gemini"
254
+ ? "gemini"
255
+ : "claude"
256
+ ](
257
+ validate,
258
+ ) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
259
+
260
+ return {
261
+ protocol: "class",
262
+ name: "Create Test Code",
263
+ application,
264
+ execute: {
265
+ createTestCode: (next) => {
266
+ props.build(next);
267
+ },
268
+ } satisfies IApplication,
269
+ };
270
+ }
271
+
272
+ const collection = {
273
+ chatgpt: (validate: Validator) =>
274
+ typia.llm.application<IApplication, "chatgpt">({
275
+ validate: {
276
+ createTestCode: validate,
277
+ },
278
+ }),
279
+ claude: (validate: Validator) =>
280
+ typia.llm.application<IApplication, "claude">({
281
+ validate: {
282
+ createTestCode: validate,
283
+ },
284
+ }),
285
+ };
286
+
287
+ type Validator = (input: unknown) => IValidation<ICreateTestCodeProps>;
288
+
289
+ interface IApplication {
290
+ createTestCode(props: ICreateTestCodeProps): void;
291
+ }
292
+
293
+ interface ICreateTestCodeProps {
294
+ /**
295
+ * Functional domain classification for test organization.
296
+ *
297
+ * Determines file structure and test categorization based on API
298
+ * functionality. Used for organizing tests into logical groups and directory
299
+ * hierarchies.
300
+ *
301
+ * ### Naming Rules:
302
+ *
303
+ * - Lowercase English words only
304
+ * - Singular nouns (e.g., "article", "user", "comment")
305
+ * - Kebab-case for compound words (e.g., "user-profile", "payment-method")
306
+ * - Match primary API resource being tested
307
+ * - Domain Name must be named only one word.
308
+ *
309
+ * ### Domain Examples:
310
+ *
311
+ * - `article` → Article management operations
312
+ * - `comment` → Comment-related functionality
313
+ * - `auth` → Authentication and authorization
314
+ * - `user` → User management operations
315
+ * - `payment` → Payment processing
316
+ * - `notification` → Notification system
317
+ */
318
+ domain: string;
319
+
320
+ /** E2E test function implementation. */
321
+ function: AutoBeTest.IFunction;
322
+ }