@autobe/agent 0.24.1 → 0.25.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 (225) hide show
  1. package/lib/AutoBeMockAgent.js +1 -0
  2. package/lib/AutoBeMockAgent.js.map +1 -1
  3. package/lib/constants/AutoBeSystemPromptConstant.d.ts +19 -18
  4. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  5. package/lib/context/IAutoBeApplication.d.ts +101 -6
  6. package/lib/context/IAutoBeApplicationProps.d.ts +6 -2
  7. package/lib/factory/createAgenticaHistory.js +1 -1
  8. package/lib/factory/createAgenticaHistory.js.map +1 -1
  9. package/lib/factory/createAutoBeApplication.js +80 -90
  10. package/lib/factory/createAutoBeApplication.js.map +1 -1
  11. package/lib/factory/createAutoBeContext.js +8 -8
  12. package/lib/factory/createAutoBeContext.js.map +1 -1
  13. package/lib/factory/getAutoBeGenerated.js +4 -1
  14. package/lib/factory/getAutoBeGenerated.js.map +1 -1
  15. package/lib/factory/getAutoBeRealizeGenerated.d.ts +2 -1
  16. package/lib/factory/getAutoBeRealizeGenerated.js +1 -1
  17. package/lib/factory/getAutoBeRealizeGenerated.js.map +1 -1
  18. package/lib/factory/getCriticalCompiler.js +1 -1
  19. package/lib/factory/getCriticalCompiler.js.map +1 -1
  20. package/lib/index.mjs +2222 -1393
  21. package/lib/index.mjs.map +1 -1
  22. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +5 -1
  23. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
  24. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.d.ts +1 -1
  25. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +18 -3
  26. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  27. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +5 -1
  28. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +19 -7
  29. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  30. package/lib/orchestrate/analyze/orchestrateAnalyze.js +3 -2
  31. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  32. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.d.ts +1 -1
  33. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +2 -2
  34. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  35. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +1 -0
  36. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -2
  37. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  38. package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
  39. package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
  40. package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js +2 -1
  41. package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
  42. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +5 -1
  43. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +20 -7
  44. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  45. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.d.ts +6 -1
  46. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +31 -23
  47. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  48. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.d.ts +6 -1
  49. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +22 -6
  50. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  51. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +1 -1
  52. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
  53. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.d.ts +4 -1
  54. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +26 -5
  55. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  56. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.d.ts +5 -1
  57. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +21 -5
  58. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  59. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +1 -1
  60. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  61. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +5 -1
  62. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +20 -4
  63. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  64. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +1 -1
  65. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  66. package/lib/orchestrate/interface/orchestrateInterface.js +25 -7
  67. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  68. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +1 -1
  69. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +17 -8
  70. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  71. package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +4 -1
  72. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +18 -11
  73. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  74. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.d.ts +6 -1
  75. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +25 -10
  76. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  77. package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +4 -1
  78. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +9 -6
  79. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  80. package/lib/orchestrate/interface/orchestrateInterfaceOperations.d.ts +5 -1
  81. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +33 -17
  82. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  83. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.d.ts +5 -1
  84. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +36 -18
  85. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  86. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +67 -8
  87. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
  88. package/lib/orchestrate/interface/utils/OperationValidator.js +2 -1
  89. package/lib/orchestrate/interface/utils/OperationValidator.js.map +1 -1
  90. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.d.ts +4 -1
  91. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +19 -8
  92. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  93. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
  94. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  95. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.d.ts +6 -1
  96. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +20 -6
  97. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  98. package/lib/orchestrate/prisma/orchestratePrisma.js +3 -3
  99. package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  100. package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -1
  101. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +6 -3
  102. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  103. package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +1 -1
  104. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +12 -6
  105. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  106. package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +1 -1
  107. package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  108. package/lib/orchestrate/{common/histories/transformCommonCorrectDateHistories.d.ts → realize/histories/transformRealizeCorrectCastingHistories.d.ts} +1 -2
  109. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +33 -0
  110. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -0
  111. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +1 -1
  112. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  113. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +1 -1
  114. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  115. package/lib/orchestrate/realize/internal/compileRealizeFiles.js +3 -1
  116. package/lib/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
  117. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js +25 -8
  118. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +1 -1
  119. package/lib/orchestrate/realize/orchestrateRealize.js +12 -8
  120. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  121. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +3 -1
  122. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  123. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +16 -5
  124. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  125. package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -5
  126. package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
  127. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js +1 -0
  128. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -1
  129. package/lib/orchestrate/realize/utils/replaceImportStatements.js +3 -1
  130. package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  131. package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +5 -1
  132. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +11 -7
  133. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  134. package/lib/orchestrate/test/histories/transformTestScenarioHistories.d.ts +7 -1
  135. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +39 -31
  136. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  137. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.d.ts +8 -0
  138. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +119 -0
  139. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -0
  140. package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +5 -1
  141. package/lib/orchestrate/test/histories/transformTestWriteHistories.js +111 -94
  142. package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  143. package/lib/orchestrate/test/orchestrateTest.js +20 -14
  144. package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
  145. package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +4 -1
  146. package/lib/orchestrate/test/orchestrateTestCorrect.js +51 -35
  147. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  148. package/lib/orchestrate/test/orchestrateTestScenario.d.ts +1 -1
  149. package/lib/orchestrate/test/orchestrateTestScenario.js +21 -4
  150. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  151. package/lib/orchestrate/test/orchestrateTestScenarioReview.d.ts +9 -0
  152. package/lib/orchestrate/test/orchestrateTestScenarioReview.js +855 -0
  153. package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -0
  154. package/lib/orchestrate/test/orchestrateTestWrite.d.ts +4 -1
  155. package/lib/orchestrate/test/orchestrateTestWrite.js +9 -4
  156. package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  157. package/lib/orchestrate/test/structures/IAutoBeTestScenarioReviewApplication.d.ts +47 -0
  158. package/lib/orchestrate/{common/structures/IAutoBeCommonCorrectDateApplication.js → test/structures/IAutoBeTestScenarioReviewApplication.js} +1 -1
  159. package/lib/orchestrate/test/structures/IAutoBeTestScenarioReviewApplication.js.map +1 -0
  160. package/package.json +6 -6
  161. package/src/AutoBeMockAgent.ts +1 -0
  162. package/src/constants/AutoBeSystemPromptConstant.ts +19 -18
  163. package/src/context/IAutoBeApplication.ts +101 -6
  164. package/src/context/IAutoBeApplicationProps.ts +6 -2
  165. package/src/factory/createAgenticaHistory.ts +11 -5
  166. package/src/factory/createAutoBeContext.ts +5 -5
  167. package/src/factory/getAutoBeGenerated.ts +3 -0
  168. package/src/factory/getAutoBeRealizeGenerated.ts +3 -1
  169. package/src/factory/getCriticalCompiler.ts +2 -1
  170. package/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts +5 -1
  171. package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +16 -0
  172. package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +22 -7
  173. package/src/orchestrate/analyze/orchestrateAnalyze.ts +3 -2
  174. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +2 -1
  175. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +3 -2
  176. package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +2 -1
  177. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +23 -9
  178. package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +33 -24
  179. package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +26 -9
  180. package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +27 -5
  181. package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +24 -7
  182. package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +23 -6
  183. package/src/orchestrate/interface/orchestrateInterface.ts +29 -10
  184. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +22 -12
  185. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +25 -17
  186. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +35 -23
  187. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +9 -3
  188. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +44 -29
  189. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +51 -32
  190. package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +68 -8
  191. package/src/orchestrate/interface/utils/OperationValidator.ts +2 -1
  192. package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +20 -6
  193. package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +24 -9
  194. package/src/orchestrate/prisma/orchestratePrisma.ts +7 -3
  195. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +5 -1
  196. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +15 -10
  197. package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +45 -0
  198. package/src/orchestrate/realize/internal/compileRealizeFiles.ts +3 -1
  199. package/src/orchestrate/realize/orchestRateRealizeCorrectCasting.ts +30 -8
  200. package/src/orchestrate/realize/orchestrateRealize.ts +36 -40
  201. package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +5 -1
  202. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +38 -16
  203. package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -5
  204. package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +1 -0
  205. package/src/orchestrate/realize/utils/replaceImportStatements.ts +5 -0
  206. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +14 -7
  207. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +44 -36
  208. package/src/orchestrate/test/histories/transformTestScenarioReviewHistories.ts +159 -0
  209. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +35 -12
  210. package/src/orchestrate/test/orchestrateTest.ts +19 -13
  211. package/src/orchestrate/test/orchestrateTestCorrect.ts +65 -46
  212. package/src/orchestrate/test/orchestrateTestScenario.ts +23 -9
  213. package/src/orchestrate/test/orchestrateTestScenarioReview.ts +198 -0
  214. package/src/orchestrate/test/orchestrateTestWrite.ts +13 -4
  215. package/src/orchestrate/test/structures/IAutoBeTestScenarioReviewApplication.ts +52 -0
  216. package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js +0 -48
  217. package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js.map +0 -1
  218. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.d.ts +0 -35
  219. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.js.map +0 -1
  220. package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.d.ts +0 -4
  221. package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js +0 -540
  222. package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js.map +0 -1
  223. package/src/orchestrate/common/histories/transformCommonCorrectDateHistories.ts +0 -60
  224. package/src/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.ts +0 -40
  225. package/src/orchestrate/realize/orchestrateRealizeCorrectDate.ts +0 -372
