@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,45 @@
|
|
|
1
|
+
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
+
import { IAutoBeTypeScriptCompileResult } from "@autobe/interface";
|
|
3
|
+
import { StringUtil } from "@autobe/utils";
|
|
4
|
+
import { v7 } from "uuid";
|
|
5
|
+
|
|
6
|
+
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
7
|
+
|
|
8
|
+
interface IFailure {
|
|
9
|
+
diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[];
|
|
10
|
+
script: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const transformRealizeCorrectCastingHistories = (
|
|
14
|
+
failures: IFailure[],
|
|
15
|
+
): Array<
|
|
16
|
+
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
17
|
+
> => {
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
id: v7(),
|
|
21
|
+
created_at: new Date().toISOString(),
|
|
22
|
+
type: "systemMessage",
|
|
23
|
+
text: AutoBeSystemPromptConstant.REALIZE_CORRECT_CASTING,
|
|
24
|
+
},
|
|
25
|
+
...failures.map(
|
|
26
|
+
(f, i, array) =>
|
|
27
|
+
({
|
|
28
|
+
id: v7(),
|
|
29
|
+
created_at: new Date().toISOString(),
|
|
30
|
+
type: "assistantMessage",
|
|
31
|
+
text: StringUtil.trim`
|
|
32
|
+
# ${i === array.length - 1 ? "Latest Failure" : "Previous Failure"}
|
|
33
|
+
## Generated TypeScript Code
|
|
34
|
+
\`\`\`typescript
|
|
35
|
+
${f.script}
|
|
36
|
+
\`\`\`
|
|
37
|
+
## Compile Errors
|
|
38
|
+
\`\`\`json
|
|
39
|
+
${JSON.stringify(f.diagnostics)}
|
|
40
|
+
\`\`\`
|
|
41
|
+
`,
|
|
42
|
+
}) satisfies IAgenticaHistoryJson.IAssistantMessage,
|
|
43
|
+
),
|
|
44
|
+
];
|
|
45
|
+
};
|
|
@@ -23,7 +23,9 @@ export async function compileRealizeFiles<Model extends ILlmSchema.Model>(
|
|
|
23
23
|
);
|
|
24
24
|
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
25
25
|
const templateFiles: Record<string, string> =
|
|
26
|
-
await compiler.realize.getTemplate(
|
|
26
|
+
await compiler.realize.getTemplate({
|
|
27
|
+
dbms: "sqlite",
|
|
28
|
+
});
|
|
27
29
|
const nodeModules: Record<string, string> =
|
|
28
30
|
prisma?.type === "success" ? prisma.nodeModules : {};
|
|
29
31
|
|
|
@@ -14,8 +14,8 @@ import { v7 } from "uuid";
|
|
|
14
14
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
15
15
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
16
16
|
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
17
|
-
import { transformCommonCorrectCastingHistories } from "../common/histories/transformCommonCorrectCastingHistories";
|
|
18
17
|
import { IAutoBeCommonCorrectCastingApplication } from "../common/structures/IAutoBeCommonCorrectCastingApplication";
|
|
18
|
+
import { transformRealizeCorrectCastingHistories } from "./histories/transformRealizeCorrectCastingHistories";
|
|
19
19
|
import { compileRealizeFiles } from "./internal/compileRealizeFiles";
|
|
20
20
|
|
|
21
21
|
/** Result of attempting to correct a single function */
|
|
@@ -94,6 +94,12 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
94
94
|
const locations: string[] = diagnose(event).filter((l) =>
|
|
95
95
|
functions.map((f) => f.location).includes(l),
|
|
96
96
|
);
|
|
97
|
+
|
|
98
|
+
// If no locations to correct, return original functions
|
|
99
|
+
if (locations.length === 0) {
|
|
100
|
+
return functions;
|
|
101
|
+
}
|
|
102
|
+
|
|
97
103
|
progress.total += locations.length;
|
|
98
104
|
|
|
99
105
|
const converted: CorrectionResult[] = await executeCachedBatch(
|
|
@@ -110,7 +116,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
110
116
|
|
|
111
117
|
const { tokenUsage } = await ctx.conversate({
|
|
112
118
|
source: "realizeCorrect",
|
|
113
|
-
histories:
|
|
119
|
+
histories: transformRealizeCorrectCastingHistories([
|
|
114
120
|
{
|
|
115
121
|
script: func.content,
|
|
116
122
|
diagnostics: failures.filter((d) => d.file === location),
|
|
@@ -166,10 +172,24 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
166
172
|
|
|
167
173
|
const newValidate: AutoBeRealizeValidateEvent = await compileRealizeFiles(
|
|
168
174
|
ctx,
|
|
169
|
-
{
|
|
175
|
+
{
|
|
176
|
+
authorizations,
|
|
177
|
+
functions: converted.map((c) => c.func),
|
|
178
|
+
},
|
|
170
179
|
);
|
|
171
180
|
|
|
172
|
-
|
|
181
|
+
const newResult: IAutoBeTypeScriptCompileResult = newValidate.result;
|
|
182
|
+
if (newResult.type === "success") {
|
|
183
|
+
return converted.map((c) => c.func);
|
|
184
|
+
} else if (newResult.type === "exception") {
|
|
185
|
+
// Compilation exception, return current functions. because retrying won't help.
|
|
186
|
+
return functions;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (
|
|
190
|
+
newResult.diagnostics.every((d) => !d.file?.startsWith("src/providers"))
|
|
191
|
+
) {
|
|
192
|
+
// No diagnostics related to provider functions, stop correcting
|
|
173
193
|
return converted.map((c) => c.func);
|
|
174
194
|
}
|
|
175
195
|
|
|
@@ -190,9 +210,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
190
210
|
const failedLocations: string[] = failed.map((f) => f.location);
|
|
191
211
|
const allDiagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[] = [
|
|
192
212
|
...failures,
|
|
193
|
-
...(
|
|
194
|
-
? newValidate.result.diagnostics
|
|
195
|
-
: []),
|
|
213
|
+
...(newResult.type === "failure" ? newResult.diagnostics : []),
|
|
196
214
|
];
|
|
197
215
|
const relevantDiagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[] =
|
|
198
216
|
filterRelevantDiagnostics(allDiagnostics, failedLocations);
|
|
@@ -208,7 +226,11 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
208
226
|
life - 1,
|
|
209
227
|
);
|
|
210
228
|
|
|
211
|
-
|
|
229
|
+
// Get functions that were not modified (not in converted array)
|
|
230
|
+
const convertedLocations = converted.map(c => c.func.location);
|
|
231
|
+
const unchanged = functions.filter(f => !convertedLocations.includes(f.location));
|
|
232
|
+
|
|
233
|
+
return [...success, ...ignored, ...retriedFunctions, ...unchanged];
|
|
212
234
|
};
|
|
213
235
|
|
|
214
236
|
/**
|
|
@@ -19,9 +19,7 @@ import { compileRealizeFiles } from "./internal/compileRealizeFiles";
|
|
|
19
19
|
import { orchestrateRealizeCorrectCasting } from "./orchestRateRealizeCorrectCasting";
|
|
20
20
|
import { orchestrateRealizeAuthorization } from "./orchestrateRealizeAuthorization";
|
|
21
21
|
import { orchestrateRealizeCorrect } from "./orchestrateRealizeCorrect";
|
|
22
|
-
import { orchestrateRealizeCorrectDate } from "./orchestrateRealizeCorrectDate";
|
|
23
22
|
import { orchestrateRealizeWrite } from "./orchestrateRealizeWrite";
|
|
24
|
-
import { IAutoBeRealizeFunctionFailure } from "./structures/IAutoBeRealizeFunctionFailure";
|
|
25
23
|
import { IAutoBeRealizeScenarioResult } from "./structures/IAutoBeRealizeScenarioResult";
|
|
26
24
|
import { generateRealizeScenario } from "./utils/generateRealizeScenario";
|
|
27
25
|
|
|
@@ -53,7 +51,7 @@ export const orchestrateRealize =
|
|
|
53
51
|
type: "realizeStart",
|
|
54
52
|
id: v7(),
|
|
55
53
|
created_at: start.toISOString(),
|
|
56
|
-
reason: props.
|
|
54
|
+
reason: props.instruction,
|
|
57
55
|
step: ctx.state().test?.step ?? 0,
|
|
58
56
|
});
|
|
59
57
|
|
|
@@ -70,22 +68,31 @@ export const orchestrateRealize =
|
|
|
70
68
|
total: scenarios.length,
|
|
71
69
|
completed: 0,
|
|
72
70
|
};
|
|
73
|
-
const writeEvents: AutoBeRealizeWriteEvent[] =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
71
|
+
const writeEvents: (AutoBeRealizeWriteEvent | null)[] =
|
|
72
|
+
await executeCachedBatch(
|
|
73
|
+
scenarios.map((scenario) => async (promptCacheKey) => {
|
|
74
|
+
const props = {
|
|
75
|
+
totalAuthorizations: authorizations,
|
|
76
|
+
authorization: scenario.decoratorEvent ?? null,
|
|
77
|
+
scenario,
|
|
78
|
+
progress: writeProgress,
|
|
79
|
+
promptCacheKey,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const code: AutoBeRealizeWriteEvent | null =
|
|
83
|
+
await orchestrateRealizeWrite(ctx, props).catch(() => {
|
|
84
|
+
return orchestrateRealizeWrite(ctx, props).catch(() => null);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
return code;
|
|
88
|
+
}),
|
|
89
|
+
);
|
|
85
90
|
|
|
86
91
|
const functions: AutoBeRealizeFunction[] = Object.entries(
|
|
87
92
|
Object.fromEntries(
|
|
88
|
-
writeEvents
|
|
93
|
+
writeEvents
|
|
94
|
+
.filter((w) => w !== null)
|
|
95
|
+
.map((event) => [event.location, event.content]),
|
|
89
96
|
),
|
|
90
97
|
).map(([location, content]) => {
|
|
91
98
|
const scenario = scenarios.find((el) => el.location === location)!;
|
|
@@ -100,38 +107,27 @@ export const orchestrateRealize =
|
|
|
100
107
|
};
|
|
101
108
|
});
|
|
102
109
|
|
|
103
|
-
const reviewProgress = {
|
|
110
|
+
const reviewProgress: AutoBeProgressEventBase = {
|
|
104
111
|
total: writeEvents.length,
|
|
105
112
|
completed: writeEvents.length,
|
|
106
113
|
};
|
|
107
114
|
|
|
108
|
-
const
|
|
115
|
+
const totalCorrected: AutoBeRealizeFunction[] =
|
|
109
116
|
await orchestrateRealizeCorrectCasting(
|
|
110
117
|
ctx,
|
|
111
118
|
authorizations,
|
|
112
119
|
functions,
|
|
113
120
|
reviewProgress,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
const totalCorrected: AutoBeRealizeFunction[] =
|
|
127
|
-
await orchestrateRealizeCorrect(
|
|
128
|
-
ctx,
|
|
129
|
-
scenarios,
|
|
130
|
-
authorizations,
|
|
131
|
-
correctedDate,
|
|
132
|
-
[] satisfies IAutoBeRealizeFunctionFailure[],
|
|
133
|
-
reviewProgress,
|
|
134
|
-
);
|
|
121
|
+
).then(async (res) => {
|
|
122
|
+
return orchestrateRealizeCorrect(
|
|
123
|
+
ctx,
|
|
124
|
+
scenarios,
|
|
125
|
+
authorizations,
|
|
126
|
+
res,
|
|
127
|
+
[],
|
|
128
|
+
reviewProgress,
|
|
129
|
+
);
|
|
130
|
+
});
|
|
135
131
|
|
|
136
132
|
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
137
133
|
const controllers: Record<string, string> =
|
|
@@ -150,7 +146,7 @@ export const orchestrateRealize =
|
|
|
150
146
|
type: "realizeComplete",
|
|
151
147
|
id: v7(),
|
|
152
148
|
created_at: new Date().toISOString(),
|
|
153
|
-
functions,
|
|
149
|
+
functions: totalCorrected,
|
|
154
150
|
authorizations,
|
|
155
151
|
controllers,
|
|
156
152
|
compiled: result,
|
|
@@ -41,7 +41,11 @@ export async function orchestrateRealizeAuthorization<
|
|
|
41
41
|
total: roles.length,
|
|
42
42
|
completed: 0,
|
|
43
43
|
};
|
|
44
|
-
const templateFiles = await (
|
|
44
|
+
const templateFiles = await (
|
|
45
|
+
await ctx.compiler()
|
|
46
|
+
).realize.getTemplate({
|
|
47
|
+
dbms: "sqlite",
|
|
48
|
+
});
|
|
45
49
|
const authorizations: AutoBeRealizeAuthorization[] = await executeCachedBatch(
|
|
46
50
|
roles.map(
|
|
47
51
|
(role) => (promptCacheKey) =>
|
|
@@ -35,12 +35,19 @@ export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
|
|
|
35
35
|
authorizations,
|
|
36
36
|
functions,
|
|
37
37
|
});
|
|
38
|
-
|
|
39
38
|
if (event.result.type !== "failure") return functions;
|
|
40
39
|
else if (life < 0) return functions;
|
|
41
40
|
|
|
42
41
|
// Extract and process diagnostics
|
|
43
42
|
const diagnostics = event.result.diagnostics;
|
|
43
|
+
|
|
44
|
+
if (
|
|
45
|
+
event.result.diagnostics.every((d) => !d.file?.startsWith("src/providers"))
|
|
46
|
+
) {
|
|
47
|
+
// No diagnostics related to provider functions, stop correcting
|
|
48
|
+
return functions;
|
|
49
|
+
}
|
|
50
|
+
|
|
44
51
|
const locations: string[] = Array.from(
|
|
45
52
|
new Set(
|
|
46
53
|
diagnostics
|
|
@@ -116,7 +123,11 @@ async function correct<Model extends ILlmSchema.Model>(
|
|
|
116
123
|
failures: IAutoBeRealizeFunctionFailure[],
|
|
117
124
|
progress: AutoBeProgressEventBase,
|
|
118
125
|
): Promise<AutoBeRealizeFunction[]> {
|
|
119
|
-
|
|
126
|
+
if (locations.length === 0) {
|
|
127
|
+
return functions;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const corrected: AutoBeRealizeFunction[] = await executeCachedBatch(
|
|
120
131
|
locations.map((location) => async (): Promise<AutoBeRealizeFunction> => {
|
|
121
132
|
const scenario = scenarios.find((el) => el.location === location);
|
|
122
133
|
const func = functions.find((el) => el.location === location);
|
|
@@ -130,16 +141,22 @@ async function correct<Model extends ILlmSchema.Model>(
|
|
|
130
141
|
|
|
131
142
|
if (RealizeFunctionFailures.length && scenario) {
|
|
132
143
|
try {
|
|
133
|
-
const correctEvent = await step(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
144
|
+
const correctEvent: AutoBeRealizeCorrectEvent | null = await step(
|
|
145
|
+
ctx,
|
|
146
|
+
{
|
|
147
|
+
totalAuthorizations: authorizations,
|
|
148
|
+
authorization: scenario.decoratorEvent ?? null,
|
|
149
|
+
scenario,
|
|
150
|
+
function: func,
|
|
151
|
+
failures: RealizeFunctionFailures,
|
|
152
|
+
progress: progress,
|
|
153
|
+
},
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
return {
|
|
157
|
+
...func,
|
|
158
|
+
content: correctEvent === null ? "" : correctEvent.content,
|
|
159
|
+
};
|
|
143
160
|
} catch (err) {
|
|
144
161
|
return func;
|
|
145
162
|
}
|
|
@@ -149,7 +166,11 @@ async function correct<Model extends ILlmSchema.Model>(
|
|
|
149
166
|
}),
|
|
150
167
|
);
|
|
151
168
|
|
|
152
|
-
|
|
169
|
+
// Create a map of corrected functions for efficient lookup
|
|
170
|
+
const correctedMap = new Map(corrected.map((f) => [f.location, f]));
|
|
171
|
+
|
|
172
|
+
// Return all functions, with corrected ones replaced
|
|
173
|
+
return functions.map((func) => correctedMap.get(func.location) || func);
|
|
153
174
|
}
|
|
154
175
|
|
|
155
176
|
async function step<Model extends ILlmSchema.Model>(
|
|
@@ -162,7 +183,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
162
183
|
failures: IAutoBeRealizeFunctionFailure[];
|
|
163
184
|
progress: AutoBeProgressEventBase;
|
|
164
185
|
},
|
|
165
|
-
): Promise<AutoBeRealizeCorrectEvent> {
|
|
186
|
+
): Promise<AutoBeRealizeCorrectEvent | null> {
|
|
166
187
|
const pointer: IPointer<IAutoBeRealizeCorrectApplication.IProps | null> = {
|
|
167
188
|
value: null,
|
|
168
189
|
};
|
|
@@ -193,8 +214,9 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
193
214
|
`,
|
|
194
215
|
});
|
|
195
216
|
|
|
196
|
-
if (pointer.value === null)
|
|
197
|
-
|
|
217
|
+
if (pointer.value === null) {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
198
220
|
|
|
199
221
|
pointer.value.revise.final = await replaceImportStatements(ctx, {
|
|
200
222
|
operation: props.scenario.operation,
|
|
@@ -78,7 +78,7 @@ function transformFunctionName(operation: AutoBeOpenApi.IOperation): string {
|
|
|
78
78
|
const functionName = `${operation.method}${operation.path
|
|
79
79
|
.split("/")
|
|
80
80
|
.filter(Boolean)
|
|
81
|
-
.map((segment
|
|
81
|
+
.map((segment) => {
|
|
82
82
|
if (segment.startsWith("{") && segment.endsWith("}")) {
|
|
83
83
|
// {userId} → UserId
|
|
84
84
|
const paramName = segment.slice(1, -1);
|
|
@@ -91,10 +91,6 @@ function transformFunctionName(operation: AutoBeOpenApi.IOperation): string {
|
|
|
91
91
|
const words = segment.split("-");
|
|
92
92
|
return words
|
|
93
93
|
.map((word) => {
|
|
94
|
-
if (index === 0 && words.length === 1) {
|
|
95
|
-
// First segment without hyphens stays lowercase for first word
|
|
96
|
-
return word;
|
|
97
|
-
}
|
|
98
94
|
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
99
95
|
})
|
|
100
96
|
.join("");
|
|
@@ -19,6 +19,7 @@ export function getRealizeWriteImportStatements(
|
|
|
19
19
|
'import { Prisma } from "@prisma/client";',
|
|
20
20
|
'import { v4 } from "uuid";',
|
|
21
21
|
'import { toISOStringSafe } from "../util/toISOStringSafe"',
|
|
22
|
+
'import { HttpException } from "@nestjs/common";',
|
|
22
23
|
...typeReferences.map(
|
|
23
24
|
(ref) =>
|
|
24
25
|
`import { ${ref} } from "@ORGANIZATION/PROJECT-api/lib/structures/${ref}";`,
|
|
@@ -54,6 +54,11 @@ function removeAllImports(
|
|
|
54
54
|
.replace(
|
|
55
55
|
/import\s*\*\s*as\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm,
|
|
56
56
|
"",
|
|
57
|
+
)
|
|
58
|
+
// NestJS HttpException
|
|
59
|
+
.replace(
|
|
60
|
+
/import\s*{\s*HttpException\s*}\s*from\s*["']@nestjs\/common["']\s*;?\s*/gm,
|
|
61
|
+
"",
|
|
57
62
|
);
|
|
58
63
|
|
|
59
64
|
// Remove API structure imports with wrong paths
|
|
@@ -13,8 +13,11 @@ export const transformTestCorrectHistories = async <
|
|
|
13
13
|
Model extends ILlmSchema.Model,
|
|
14
14
|
>(
|
|
15
15
|
ctx: AutoBeContext<Model>,
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
props: {
|
|
17
|
+
instruction: string;
|
|
18
|
+
function: IAutoBeTestFunction;
|
|
19
|
+
failures: IAutoBeTestFunctionFailure[];
|
|
20
|
+
},
|
|
18
21
|
): Promise<
|
|
19
22
|
Array<
|
|
20
23
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
@@ -22,7 +25,11 @@ export const transformTestCorrectHistories = async <
|
|
|
22
25
|
> => {
|
|
23
26
|
const previous: Array<
|
|
24
27
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
25
|
-
> = await transformTestWriteHistories(ctx,
|
|
28
|
+
> = await transformTestWriteHistories(ctx, {
|
|
29
|
+
instruction: props.instruction,
|
|
30
|
+
scenario: props.function.scenario,
|
|
31
|
+
artifacts: props.function.artifacts,
|
|
32
|
+
});
|
|
26
33
|
return [
|
|
27
34
|
...previous.slice(0, -1),
|
|
28
35
|
{
|
|
@@ -32,21 +39,21 @@ export const transformTestCorrectHistories = async <
|
|
|
32
39
|
text: AutoBeSystemPromptConstant.TEST_CORRECT,
|
|
33
40
|
},
|
|
34
41
|
previous.at(-1)!,
|
|
35
|
-
...failures.map(
|
|
42
|
+
...props.failures.map(
|
|
36
43
|
(f, i, array) =>
|
|
37
44
|
({
|
|
38
45
|
id: v7(),
|
|
39
46
|
created_at: new Date().toISOString(),
|
|
40
47
|
type: "assistantMessage",
|
|
41
48
|
text: StringUtil.trim`
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
## ${i === array.length - 1 ? "Latest Failure" : "Previous Failure"}
|
|
50
|
+
### Generated TypeScript Code
|
|
44
51
|
|
|
45
52
|
\`\`\`typescript
|
|
46
53
|
${f.function.script}
|
|
47
54
|
\`\`\`
|
|
48
55
|
|
|
49
|
-
|
|
56
|
+
### Compile Errors
|
|
50
57
|
|
|
51
58
|
Fix the compilation error in the provided code.
|
|
52
59
|
|
|
@@ -8,12 +8,13 @@ import { AutoBeState } from "../../../context/AutoBeState";
|
|
|
8
8
|
import { IAutoBeTestScenarioAuthorizationRole } from "../structures/IAutoBeTestScenarioAuthorizationRole";
|
|
9
9
|
import { getReferenceIds } from "../utils/getReferenceIds";
|
|
10
10
|
|
|
11
|
-
export const transformTestScenarioHistories = (
|
|
12
|
-
state: AutoBeState
|
|
13
|
-
document: AutoBeOpenApi.IDocument
|
|
14
|
-
include: AutoBeOpenApi.IOperation[]
|
|
15
|
-
exclude: Pick<AutoBeOpenApi.IOperation, "method" | "path">[]
|
|
16
|
-
|
|
11
|
+
export const transformTestScenarioHistories = (props: {
|
|
12
|
+
state: AutoBeState;
|
|
13
|
+
document: AutoBeOpenApi.IDocument;
|
|
14
|
+
include: AutoBeOpenApi.IOperation[];
|
|
15
|
+
exclude: Pick<AutoBeOpenApi.IOperation, "method" | "path">[];
|
|
16
|
+
instruction: string;
|
|
17
|
+
}): Array<
|
|
17
18
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
18
19
|
> => {
|
|
19
20
|
interface IRelationship {
|
|
@@ -21,18 +22,18 @@ export const transformTestScenarioHistories = (
|
|
|
21
22
|
ids: string[];
|
|
22
23
|
}
|
|
23
24
|
const authorizations: AutoBeInterfaceAuthorization[] =
|
|
24
|
-
state.interface?.authorizations ?? [];
|
|
25
|
+
props.state.interface?.authorizations ?? [];
|
|
25
26
|
const authorizationRoles: Map<string, IAutoBeTestScenarioAuthorizationRole> =
|
|
26
27
|
new Map();
|
|
27
|
-
const relationships: IRelationship[] = document.operations
|
|
28
|
-
.map((
|
|
28
|
+
const relationships: IRelationship[] = props.document.operations
|
|
29
|
+
.map((operation) => ({
|
|
29
30
|
endpoint: {
|
|
30
|
-
method:
|
|
31
|
-
path:
|
|
31
|
+
method: operation.method,
|
|
32
|
+
path: operation.path,
|
|
32
33
|
},
|
|
33
34
|
ids: getReferenceIds({
|
|
34
|
-
document,
|
|
35
|
-
operation
|
|
35
|
+
document: props.document,
|
|
36
|
+
operation,
|
|
36
37
|
}),
|
|
37
38
|
}))
|
|
38
39
|
.filter((v) => v.ids.length !== 0);
|
|
@@ -66,7 +67,22 @@ export const transformTestScenarioHistories = (
|
|
|
66
67
|
created_at: new Date().toISOString(),
|
|
67
68
|
type: "assistantMessage",
|
|
68
69
|
text: StringUtil.trim`
|
|
69
|
-
|
|
70
|
+
## Instructions
|
|
71
|
+
|
|
72
|
+
The following e2e-test-specific instructions were extracted by AI from
|
|
73
|
+
the user's requirements and conversations. These instructions focus
|
|
74
|
+
exclusively on test-related aspects such as test coverage priorities,
|
|
75
|
+
specific edge cases to validate, business logic verification strategies,
|
|
76
|
+
and critical user workflows that must be tested.
|
|
77
|
+
|
|
78
|
+
Apply these instructions when generating test scenarios to ensure the
|
|
79
|
+
tests align with the user's testing requirements and expectations.
|
|
80
|
+
If any instructions are not relevant to the target API operations,
|
|
81
|
+
you may ignore them.
|
|
82
|
+
|
|
83
|
+
${props.instruction}
|
|
84
|
+
|
|
85
|
+
## API Operations
|
|
70
86
|
|
|
71
87
|
Below are the complete API operations.
|
|
72
88
|
Use this information to understand capabilities and dependency relationships.
|
|
@@ -81,16 +97,12 @@ export const transformTestScenarioHistories = (
|
|
|
81
97
|
and ensure you identify all dependencies between endpoints.
|
|
82
98
|
|
|
83
99
|
\`\`\`json
|
|
84
|
-
${JSON.stringify({
|
|
100
|
+
${JSON.stringify({
|
|
101
|
+
operations: props.document.operations,
|
|
102
|
+
})}
|
|
85
103
|
\`\`\`
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
{
|
|
89
|
-
id: v7(),
|
|
90
|
-
created_at: new Date().toISOString(),
|
|
91
|
-
type: "assistantMessage",
|
|
92
|
-
text: StringUtil.trim`
|
|
93
|
-
# Included in Test Plan
|
|
104
|
+
|
|
105
|
+
## Included in Test Plan
|
|
94
106
|
|
|
95
107
|
Below are the endpoints that have been included in the test plan.
|
|
96
108
|
Each endpoint shows its authentication requirements and related authentication APIs.
|
|
@@ -99,14 +111,16 @@ export const transformTestScenarioHistories = (
|
|
|
99
111
|
|
|
100
112
|
Generate test scenarios only for these included endpoints. Do not create scenarios for excluded endpoints. Operations not listed here may be used only as dependencies.
|
|
101
113
|
|
|
102
|
-
${include
|
|
114
|
+
${props.include
|
|
103
115
|
.map((el, i) => {
|
|
104
116
|
const roles = Array.from(authorizationRoles.values()).filter(
|
|
105
117
|
(role) => role.name === el.authorizationRole,
|
|
106
118
|
);
|
|
107
119
|
|
|
108
|
-
const requiredIds = getReferenceIds({
|
|
109
|
-
|
|
120
|
+
const requiredIds = getReferenceIds({
|
|
121
|
+
document: props.document,
|
|
122
|
+
operation: el,
|
|
123
|
+
});
|
|
110
124
|
return StringUtil.trim`
|
|
111
125
|
## ${i + 1}. ${el.method.toUpperCase()} ${el.path}
|
|
112
126
|
|
|
@@ -136,23 +150,17 @@ export const transformTestScenarioHistories = (
|
|
|
136
150
|
})
|
|
137
151
|
.join("\n")}
|
|
138
152
|
|
|
139
|
-
|
|
153
|
+
## Excluded from Test Plan
|
|
140
154
|
|
|
141
155
|
These are the endpoints that have already been used in test codes generated as part of a plan group.
|
|
142
156
|
These endpoints do not need to be tested again.
|
|
143
157
|
However, it is allowed to reference or depend on these endpoints when writing test codes for other purposes.
|
|
144
158
|
|
|
145
|
-
${exclude
|
|
159
|
+
${props.exclude
|
|
146
160
|
.map((el) => `- ${el.method.toUpperCase()}: ${el.path}`)
|
|
147
161
|
.join("\n")}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
{
|
|
151
|
-
id: v7(),
|
|
152
|
-
created_at: new Date().toISOString(),
|
|
153
|
-
type: "assistantMessage",
|
|
154
|
-
text: StringUtil.trim`
|
|
155
|
-
# Candidate Dependencies
|
|
162
|
+
|
|
163
|
+
## Candidate Dependencies
|
|
156
164
|
|
|
157
165
|
List of candidate dependencies extracted from path parameters and request bodies.
|
|
158
166
|
|