@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.
- package/lib/AutoBeMockAgent.js +1 -0
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +19 -18
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/IAutoBeApplication.d.ts +101 -6
- package/lib/context/IAutoBeApplicationProps.d.ts +6 -2
- package/lib/factory/createAgenticaHistory.js +1 -1
- package/lib/factory/createAgenticaHistory.js.map +1 -1
- package/lib/factory/createAutoBeApplication.js +80 -90
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/factory/createAutoBeContext.js +8 -8
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/factory/getAutoBeGenerated.js +4 -1
- package/lib/factory/getAutoBeGenerated.js.map +1 -1
- package/lib/factory/getAutoBeRealizeGenerated.d.ts +2 -1
- package/lib/factory/getAutoBeRealizeGenerated.js +1 -1
- package/lib/factory/getAutoBeRealizeGenerated.js.map +1 -1
- package/lib/factory/getCriticalCompiler.js +1 -1
- package/lib/factory/getCriticalCompiler.js.map +1 -1
- package/lib/index.mjs +2222 -1393
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +5 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.d.ts +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +18 -3
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +5 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +19 -7
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +3 -2
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.d.ts +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +2 -2
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +1 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -2
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js +2 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +5 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +20 -7
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.d.ts +6 -1
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +31 -23
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.d.ts +6 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +22 -6
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.d.ts +4 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +26 -5
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.d.ts +5 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +21 -5
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +5 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +20 -4
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +25 -7
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +17 -8
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +4 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +18 -11
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.d.ts +6 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +25 -10
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +4 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +9 -6
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.d.ts +5 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +33 -17
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.d.ts +5 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +36 -18
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +67 -8
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.js +2 -1
- package/lib/orchestrate/interface/utils/OperationValidator.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.d.ts +4 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +19 -8
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.d.ts +6 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +20 -6
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +3 -3
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +6 -3
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +12 -6
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/orchestrate/{common/histories/transformCommonCorrectDateHistories.d.ts → realize/histories/transformRealizeCorrectCastingHistories.d.ts} +1 -2
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +33 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/orchestrate/realize/internal/compileRealizeFiles.js +3 -1
- package/lib/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js +25 -8
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.js +12 -8
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +3 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +16 -5
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -5
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js +1 -0
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -1
- package/lib/orchestrate/realize/utils/replaceImportStatements.js +3 -1
- package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +5 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +11 -7
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.d.ts +7 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +39 -31
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.d.ts +8 -0
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +119 -0
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -0
- package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +5 -1
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js +111 -94
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTest.js +20 -14
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +4 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +51 -35
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.d.ts +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +21 -4
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.d.ts +9 -0
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +855 -0
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -0
- package/lib/orchestrate/test/orchestrateTestWrite.d.ts +4 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +9 -4
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioReviewApplication.d.ts +47 -0
- package/lib/orchestrate/{common/structures/IAutoBeCommonCorrectDateApplication.js → test/structures/IAutoBeTestScenarioReviewApplication.js} +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioReviewApplication.js.map +1 -0
- package/package.json +6 -6
- package/src/AutoBeMockAgent.ts +1 -0
- package/src/constants/AutoBeSystemPromptConstant.ts +19 -18
- package/src/context/IAutoBeApplication.ts +101 -6
- package/src/context/IAutoBeApplicationProps.ts +6 -2
- package/src/factory/createAgenticaHistory.ts +11 -5
- package/src/factory/createAutoBeContext.ts +5 -5
- package/src/factory/getAutoBeGenerated.ts +3 -0
- package/src/factory/getAutoBeRealizeGenerated.ts +3 -1
- package/src/factory/getCriticalCompiler.ts +2 -1
- package/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts +5 -1
- package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +16 -0
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +22 -7
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +3 -2
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +2 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +3 -2
- package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +2 -1
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +23 -9
- package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +33 -24
- package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +26 -9
- package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +27 -5
- package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +24 -7
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +23 -6
- package/src/orchestrate/interface/orchestrateInterface.ts +29 -10
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +22 -12
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +25 -17
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +35 -23
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +9 -3
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +44 -29
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +51 -32
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +68 -8
- package/src/orchestrate/interface/utils/OperationValidator.ts +2 -1
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +20 -6
- package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +24 -9
- package/src/orchestrate/prisma/orchestratePrisma.ts +7 -3
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +5 -1
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +15 -10
- package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +45 -0
- package/src/orchestrate/realize/internal/compileRealizeFiles.ts +3 -1
- package/src/orchestrate/realize/orchestRateRealizeCorrectCasting.ts +30 -8
- package/src/orchestrate/realize/orchestrateRealize.ts +36 -40
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +5 -1
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +38 -16
- package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -5
- package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +1 -0
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +5 -0
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +14 -7
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +44 -36
- package/src/orchestrate/test/histories/transformTestScenarioReviewHistories.ts +159 -0
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +35 -12
- package/src/orchestrate/test/orchestrateTest.ts +19 -13
- package/src/orchestrate/test/orchestrateTestCorrect.ts +65 -46
- package/src/orchestrate/test/orchestrateTestScenario.ts +23 -9
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +198 -0
- package/src/orchestrate/test/orchestrateTestWrite.ts +13 -4
- package/src/orchestrate/test/structures/IAutoBeTestScenarioReviewApplication.ts +52 -0
- package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js +0 -48
- package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js.map +0 -1
- package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.d.ts +0 -35
- package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.js.map +0 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.d.ts +0 -4
- package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js +0 -540
- package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js.map +0 -1
- package/src/orchestrate/common/histories/transformCommonCorrectDateHistories.ts +0 -60
- package/src/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.ts +0 -40
- 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
|
-
|
|
23
|
-
|
|
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:
|
|
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.
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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 (
|
|
120
|
-
return
|
|
121
|
-
? await correct(ctx,
|
|
122
|
-
:
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
-
|
|
184
|
+
props.function.artifacts,
|
|
169
185
|
pointer.value.revise.final,
|
|
170
186
|
);
|
|
171
187
|
pointer.value.draft = await completeTestCode(
|
|
172
188
|
ctx,
|
|
173
|
-
|
|
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
|
|
191
|
-
...
|
|
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
|
-
|
|
212
|
+
newFunction,
|
|
197
213
|
);
|
|
198
214
|
return predicate(
|
|
199
215
|
ctx,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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
|
|
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
|
}
|