@@ -0,0 +1,159 @@
1
+ import { IAgenticaHistoryJson } from "@agentica/core";
2
+ import { AutoBeOpenApi } from "@autobe/interface";
3
+ import { StringUtil } from "@autobe/utils";
4
+ import { v7 } from "uuid";
5
+
6
+ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
7
+ import { AutoBeState } from "../../../context/AutoBeState";
8
+ import { IAutoBeTestScenarioApplication } from "../structures/IAutoBeTestScenarioApplication";
9
+ import { getReferenceIds } from "../utils/getReferenceIds";
10
+
11
+ export function transformTestScenarioReviewHistories(props: {
12
+ state: AutoBeState;
13
+ instruction: string;
14
+ groups: IAutoBeTestScenarioApplication.IScenarioGroup[];
15
+ }): Array<
16
+ IAgenticaHistoryJson.ISystemMessage | IAgenticaHistoryJson.IAssistantMessage
17
+ > {
18
+ interface IRelationship {
19
+ endpoint: AutoBeOpenApi.IEndpoint;
20
+ ids: string[];
21
+ }
22
+
23
+ const document: AutoBeOpenApi.IDocument | undefined =
24
+ props.state.interface?.document;
25
+ if (document === undefined) {
26
+ throw new Error(
27
+ "Cannot review test scenarios because there are no operations.",
28
+ );
29
+ }
30
+
31
+ const relationships: IRelationship[] = document.operations
32
+ .map((o) => ({
33
+ endpoint: {
34
+ method: o.method,
35
+ path: o.path,
36
+ },
37
+ ids: getReferenceIds({
38
+ document,
39
+ operation: o,
40
+ }),
41
+ }))
42
+ .filter((v) => v.ids.length !== 0);
43
+
44
+ return [
45
+ {
46
+ id: v7(),
47
+ created_at: new Date().toISOString(),
48
+ type: "systemMessage",
49
+ text: AutoBeSystemPromptConstant.TEST_SCENARIO_REVIEW,
50
+ },
51
+ {
52
+ id: v7(),
53
+ created_at: new Date().toISOString(),
54
+ type: "assistantMessage",
55
+ text: StringUtil.trim`
56
+ ## Instructions
57
+
58
+ The following e2e-test-specific instructions were extracted by AI from
59
+ the user's requirements and conversations. These instructions focus
60
+ exclusively on test-related aspects such as test coverage priorities,
61
+ specific edge cases to validate, business logic verification strategies,
62
+ and critical user workflows that must be tested.
63
+
64
+ Apply these instructions when reviewing test scenarios to ensure the
65
+ tests align with the user's testing requirements and expectations.
66
+ If any instructions are not relevant to the target API operations,
67
+ you may ignore them.
68
+
69
+ ${props.instruction}
70
+
71
+ ## Available API Operations for Reference
72
+
73
+ Below are all available API operations and interface schemas for validation purposes.
74
+ Match each operation with its corresponding schema.
75
+
76
+ \`\`\`json
77
+ ${JSON.stringify({
78
+ operations: document.operations,
79
+ })}
80
+ \`\`\`
81
+
82
+ ## Test Scenario Groups
83
+
84
+ Please review the following test scenario groups:
85
+
86
+ \`\`\`json
87
+ ${JSON.stringify(
88
+ props.groups.map((g) => {
89
+ return {
90
+ ...g,
91
+ scenarios: g.scenarios.map((s) => {
92
+ const requiredId: string[] = [];
93
+
94
+ s.dependencies.forEach((dep) => {
95
+ document.operations.forEach((op) => {
96
+ if (
97
+ g.endpoint.method === op.method &&
98
+ g.endpoint.path === op.path
99
+ ) {
100
+ requiredId.push(
101
+ ...getReferenceIds({ document, operation: op }),
102
+ );
103
+ }
104
+
105
+ if (
106
+ op.method === dep.endpoint.method &&
107
+ op.path === dep.endpoint.path
108
+ ) {
109
+ requiredId.push(
110
+ ...getReferenceIds({ document, operation: op }),
111
+ );
112
+ }
113
+ });
114
+ });
115
+
116
+ return {
117
+ ...s,
118
+ requiredIds:
119
+ requiredId.length > 0
120
+ ? Array.from(new Set(requiredId))
121
+ : [],
122
+ };
123
+ }),
124
+ };
125
+ }),
126
+ )}
127
+ \`\`\`
128
+
129
+ ## Candidate Dependencies
130
+
131
+ List of candidate dependencies extracted from path parameters and request bodies.
132
+
133
+ Apply dependency resolution to the target endpoint from "Included in Test Plan" and to dependencies found recursively from it.
134
+ For each required ID, locate the operation that creates the resource. Include the creator only if that operation exists in the provided operations list. Do not assume or invent operations. If no creator exists, treat the ID as an external or pre-existing input.
135
+
136
+ Dependency resolution steps:
137
+ 1. Starting from the target endpoint, collect required IDs.
138
+ 2. For each ID, search for a creator operation (typically POST).
139
+ 3. If found, add it to the dependency chain in execution order and repeat for its own required IDs.
140
+ 4. Stop when no further creators exist or are needed.
141
+
142
+ For each some_entity_id pattern, use the same approach: include a creator only when it is present in the operations list.
143
+
144
+ Endpoint | Required IDs (MUST be created by other APIs)
145
+ ---------|---------------------------------------------------
146
+ ${relationships
147
+ .map((r) =>
148
+ [
149
+ `\`${r.endpoint.method} ${r.endpoint.path}\``,
150
+ r.ids.map((id) => `\`${id}\``).join(", "),
151
+ ].join(" | "),
152
+ )
153
+ .join("\n")}
154
+
155
+ Example: If an endpoint requires \`articleId\` and \`POST /articles\` exists, include it in dependencies
156
+ `,
157
+ },
158
+ ];
159
+ }
@@ -7,6 +7,7 @@ import {
7
7
  ILlmSchema,
8
8
  OpenApi,
9
9
  } from "@samchon/openapi";
