@autobe/agent 0.9.1 → 0.10.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.
- package/lib/AutoBeAgent.js +16 -5
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +6 -4
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/AutoBeTokenUsage.d.ts +15 -1
- package/lib/context/AutoBeTokenUsage.js +56 -1
- package/lib/context/AutoBeTokenUsage.js.map +1 -1
- package/lib/context/IAutoBeApplicationProps.d.ts +0 -61
- package/lib/factory/createAutoBeApplication.js +298 -773
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/index.mjs +5116 -7271
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js +82 -319
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js +0 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +97 -294
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js +2 -2
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/orchestrate/index.d.ts +2 -2
- package/lib/orchestrate/index.js +4 -4
- package/lib/orchestrate/index.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +9 -3
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +56 -142
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +195 -199
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +75 -172
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +772 -1097
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/transformInterfaceHistories.js +2 -0
- package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +64 -175
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +552 -1073
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js +571 -1119
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +9 -0
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +8 -0
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.d.ts +11 -0
- package/lib/orchestrate/realize/orchestrateRealize.js +109 -0
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.d.ts +25 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js +337 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeIntegrator.d.ts +52 -0
- package/lib/orchestrate/realize/orchestrateRealizeIntegrator.js +57 -0
- package/lib/orchestrate/realize/orchestrateRealizeIntegrator.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizePlanner.d.ts +80 -0
- package/lib/orchestrate/realize/orchestrateRealizePlanner.js +53 -0
- package/lib/orchestrate/realize/orchestrateRealizePlanner.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeValidator.d.ts +46 -0
- package/lib/orchestrate/realize/orchestrateRealizeValidator.js +37 -0
- package/lib/orchestrate/realize/orchestrateRealizeValidator.js.map +1 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +33 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js +3 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js.map +1 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.d.ts +5 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js +127 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js.map +1 -0
- package/lib/orchestrate/test/compile/completeTestCode.d.ts +2 -0
- package/lib/orchestrate/test/compile/completeTestCode.js +21 -0
- package/lib/orchestrate/test/compile/completeTestCode.js.map +1 -0
- package/lib/orchestrate/test/{filterTestFileName.js → compile/filterTestFileName.js} +1 -1
- package/lib/orchestrate/test/compile/filterTestFileName.js.map +1 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.d.ts +3 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.js +27 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -0
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +5 -0
- package/lib/orchestrate/test/{compileTestScenario.js → compile/getTestScenarioArtifacts.js} +11 -5
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -0
- package/lib/orchestrate/test/orchestrateTest.js +14 -9
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +3 -2
- package/lib/orchestrate/test/orchestrateTestCorrect.js +150 -349
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +323 -566
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.d.ts +3 -2
- package/lib/orchestrate/test/orchestrateTestWrite.js +139 -76
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +121 -0
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.js +3 -0
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.js.map +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestFunction.d.ts +8 -0
- package/lib/{utils/types/BackoffOptions.js → orchestrate/test/structures/IAutoBeTestFunction.js} +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestFunction.js.map +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +32 -22
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +2 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +112 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.js +3 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.js.map +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.d.ts +7 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.js +3 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.js.map +1 -0
- package/lib/orchestrate/test/transformTestCorrectHistories.d.ts +3 -2
- package/lib/orchestrate/test/transformTestCorrectHistories.js +28 -41
- package/lib/orchestrate/test/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/transformTestWriteHistories.d.ts +5 -4
- package/lib/orchestrate/test/transformTestWriteHistories.js +169 -32
- package/lib/orchestrate/test/transformTestWriteHistories.js.map +1 -1
- package/lib/structures/IAutoBeConfig.d.ts +11 -0
- package/lib/structures/IAutoBeProps.d.ts +12 -1
- package/lib/utils/backoffRetry.d.ts +4 -7
- package/lib/utils/backoffRetry.js +19 -37
- package/lib/utils/backoffRetry.js.map +1 -1
- package/lib/utils/forceRetry.d.ts +1 -0
- package/lib/{orchestrate/orchestrateRealize.js → utils/forceRetry.js} +15 -8
- package/lib/utils/forceRetry.js.map +1 -0
- package/package.json +8 -8
- package/src/AutoBeAgent.ts +26 -4
- package/src/constants/AutoBeSystemPromptConstant.ts +6 -4
- package/src/context/AutoBeTokenUsage.ts +85 -1
- package/src/context/IAutoBeApplicationProps.ts +0 -62
- package/src/factory/createAutoBeApplication.ts +2 -3
- package/src/orchestrate/analyze/AutoBeAnalyzeAgent.ts +8 -3
- package/src/orchestrate/analyze/AutoBeAnalyzeReviewer.ts +0 -1
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +8 -37
- package/src/orchestrate/facade/transformFacadeStateMessage.ts +2 -1
- package/src/orchestrate/index.ts +2 -2
- package/src/orchestrate/interface/orchestrateInterface.ts +7 -0
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +4 -3
- package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +26 -23
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +6 -4
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +14 -11
- package/src/orchestrate/interface/transformInterfaceHistories.ts +2 -0
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +10 -5
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +11 -5
- package/src/orchestrate/prisma/orchestratePrismaSchema.ts +16 -8
- package/src/orchestrate/prisma/transformPrismaComponentsHistories.ts +9 -0
- package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +8 -0
- package/src/orchestrate/realize/orchestrateRealize.ts +169 -0
- package/src/orchestrate/realize/orchestrateRealizeCoder.ts +156 -0
- package/src/orchestrate/realize/orchestrateRealizeIntegrator.ts +75 -0
- package/src/orchestrate/realize/orchestrateRealizePlanner.ts +115 -0
- package/src/orchestrate/realize/orchestrateRealizeValidator.ts +64 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +36 -0
- package/src/orchestrate/realize/transformRealizeCoderHistories.ts +136 -0
- package/src/orchestrate/test/compile/completeTestCode.ts +35 -0
- package/src/orchestrate/test/{filterTestFileName.ts → compile/filterTestFileName.ts} +1 -1
- package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +24 -0
- package/src/orchestrate/test/{compileTestScenario.ts → compile/getTestScenarioArtifacts.ts} +17 -8
- package/src/orchestrate/test/experimental/orchestrateTestCorrect.ast +240 -0
- package/src/orchestrate/test/experimental/orchestrateTestWrite.ast +316 -0
- package/src/orchestrate/test/experimental/transformTestCorrectHistories.ast +52 -0
- package/src/orchestrate/test/orchestrateTest.ts +38 -16
- package/src/orchestrate/test/orchestrateTestCorrect.ts +111 -338
- package/src/orchestrate/test/orchestrateTestScenario.ts +114 -69
- package/src/orchestrate/test/orchestrateTestWrite.ts +55 -153
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +126 -0
- package/src/orchestrate/test/structures/IAutoBeTestFunction.ts +10 -0
- package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +32 -22
- package/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.ts +3 -0
- package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +117 -0
- package/src/orchestrate/test/structures/IAutoBeTestWriteResult.ts +9 -0
- package/src/orchestrate/test/transformTestCorrectHistories.ts +38 -43
- package/src/orchestrate/test/transformTestWriteHistories.ts +89 -35
- package/src/structures/IAutoBeConfig.ts +9 -0
- package/src/structures/IAutoBeProps.ts +17 -1
- package/src/utils/backoffRetry.ts +25 -36
- package/src/utils/forceRetry.ts +13 -0
- package/lib/factory/invertOpenApiDocument.d.ts +0 -3
- package/lib/factory/invertOpenApiDocument.js +0 -51
- package/lib/factory/invertOpenApiDocument.js.map +0 -1
- package/lib/orchestrate/orchestrateRealize.d.ts +0 -5
- package/lib/orchestrate/orchestrateRealize.js.map +0 -1
- package/lib/orchestrate/test/compileTestScenario.d.ts +0 -5
- package/lib/orchestrate/test/compileTestScenario.js.map +0 -1
- package/lib/orchestrate/test/filterTestFileName.js.map +0 -1
- package/lib/utils/StringUtil.d.ts +0 -4
- package/lib/utils/StringUtil.js +0 -43
- package/lib/utils/StringUtil.js.map +0 -1
- package/lib/utils/types/BackoffOptions.d.ts +0 -12
- package/lib/utils/types/BackoffOptions.js.map +0 -1
- package/src/factory/invertOpenApiDocument.ts +0 -63
- package/src/orchestrate/orchestrateRealize.ts +0 -18
- package/src/utils/StringUtil.ts +0 -45
- package/src/utils/types/BackoffOptions.ts +0 -15
- /package/lib/orchestrate/test/{filterTestFileName.d.ts → compile/filterTestFileName.d.ts} +0 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
export interface IAutoBeTestCorrectApplication {
|
|
2
|
+
/**
|
|
3
|
+
* Main entry point for AI Function Call - analyzes compilation errors and
|
|
4
|
+
* generates corrected E2E test code.
|
|
5
|
+
*
|
|
6
|
+
* The AI executes this function to perform the complete error correction
|
|
7
|
+
* workflow: error-free analysis → compilation error analysis → draft
|
|
8
|
+
* correction → code review → final corrected implementation. This multi-step
|
|
9
|
+
* process ensures systematic error resolution while preserving original test
|
|
10
|
+
* functionality and maintaining code quality.
|
|
11
|
+
*
|
|
12
|
+
* The corrector first analyzes the scenario without considering compilation
|
|
13
|
+
* errors to understand the intended functionality, then incorporates
|
|
14
|
+
* compilation diagnostics to identify specific issues, and finally produces
|
|
15
|
+
* corrected code through iterative refinement with comprehensive review and
|
|
16
|
+
* validation.
|
|
17
|
+
*
|
|
18
|
+
* @param props Complete specification for error correction workflow including
|
|
19
|
+
* analysis steps, draft implementation, review process, and final code
|
|
20
|
+
* generation
|
|
21
|
+
*/
|
|
22
|
+
rewrite(props: IAutoBeTestCorrectApplication.IProps): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export namespace IAutoBeTestCorrectApplication {
|
|
26
|
+
export interface IProps {
|
|
27
|
+
/**
|
|
28
|
+
* Step 1: Initial analysis and understanding without compilation error
|
|
29
|
+
* context.
|
|
30
|
+
*
|
|
31
|
+
* AI analyzes the original test scenario, business requirements, and
|
|
32
|
+
* intended functionality without being influenced by compilation errors.
|
|
33
|
+
* This clean analysis establishes a clear understanding of what the test
|
|
34
|
+
* should accomplish, the expected business workflow, and the correct API
|
|
35
|
+
* integration patterns.
|
|
36
|
+
*
|
|
37
|
+
* This step ensures that error correction doesn't lose sight of the
|
|
38
|
+
* original test purpose and helps maintain the intended business logic
|
|
39
|
+
* while addressing technical compilation issues. The AI develops a
|
|
40
|
+
* comprehensive understanding of the test requirements before diving into
|
|
41
|
+
* error-specific details.
|
|
42
|
+
*
|
|
43
|
+
* Workflow: Scenario understanding → Business logic analysis → Intended
|
|
44
|
+
* functionality mapping
|
|
45
|
+
*/
|
|
46
|
+
think_without_compile_error: string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Step 2: Compilation error analysis and root cause identification.
|
|
50
|
+
*
|
|
51
|
+
* AI re-analyzes the scenario and implementation with full awareness of
|
|
52
|
+
* compilation errors and diagnostic information. This step involves
|
|
53
|
+
* systematic examination of error messages, identification of error
|
|
54
|
+
* patterns, and understanding of how compilation issues relate to the
|
|
55
|
+
* intended functionality.
|
|
56
|
+
*
|
|
57
|
+
* The AI correlates compilation diagnostics with the original requirements
|
|
58
|
+
* to understand where the implementation diverged from correct TypeScript
|
|
59
|
+
* usage while maintaining the business logic intent. This analysis forms
|
|
60
|
+
* the foundation for targeted error correction strategies.
|
|
61
|
+
*
|
|
62
|
+
* Workflow: Error diagnostic analysis → Root cause identification →
|
|
63
|
+
* Correction strategy planning
|
|
64
|
+
*/
|
|
65
|
+
think_again_with_compile_error: string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Step 3: Draft corrected TypeScript E2E test code implementation.
|
|
69
|
+
*
|
|
70
|
+
* AI generates the first corrected version of the test code based on error
|
|
71
|
+
* analysis and correction strategies. This draft addresses all identified
|
|
72
|
+
* compilation errors while preserving the original business logic and test
|
|
73
|
+
* workflow. The code must be compilation-error-free and follow all
|
|
74
|
+
* established conventions.
|
|
75
|
+
*
|
|
76
|
+
* The implementation incorporates lessons learned from error analysis to
|
|
77
|
+
* produce properly typed, syntactically correct code that maintains the
|
|
78
|
+
* intended test functionality. All type safety requirements and framework
|
|
79
|
+
* conventions must be followed in this corrected implementation.
|
|
80
|
+
*
|
|
81
|
+
* Workflow: Error correction → TypeScript implementation → Functional
|
|
82
|
+
* preservation Critical: Must resolve all compilation errors while
|
|
83
|
+
* maintaining original test intent
|
|
84
|
+
*/
|
|
85
|
+
draft: string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Step 4: Code review and correction validation.
|
|
89
|
+
*
|
|
90
|
+
* AI performs a comprehensive review of the corrected draft implementation,
|
|
91
|
+
* validating that all compilation errors have been resolved and that the
|
|
92
|
+
* code maintains the original functionality. This review examines both
|
|
93
|
+
* technical correctness and business logic preservation.
|
|
94
|
+
*
|
|
95
|
+
* The review process includes verification of TypeScript compilation
|
|
96
|
+
* compatibility, API integration correctness, test workflow completeness,
|
|
97
|
+
* and adherence to all quality standards. Any remaining issues or potential
|
|
98
|
+
* improvements are identified for incorporation into the final
|
|
99
|
+
* implementation.
|
|
100
|
+
*
|
|
101
|
+
* Workflow: Draft validation → Compilation verification → Functionality
|
|
102
|
+
* review → Quality assessment
|
|
103
|
+
*/
|
|
104
|
+
review: string;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Step 5: Final production-ready corrected test code.
|
|
108
|
+
*
|
|
109
|
+
* AI produces the final, polished version of the corrected test code
|
|
110
|
+
* incorporating all review feedback and validation results. This code
|
|
111
|
+
* represents the completed error correction, guaranteed to compile
|
|
112
|
+
* successfully while preserving all original test functionality and
|
|
113
|
+
* business logic.
|
|
114
|
+
*
|
|
115
|
+
* The final implementation resolves all compilation issues, maintains
|
|
116
|
+
* strict type safety, follows all established conventions, and delivers a
|
|
117
|
+
* production-ready test that accurately validates the intended API
|
|
118
|
+
* behaviors and user workflows.
|
|
119
|
+
*
|
|
120
|
+
* Workflow: Review integration → Final refinement → Production-ready
|
|
121
|
+
* implementation This is the ultimate deliverable that will replace the
|
|
122
|
+
* compilation-failed code.
|
|
123
|
+
*/
|
|
124
|
+
final: string;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AutoBeTestScenario } from "@autobe/interface";
|
|
2
|
+
|
|
3
|
+
import { IAutoBeTestScenarioArtifacts } from "./IAutoBeTestScenarioArtifacts";
|
|
4
|
+
|
|
5
|
+
export interface IAutoBeTestFunction {
|
|
6
|
+
artifacts: IAutoBeTestScenarioArtifacts;
|
|
7
|
+
scenario: AutoBeTestScenario;
|
|
8
|
+
location: string;
|
|
9
|
+
script: string;
|
|
10
|
+
}
|
|
@@ -16,27 +16,31 @@ export namespace IAutoBeTestScenarioApplication {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface IScenarioGroup {
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Target API endpoint to test.
|
|
21
|
+
*
|
|
22
|
+
* This must be **unique** across all scenario groups. An endpoint is
|
|
23
|
+
* identified by its `path` and `method` combination.
|
|
24
|
+
*
|
|
25
|
+
* Multiple test scenarios may exist for a single endpoint.
|
|
26
|
+
*/
|
|
20
27
|
endpoint: AutoBeOpenApi.IEndpoint;
|
|
21
28
|
|
|
22
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* An array of test scenarios associated with the given endpoint.
|
|
31
|
+
*
|
|
32
|
+
* Each scenario represents a specific test case for the same `path` and
|
|
33
|
+
* `method`.
|
|
34
|
+
*/
|
|
23
35
|
scenarios: IScenario[];
|
|
24
36
|
}
|
|
25
37
|
|
|
26
38
|
/**
|
|
27
39
|
* Represents a test scenario for a single API operation.
|
|
28
40
|
*
|
|
29
|
-
* This interface
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* - `draft`: A free-form, human-readable test scenario description for the API
|
|
33
|
-
* endpoint.
|
|
34
|
-
* - `dependsOn`: A list of other API endpoints that must be invoked beforehand
|
|
35
|
-
* in order to prepare the context for this test. Each dependency includes
|
|
36
|
-
* the purpose of the dependency.
|
|
37
|
-
*
|
|
38
|
-
* This structure is intended to help organize test specifications for complex
|
|
39
|
-
* workflows and ensure that all prerequisites are explicitly declared.
|
|
41
|
+
* This interface defines a structured, user-centric test draft that includes
|
|
42
|
+
* a descriptive function name, a detailed scenario draft, and logical
|
|
43
|
+
* dependencies on other endpoints required for context or setup.
|
|
40
44
|
*/
|
|
41
45
|
export interface IScenario {
|
|
42
46
|
/**
|
|
@@ -44,7 +48,7 @@ export namespace IAutoBeTestScenarioApplication {
|
|
|
44
48
|
* be tested. This should include both successful and failure scenarios,
|
|
45
49
|
* business rule validations, edge cases, and any sequence of steps
|
|
46
50
|
* necessary to perform the test. A subsequent agent will use this draft to
|
|
47
|
-
* generate multiple test
|
|
51
|
+
* generate multiple concrete test cases.
|
|
48
52
|
*/
|
|
49
53
|
draft: string;
|
|
50
54
|
|
|
@@ -109,20 +113,26 @@ export namespace IAutoBeTestScenarioApplication {
|
|
|
109
113
|
functionName: string;
|
|
110
114
|
|
|
111
115
|
/**
|
|
112
|
-
* A list of other API endpoints that
|
|
113
|
-
*
|
|
114
|
-
*
|
|
116
|
+
* A list of other API endpoints that this scenario logically depends on.
|
|
117
|
+
*
|
|
118
|
+
* These dependencies represent context or prerequisite conditions, such as
|
|
119
|
+
* authentication, resource creation, or data setup, that are relevant to
|
|
120
|
+
* the test. This list is not a strict execution order — if ordering is
|
|
121
|
+
* important, it must be described explicitly in the `purpose`.
|
|
115
122
|
*/
|
|
116
|
-
|
|
123
|
+
dependencies: IDependencies[];
|
|
117
124
|
}
|
|
118
125
|
|
|
119
|
-
export interface
|
|
120
|
-
/** Target API endpoint that
|
|
126
|
+
export interface IDependencies {
|
|
127
|
+
/** Target API endpoint that this scenario depends on. */
|
|
121
128
|
endpoint: AutoBeOpenApi.IEndpoint;
|
|
122
129
|
|
|
123
130
|
/**
|
|
124
|
-
* A concise
|
|
125
|
-
*
|
|
131
|
+
* A concise explanation of why this API call is relevant or required for
|
|
132
|
+
* the main test scenario.
|
|
133
|
+
*
|
|
134
|
+
* This should describe the contextual or setup role of the dependency, such
|
|
135
|
+
* as creating necessary data or establishing user authentication.
|
|
126
136
|
*
|
|
127
137
|
* Example: "Creates a category so that a product can be linked to it during
|
|
128
138
|
* creation."
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export interface IAutoBeTestWriteApplication {
|
|
2
|
+
/**
|
|
3
|
+
* Main entry point for AI Function Call - generates complete E2E test code.
|
|
4
|
+
*
|
|
5
|
+
* The AI executes this function to perform the entire test generation
|
|
6
|
+
* workflow: scenario analysis → draft implementation → code review → final
|
|
7
|
+
* code production. This structured approach ensures high-quality,
|
|
8
|
+
* compilation-error-free test code.
|
|
9
|
+
*
|
|
10
|
+
* @param props Complete specification for test generation including scenario,
|
|
11
|
+
* domain, and implementation steps
|
|
12
|
+
*/
|
|
13
|
+
write(props: IAutoBeTestWriteApplication.IProps): void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export namespace IAutoBeTestWriteApplication {
|
|
17
|
+
export interface IProps {
|
|
18
|
+
/**
|
|
19
|
+
* Step 1: Strategic test planning and scenario analysis.
|
|
20
|
+
*
|
|
21
|
+
* AI analyzes the given test scenario and creates a comprehensive
|
|
22
|
+
* implementation strategy. This planning phase is crucial for generating
|
|
23
|
+
* well-structured, maintainable test code. The AI must define test
|
|
24
|
+
* methodology, data preparation, execution flow, and validation logic
|
|
25
|
+
* before proceeding to code implementation.
|
|
26
|
+
*
|
|
27
|
+
* Workflow: Input scenario → Strategic analysis → Detailed test plan
|
|
28
|
+
*/
|
|
29
|
+
scenario: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Step 2: Functional domain classification for test organization.
|
|
33
|
+
*
|
|
34
|
+
* AI determines the appropriate domain category based on the scenario
|
|
35
|
+
* analysis. This classification drives file structure, test categorization,
|
|
36
|
+
* and logical grouping. The domain must be a single, lowercase word that
|
|
37
|
+
* represents the primary API resource.
|
|
38
|
+
*
|
|
39
|
+
* Workflow: Scenario analysis → Domain identification → Test organization
|
|
40
|
+
* structure
|
|
41
|
+
*/
|
|
42
|
+
domain: string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Step 3: Initial TypeScript E2E test code implementation.
|
|
46
|
+
*
|
|
47
|
+
* AI generates the first working version of the test code based on the
|
|
48
|
+
* strategic plan. This draft must be compilation-error-free and follow
|
|
49
|
+
*
|
|
50
|
+
* @nestia/e2e framework conventions. The code should implement all planned
|
|
51
|
+
* test scenarios with proper async/await patterns, type safety, and
|
|
52
|
+
* comprehensive error handling.
|
|
53
|
+
*
|
|
54
|
+
* Workflow: Strategic plan → TypeScript implementation → Functional test
|
|
55
|
+
* code
|
|
56
|
+
*
|
|
57
|
+
* Critical: NO import statements, start directly with 'export async function'
|
|
58
|
+
*/
|
|
59
|
+
draft: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Step 4: Code review and quality assessment.
|
|
63
|
+
*
|
|
64
|
+
* AI performs a thorough review of the draft implementation, examining:
|
|
65
|
+
*
|
|
66
|
+
* **Compilation & Syntax:**
|
|
67
|
+
*
|
|
68
|
+
* - TypeScript compilation errors and type mismatches
|
|
69
|
+
* - Syntax errors and missing semicolons/brackets
|
|
70
|
+
* - Correct function signatures and parameter types
|
|
71
|
+
*
|
|
72
|
+
* **Framework Compliance:**
|
|
73
|
+
*
|
|
74
|
+
* - @nestia/e2e framework conventions adherence
|
|
75
|
+
* - Proper API SDK function calling patterns
|
|
76
|
+
* - Correct use of typia.assert() and TestValidator functions
|
|
77
|
+
*
|
|
78
|
+
* **Business Logic & Test Coverage:**
|
|
79
|
+
*
|
|
80
|
+
* - Complete workflow implementation (authentication → data setup → main test
|
|
81
|
+
* → validation)
|
|
82
|
+
* - Realistic business scenarios and user journeys
|
|
83
|
+
* - Edge case handling and error condition testing
|
|
84
|
+
* - Proper data dependencies and cleanup procedures
|
|
85
|
+
*
|
|
86
|
+
* **Code Quality & Security:**
|
|
87
|
+
*
|
|
88
|
+
* - Type safety violations (any, @ts-ignore, etc.)
|
|
89
|
+
* - Variable naming and code organization
|
|
90
|
+
* - Performance considerations and resource management
|
|
91
|
+
* - Security best practices in test data generation
|
|
92
|
+
*
|
|
93
|
+
* Workflow: Draft code → Systematic analysis → Specific improvement
|
|
94
|
+
* recommendations
|
|
95
|
+
*
|
|
96
|
+
* The review must identify concrete issues with line-by-line feedback and
|
|
97
|
+
* provide actionable solutions for each problem discovered.
|
|
98
|
+
*/
|
|
99
|
+
review: string;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Step 5: Final production-ready test code.
|
|
103
|
+
*
|
|
104
|
+
* AI produces the final, polished version of the test code incorporating
|
|
105
|
+
* all review feedback. This code represents the completed test
|
|
106
|
+
* implementation, ready for production deployment. All identified issues
|
|
107
|
+
* must be resolved, and the code must meet the highest quality standards.
|
|
108
|
+
*
|
|
109
|
+
* Workflow: Review feedback → Code refinement → Production-ready
|
|
110
|
+
* implementation
|
|
111
|
+
*
|
|
112
|
+
* This is the ultimate deliverable that will be used in the actual test
|
|
113
|
+
* suite.
|
|
114
|
+
*/
|
|
115
|
+
final: string;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AutoBeTestScenario, AutoBeTestWriteEvent } from "@autobe/interface";
|
|
2
|
+
|
|
3
|
+
import { IAutoBeTestScenarioArtifacts } from "./IAutoBeTestScenarioArtifacts";
|
|
4
|
+
|
|
5
|
+
export interface IAutoBeTestWriteResult {
|
|
6
|
+
scenario: AutoBeTestScenario;
|
|
7
|
+
artifacts: IAutoBeTestScenarioArtifacts;
|
|
8
|
+
event: AutoBeTestWriteEvent;
|
|
9
|
+
}
|
|
@@ -1,51 +1,46 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
+
import { IAutoBeTypeScriptCompileResult } from "@autobe/interface";
|
|
2
3
|
import { v4 } from "uuid";
|
|
3
4
|
|
|
4
5
|
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
5
|
-
import {
|
|
6
|
+
import { IAutoBeTestFunction } from "./structures/IAutoBeTestFunction";
|
|
7
|
+
import { transformTestWriteHistories } from "./transformTestWriteHistories";
|
|
6
8
|
|
|
7
9
|
export const transformTestCorrectHistories = (
|
|
8
|
-
|
|
10
|
+
func: IAutoBeTestFunction,
|
|
11
|
+
failure: IAutoBeTypeScriptCompileResult.IFailure,
|
|
9
12
|
): Array<
|
|
10
13
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
11
|
-
> =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"```",
|
|
45
|
-
"",
|
|
46
|
-
"Now Fix the E2E test function based on the given error information.",
|
|
47
|
-
"Only output a single `async function` named `test_api_{...}`. No explanation, no commentary.",
|
|
48
|
-
].join("\n"),
|
|
49
|
-
},
|
|
50
|
-
];
|
|
51
|
-
};
|
|
14
|
+
> => [
|
|
15
|
+
...transformTestWriteHistories(func.scenario, func.artifacts),
|
|
16
|
+
{
|
|
17
|
+
id: v4(),
|
|
18
|
+
created_at: new Date().toISOString(),
|
|
19
|
+
type: "assistantMessage",
|
|
20
|
+
text: [
|
|
21
|
+
"## Generated TypeScript Code",
|
|
22
|
+
"```typescript",
|
|
23
|
+
func.script,
|
|
24
|
+
"```",
|
|
25
|
+
"",
|
|
26
|
+
"## Compile Errors",
|
|
27
|
+
"Fix the compilation error in the provided code.",
|
|
28
|
+
"",
|
|
29
|
+
"```json",
|
|
30
|
+
JSON.stringify(failure.diagnostics),
|
|
31
|
+
"```",
|
|
32
|
+
].join("\n"),
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: v4(),
|
|
36
|
+
created_at: new Date().toISOString(),
|
|
37
|
+
type: "systemMessage",
|
|
38
|
+
text: AutoBeSystemPromptConstant.TEST_CORRECT.replace(
|
|
39
|
+
"{{API_DTO_SCHEMAS}}",
|
|
40
|
+
transformTestWriteHistories.structures(func.artifacts),
|
|
41
|
+
).replace(
|
|
42
|
+
"{{API_SDK_FUNCTIONS}}",
|
|
43
|
+
transformTestWriteHistories.functional(func.artifacts),
|
|
44
|
+
),
|
|
45
|
+
},
|
|
46
|
+
];
|
|
@@ -1,53 +1,107 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
2
|
import { AutoBeTestScenario } from "@autobe/interface";
|
|
3
|
+
import { StringUtil, transformOpenApiDocument } from "@autobe/utils";
|
|
4
|
+
import {
|
|
5
|
+
HttpMigration,
|
|
6
|
+
IHttpMigrateApplication,
|
|
7
|
+
OpenApi,
|
|
8
|
+
} from "@samchon/openapi";
|
|
9
|
+
import typia from "typia";
|
|
3
10
|
import { v4 } from "uuid";
|
|
4
11
|
|
|
5
12
|
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
6
13
|
import { IAutoBeTestScenarioArtifacts } from "./structures/IAutoBeTestScenarioArtifacts";
|
|
7
14
|
|
|
8
|
-
export
|
|
9
|
-
scenario: AutoBeTestScenario
|
|
10
|
-
artifacts: IAutoBeTestScenarioArtifacts
|
|
11
|
-
|
|
12
|
-
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
13
|
-
> => {
|
|
15
|
+
export function transformTestWriteHistories(
|
|
16
|
+
scenario: AutoBeTestScenario,
|
|
17
|
+
artifacts: IAutoBeTestScenarioArtifacts,
|
|
18
|
+
): Array<IAgenticaHistoryJson.ISystemMessage> {
|
|
14
19
|
return [
|
|
15
20
|
{
|
|
16
21
|
id: v4(),
|
|
17
22
|
created_at: new Date().toISOString(),
|
|
18
23
|
type: "systemMessage",
|
|
19
|
-
text: AutoBeSystemPromptConstant.TEST_WRITE
|
|
24
|
+
text: AutoBeSystemPromptConstant.TEST_WRITE.replace(
|
|
25
|
+
"{{AutoBeTestScenario}}",
|
|
26
|
+
JSON.stringify(typia.llm.parameters<AutoBeTestScenario, "llama">()),
|
|
27
|
+
),
|
|
20
28
|
},
|
|
21
29
|
{
|
|
22
30
|
id: v4(),
|
|
23
31
|
created_at: new Date().toISOString(),
|
|
24
|
-
type: "
|
|
25
|
-
text:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
32
|
+
type: "systemMessage",
|
|
33
|
+
text: StringUtil.trim`
|
|
34
|
+
Here is the list of input material composition.
|
|
35
|
+
|
|
36
|
+
Make e2e test functions based on the following information.
|
|
37
|
+
|
|
38
|
+
## Scenario Plan
|
|
39
|
+
|
|
40
|
+
Here is the scenario plan what you have to implement.
|
|
41
|
+
|
|
42
|
+
\`\`\`json
|
|
43
|
+
${JSON.stringify(scenario)}
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
## DTO Definitions
|
|
47
|
+
|
|
48
|
+
You can use these DTO definitions.
|
|
49
|
+
|
|
50
|
+
Never use the DTO definitions that are not listed here.
|
|
51
|
+
|
|
52
|
+
${transformTestWriteHistories.structures(artifacts)}
|
|
53
|
+
|
|
54
|
+
## API (SDK) Functions
|
|
55
|
+
|
|
56
|
+
You can use these API functions.
|
|
57
|
+
|
|
58
|
+
Never use the functions that are not listed here.
|
|
59
|
+
|
|
60
|
+
${transformTestWriteHistories.functional(artifacts)}
|
|
61
|
+
|
|
62
|
+
## E2E Mockup Functions
|
|
63
|
+
|
|
64
|
+
Just reference, and never follow this code as it is.
|
|
65
|
+
|
|
66
|
+
\`\`\`json
|
|
67
|
+
${JSON.stringify(artifacts.e2e)}
|
|
68
|
+
\`\`\`
|
|
69
|
+
`,
|
|
51
70
|
},
|
|
52
71
|
];
|
|
53
|
-
}
|
|
72
|
+
}
|
|
73
|
+
export namespace transformTestWriteHistories {
|
|
74
|
+
export function structures(artifacts: IAutoBeTestScenarioArtifacts): string {
|
|
75
|
+
return StringUtil.trim`
|
|
76
|
+
${Object.keys(artifacts.document.components.schemas)
|
|
77
|
+
.map((k) => `- ${k}`)
|
|
78
|
+
.join("\n")}
|
|
79
|
+
|
|
80
|
+
\`\`\`json
|
|
81
|
+
${JSON.stringify(artifacts.dto)}
|
|
82
|
+
\`\`\`
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function functional(artifacts: IAutoBeTestScenarioArtifacts): string {
|
|
87
|
+
const document: OpenApi.IDocument = transformOpenApiDocument(
|
|
88
|
+
artifacts.document,
|
|
89
|
+
);
|
|
90
|
+
const app: IHttpMigrateApplication = HttpMigration.application(document);
|
|
91
|
+
return StringUtil.trim`
|
|
92
|
+
Method | Path | Function Accessor
|
|
93
|
+
-------|------|-------------------
|
|
94
|
+
${app.routes
|
|
95
|
+
.map((r) =>
|
|
96
|
+
[r.method, r.path, `api.functional.${r.accessor.join(".")}`].join(
|
|
97
|
+
" | ",
|
|
98
|
+
),
|
|
99
|
+
)
|
|
100
|
+
.join("\n")}
|
|
101
|
+
|
|
102
|
+
\`\`\`json
|
|
103
|
+
${JSON.stringify(artifacts.sdk)}
|
|
104
|
+
\`\`\`
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -60,4 +60,13 @@ export interface IAutoBeConfig {
|
|
|
60
60
|
* @default System timezone or "UTC" if unavailable
|
|
61
61
|
*/
|
|
62
62
|
timezone?: string;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Backoff strategy for retrying failed operations.
|
|
66
|
+
*
|
|
67
|
+
* Defines the logic for retrying failed operations when the agent encounters
|
|
68
|
+
* errors. This includes retrying function calls, API requests, and other
|
|
69
|
+
* operations that may fail due to temporary issues.
|
|
70
|
+
*/
|
|
71
|
+
backoffStrategy?: (props: { count: number; error: unknown }) => number;
|
|
63
72
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
AutoBeHistory,
|
|
3
|
+
IAutoBeCompiler,
|
|
4
|
+
IAutoBeTokenUsageJson,
|
|
5
|
+
} from "@autobe/interface";
|
|
2
6
|
import { ILlmSchema } from "@samchon/openapi";
|
|
3
7
|
|
|
8
|
+
import { AutoBeTokenUsage } from "../context/AutoBeTokenUsage";
|
|
4
9
|
import { IAutoBeConfig } from "./IAutoBeConfig";
|
|
5
10
|
import { IAutoBeVendor } from "./IAutoBeVendor";
|
|
6
11
|
|
|
@@ -101,4 +106,15 @@ export interface IAutoBeProps<Model extends ILlmSchema.Model> {
|
|
|
101
106
|
* time-sensitive operations throughout the development process.
|
|
102
107
|
*/
|
|
103
108
|
config?: IAutoBeConfig | undefined;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Token usage information.
|
|
112
|
+
*
|
|
113
|
+
* You can start token usage tracing by assigning this property.
|
|
114
|
+
*
|
|
115
|
+
* If you assign {@link IAutoBeTokenUsageJson} value, the token usage tracing
|
|
116
|
+
* would be from the value. Otherwise you assign the {@link AutoBeTokenUsage}
|
|
117
|
+
* typed instance, the tracing would be binded to the instance.
|
|
118
|
+
*/
|
|
119
|
+
tokenUsage?: IAutoBeTokenUsageJson | AutoBeTokenUsage | undefined;
|
|
104
120
|
}
|