10
+ import { Singleton } from "tstl";
10
11
  import typia from "typia";
11
12
  import { v7 } from "uuid";
12
13
 
@@ -19,8 +20,11 @@ export async function transformTestWriteHistories<
19
20
  Model extends ILlmSchema.Model,
20
21
  >(
21
22
  ctx: AutoBeContext<Model>,
22
- scenario: AutoBeTestScenario,
23
- artifacts: IAutoBeTestScenarioArtifacts,
23
+ props: {
24
+ instruction: string;
25
+ scenario: AutoBeTestScenario;
26
+ artifacts: IAutoBeTestScenarioArtifacts;
27
+ },
24
28
  ): Promise<
25
29
  Array<
26
30
  IAgenticaHistoryJson.ISystemMessage | IAgenticaHistoryJson.IAssistantMessage
@@ -31,10 +35,7 @@ export async function transformTestWriteHistories<
31
35
  id: v7(),
32
36
  created_at: new Date().toISOString(),
33
37
  type: "systemMessage",
34
- text: AutoBeSystemPromptConstant.TEST_WRITE.replace(
35
- "{{AutoBeTestScenario}}",
36
- JSON.stringify(typia.llm.parameters<AutoBeTestScenario, "llama">()),
37
- ),
38
+ text: systemPrompt.get(),
38
39
  },
39
40
  {
40
41
  id: v7(),
@@ -45,16 +46,31 @@ export async function transformTestWriteHistories<
45
46
 
46
47
  Make e2e test functions based on the following information.
47
48
 
49
+ ## Instructions
50
+
51
+ The following e2e-test-specific instructions were extracted by AI from
52
+ the user's requirements and conversations. These instructions focus
53
+ exclusively on test-related aspects such as test data generation strategies,
54
+ assertion patterns, error handling approaches, and specific validation logic
55
+ that should be implemented in the test code.
56
+
57
+ Apply these instructions when implementing the e2e test function to ensure
58
+ the test code aligns with the user's testing requirements and expectations.
59
+ If any instructions are not relevant to the target test scenario,
60
+ you may ignore them.
61
+
62
+ ${props.instruction}
63
+
48
64
  ## Function Name
49
65
 
50
- The e2e test function name must be ${JSON.stringify(scenario.functionName)}.
66
+ The e2e test function name must be ${JSON.stringify(props.scenario.functionName)}.
51
67
 
52
68
  ## Scenario Plan
53
69
 
54
70
  Here is the scenario plan what you have to implement.
55
71
 
56
72
  \`\`\`json
57
- ${JSON.stringify(scenario)}
73
+ ${JSON.stringify(props.scenario)}
58
74
  \`\`\`
59
75
 
60
76
  ## DTO Definitions
@@ -63,7 +79,7 @@ export async function transformTestWriteHistories<
63
79
 
64
80
  Never use the DTO definitions that are not listed here.
65
81
 
66
- ${transformTestWriteHistories.structures(artifacts)}
82
+ ${transformTestWriteHistories.structures(props.artifacts)}
67
83
 
68
84
  ## API (SDK) Functions
69
85
 
@@ -71,14 +87,14 @@ export async function transformTestWriteHistories<
71
87
 
72
88
  Never use the functions that are not listed here.
73
89
 
74
- ${transformTestWriteHistories.functional(artifacts)}
90
+ ${transformTestWriteHistories.functional(props.artifacts)}
75
91
 
76
92
  ## E2E Mockup Functions
77
93
 
78
94
  Just reference, and never follow this code as it is.
79
95
 
80
96
  \`\`\`json
81
- ${JSON.stringify(artifacts.e2e)}
97
+ ${JSON.stringify(props.artifacts.e2e)}
82
98
  \`\`\`
83
99
 
84
100
  ## External Definitions
@@ -103,7 +119,7 @@ export async function transformTestWriteHistories<
103
119
  make your implementation code in the import scope.
104
120
 
105
121
  \`\`\`typescript
106
- ${artifacts.template}
122
+ ${props.artifacts.template}
107
123
  \`\`\`
108
124
  `,
109
125
  },
@@ -144,3 +160,10 @@ export namespace transformTestWriteHistories {
144
160
  `;
145
161
  }
146
162
  }
163
+
164
+ const systemPrompt = new Singleton(() =>
165
+ AutoBeSystemPromptConstant.TEST_WRITE.replace(
166
+ "{{AutoBeTestScenario}}",
167
+ JSON.stringify(typia.llm.parameters<AutoBeTestScenario, "llama">()),
168
+ ),
169
+ );
@@ -38,7 +38,7 @@ export const orchestrateTest =
38
38
  type: "testStart",
39
39
  id: v7(),
40
40
  created_at: start.toISOString(),
41
- reason: props.reason,
41
+ reason: props.instruction,
42
42
  step: ctx.state().analyze?.step ?? 0,
43
43
  });
44
44
 
@@ -57,31 +57,37 @@ export const orchestrateTest =
57
57
  });
58
58
 
59
59
  // PLAN
60
- const scenarios: AutoBeTestScenario[] = await orchestrateTestScenario(ctx);
60
+ const scenarios: AutoBeTestScenario[] = await orchestrateTestScenario(
61
+ ctx,
62
+ props.instruction,
63
+ );
61
64
  if (scenarios.length === 0)
62
65
  throw new Error("No scenarios generated. Please check the logs.");
63
66
 
64
67
  // TEST CODE
65
- const written: IAutoBeTestWriteResult[] = await orchestrateTestWrite(
66
- ctx,
68
+ const written: IAutoBeTestWriteResult[] = await orchestrateTestWrite(ctx, {
69
+ instruction: props.instruction,
67
70
  scenarios,
68
- );
71
+ });
69
72
  if (written.length === 0)
70
73
  throw new Error("No test code written. Please check the logs.");
71
74
 
72
75
  const corrects: AutoBeTestValidateEvent[] = await orchestrateTestCorrect(
73
76
  ctx,
74
- written.map((w) => ({
75
- scenario: w.scenario,
76
- artifacts: w.artifacts,
77
- location: w.event.location,
78
- script: w.event.final ?? w.event.draft,
79
- })),
77
+ {
78
+ instruction: props.instruction,
79
+ functions: written.map((w) => ({
80
+ scenario: w.scenario,
81
+ artifacts: w.artifacts,
82
+ location: w.event.location,
83
+ script: w.event.final ?? w.event.draft,
84
+ })),
85
+ },
80
86
  );
81
87
 
82
88
  // DO COMPILE
83
89
  const compiler: IAutoBeCompiler = await ctx.compiler();
84
- const compiled: IAutoBeTypeScriptCompileResult =
90
+ const compileResult: IAutoBeTypeScriptCompileResult =
85
91
  await compiler.typescript.compile({
86
92
  files: Object.fromEntries([
87
93
  ...Object.entries(
@@ -97,7 +103,7 @@ export const orchestrateTest =
97
103
  id: v7(),
98
104
  created_at: new Date().toISOString(),
99
105
  files: corrects.map((s) => s.file),
100
- compiled,
106
+ compiled: compileResult,
101
107
  step: ctx.state().interface?.step ?? 0,
102
108
  elapsed: new Date().getTime() - start.getTime(),
103
109
  });
@@ -25,11 +25,14 @@ import { IAutoBeTestFunctionFailure } from "./structures/IAutoBeTestFunctionFail
25
25
 
26
26
  export const orchestrateTestCorrect = async <Model extends ILlmSchema.Model>(
27
27
  ctx: AutoBeContext<Model>,
28
- writeResults: IAutoBeTestFunction[],
28
+ props: {
29
+ instruction: string;
30
+ functions: IAutoBeTestFunction[];
31
+ },
29
32
  ): Promise<AutoBeTestValidateEvent[]> => {
30
33
  const result: Array<AutoBeTestValidateEvent | null> =
31
34
  await executeCachedBatch(
32
- writeResults.map((w) => async (promptCacheKey) => {
35
+ props.functions.map((w) => async (promptCacheKey) => {
33
36
  try {
34
37
  const compile = (script: string) =>
35
38
  compileTestFile(ctx, {
@@ -68,10 +71,13 @@ export const orchestrateTestCorrect = async <Model extends ILlmSchema.Model>(
68
71
  );
69
72
  return await predicate(
70
73
  ctx,
71
- transformTestValidateEvent(y, w.artifacts),
72
- [],
73
- y,
74
- promptCacheKey,
74
+ {
75
+ function: transformTestValidateEvent(y, w.artifacts),
76
+ failures: [],
77
+ validate: y,
78
+ promptCacheKey,
79
+ instruction: props.instruction,
80
+ },
75
81
  ctx.retry,
76
82
  );
77
83
  } catch {
@@ -110,44 +116,54 @@ const compileTestFile = async <Model extends ILlmSchema.Model>(
110
116
 
111
117
  const predicate = async <Model extends ILlmSchema.Model>(
112
118
  ctx: AutoBeContext<Model>,
113
- content: IAutoBeTestFunction,
114
- failures: IAutoBeTestFunctionFailure[],
115
- event: AutoBeTestValidateEvent,
116
- promptCacheKey: string,
119
+ props: {
120
+ function: IAutoBeTestFunction;
121
+ failures: IAutoBeTestFunctionFailure[];
122
+ validate: AutoBeTestValidateEvent;
123
+ promptCacheKey: string;
124
+ instruction: string;
125
+ },
117
126
  life: number,
118
127
  ): Promise<AutoBeTestValidateEvent> => {
119
- if (event.result.type === "failure") ctx.dispatch(event);
120
- return event.result.type === "failure"
121
- ? await correct(ctx, content, failures, event, promptCacheKey, life - 1)
122
- : event;
128
+ if (props.validate.result.type === "failure") ctx.dispatch(props.validate);
129
+ return props.validate.result.type === "failure"
130
+ ? await correct(ctx, props, life - 1)
131
+ : props.validate;
123
132
  };
124
133
 
125
134
  const correct = async <Model extends ILlmSchema.Model>(
126
135
  ctx: AutoBeContext<Model>,
127
- content: IAutoBeTestFunction,
128
- failures: IAutoBeTestFunctionFailure[],
129
- validate: AutoBeTestValidateEvent,
130
- promptCacheKey: string,
136
+ props: {
137
+ function: IAutoBeTestFunction;
138
+ failures: IAutoBeTestFunctionFailure[];
139
+ validate: AutoBeTestValidateEvent;
140
+ promptCacheKey: string;
141
+ instruction: string;
142
+ },
131
143
  life: number,
132
144
  ): Promise<AutoBeTestValidateEvent> => {
133
- if (validate.result.type !== "failure") return validate;
134
- else if (life < 0) return validate;
145
+ if (props.validate.result.type !== "failure") return props.validate;
146
+ else if (life < 0) return props.validate;
135
147
 
136
148
  const pointer: IPointer<IAutoBeTestCorrectApplication.IProps | null> = {
137
149
  value: null,
138
150
  };
139
151
  const { tokenUsage } = await ctx.conversate({
140
152
  source: "testCorrect",
141
- histories: await transformTestCorrectHistories(ctx, content, [
142
- ...failures,
143
- {
144
- function: content,
145
- failure: validate.result,
146
- },
147
- ]),
153
+ histories: await transformTestCorrectHistories(ctx, {
154
+ instruction: props.instruction,
155
+ function: props.function,
156
+ failures: [
157
+ ...props.failures,
158
+ {
159
+ function: props.function,
160
+ failure: props.validate.result,
161
+ },
162
+ ],
163
+ }),
148
164
  controller: createController({
149
165
  model: ctx.model,
150
- failure: validate.result,
166
+ failure: props.validate.result,
151
167
  build: (next) => {
152
168
  pointer.value = next;
153
169
  },
@@ -159,18 +175,18 @@ const correct = async <Model extends ILlmSchema.Model>(
159
175
  You don't need to explain me anything, but just fix it immediately
160
176
  without any hesitation, explanation, and questions.
161
177
  `,
162
- promptCacheKey,
178
+ promptCacheKey: props.promptCacheKey,
163
179
  });
164
180
  if (pointer.value === null) throw new Error("Failed to correct test code.");
165
181
 
166
182
  pointer.value.revise.final = await completeTestCode(
167
183
  ctx,
168
- content.artifacts,
184
+ props.function.artifacts,
169
185
  pointer.value.revise.final,
170
186
  );
171
187
  pointer.value.draft = await completeTestCode(
172
188
  ctx,
173
- content.artifacts,
189
+ props.function.artifacts,
174
190
  pointer.value.draft,
175
191
  );
176
192
 
@@ -178,8 +194,8 @@ const correct = async <Model extends ILlmSchema.Model>(
178
194
  type: "testCorrect",
179
195
  id: v7(),
180
196
  created_at: new Date().toISOString(),
181
- file: validate.file,
182
- result: validate.result,
197
+ file: props.validate.file,
198
+ result: props.validate.result,
183
199
  tokenUsage,
184
200
  step: ctx.state().analyze?.step ?? 0,
185
201
  think: pointer.value.think,
@@ -187,26 +203,29 @@ const correct = async <Model extends ILlmSchema.Model>(
187
203
  review: pointer.value.revise?.review,
188
204
  final: pointer.value.revise?.final,
189
205
  } satisfies AutoBeTestCorrectEvent);
190
- const newContent: IAutoBeTestFunction = {
191
- ...content,
206
+ const newFunction: IAutoBeTestFunction = {
207
+ ...props.function,
192
208
  script: pointer.value.revise?.final ?? pointer.value.draft,
193
209
  };
194
210
  const newValidate: AutoBeTestValidateEvent = await compileTestFile(
195
211
  ctx,
196
- newContent,
212
+ newFunction,
197
213
  );
198
214
  return predicate(
199
215
  ctx,
200
- newContent,
201
- [
202
- ...failures,
203
- {
204
- function: content,
205
- failure: validate.result,
206
- },
207
- ],
208
- newValidate,
209
- promptCacheKey,
216
+ {
217
+ function: newFunction,
218
+ failures: [
219
+ ...props.failures,
220
+ {
221
+ function: props.function,
222
+ failure: props.validate.result,
223
+ },
224
+ ],
225
+ validate: newValidate,
226
+ promptCacheKey: props.promptCacheKey,
227
+ instruction: props.instruction,
228
+ },
210
229
  life,
211
230
  );
212
231
  };
@@ -17,11 +17,13 @@ import { assertSchemaModel } from "../../context/assertSchemaModel";
17
17
  import { divideArray } from "../../utils/divideArray";
18
18
  import { executeCachedBatch } from "../../utils/executeCachedBatch";
19
19
  import { transformTestScenarioHistories } from "./histories/transformTestScenarioHistories";
20
+ import { orchestrateTestScenarioReview } from "./orchestrateTestScenarioReview";
20
21
  import { IAutoBeTestScenarioApplication } from "./structures/IAutoBeTestScenarioApplication";
21
22
  import { IAutoBeTestScenarioAuthorizationRole } from "./structures/IAutoBeTestScenarioAuthorizationRole";
22
23
 
23
24
  export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
24
25
  ctx: AutoBeContext<Model>,
26
+ instruction: string,
25
27
  ): Promise<AutoBeTestScenario[]> {
26
28
  const document: AutoBeOpenApi.IDocument | undefined =
27
29
  ctx.state().interface?.document;
@@ -31,8 +33,6 @@ export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
31
33
  );
32
34
  }
33
35
 
34
- Object.entries(document.components.schemas);
35
-
36
36
  const dict: HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IOperation> =
37
37
  new HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IOperation>(
38
38
  document.operations.map(
@@ -63,6 +63,10 @@ export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
63
63
  total: document.operations.length,
64
64
  completed: 0,
65
65
  };
66
+ const reviewProgress: AutoBeProgressEventBase = {
67
+ total: document.operations.length,
68
+ completed: 0,
69
+ };
66
70
  const exclude: IAutoBeTestScenarioApplication.IScenarioGroup[] = [];
67
71
  let include: AutoBeOpenApi.IOperation[] = [...document.operations];
68
72
  let trial: number = 0;
@@ -82,7 +86,9 @@ export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
82
86
  include,
83
87
  exclude: exclude.map((x) => x.endpoint),
84
88
  progress,
89
+ reviewProgress,
85
90
  promptCacheKey,
91
+ instruction,
86
92
  })),
87
93
  );
88
94
  }),
@@ -99,6 +105,7 @@ export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
99
105
  return true;
100
106
  });
101
107
  progress.total = include.length + exclude.length;
108
+ reviewProgress.total = include.length + exclude.length;
102
109
  } while (include.length > 0 && ++trial < ctx.retry);
103
110
 
104
111
  return exclude.flatMap((pg) => {
@@ -122,7 +129,9 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
122
129
  include: AutoBeOpenApi.IOperation[];
123
130
  exclude: AutoBeOpenApi.IEndpoint[];
124
131
  progress: AutoBeProgressEventBase;
132
+ reviewProgress: AutoBeProgressEventBase;
125
133
  promptCacheKey: string;
134
+ instruction: string;
126
135
  },
127
136
  ): Promise<IAutoBeTestScenarioApplication.IScenarioGroup[]> => {
128
137
  const pointer: IPointer<IAutoBeTestScenarioApplication.IScenarioGroup[]> = {
@@ -134,12 +143,13 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
134
143
  try {
135
144
  const { tokenUsage } = await ctx.conversate({
136
145
  source: "testScenarios",
137
- histories: transformTestScenarioHistories(
138
- ctx.state(),
139
- props.document,
140
- props.include,
141
- props.exclude,
142
- ),
146
+ histories: transformTestScenarioHistories({
147
+ state: ctx.state(),
148
+ document: props.document,
149
+ include: props.include,
150
+ exclude: props.exclude,
151
+ instruction: props.instruction,
152
+ }),
143
153
  controller: createController({
144
154
  model: ctx.model,
145
155
  endpointNotFound: props.endpointNotFound,
@@ -187,7 +197,11 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
187
197
  step: ctx.state().interface?.step ?? 0,
188
198
  created_at: new Date().toISOString(),
189
199
  });
190
- return pointer.value;
200
+ return await orchestrateTestScenarioReview(ctx, {
201
+ instruction: props.instruction,
202
+ groups: pointer.value,
203
+ progress: props.reviewProgress,
204
+ });
191
205
  } catch {
192
206
  return [];
193
207
  }