@autobe/agent 0.9.2 → 0.10.1
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 +11 -4
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +7 -6
- 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/factory/createAutoBeApplication.js +288 -653
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/index.mjs +4225 -6681
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js +80 -321
- 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 +93 -266
- 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/orchestrateInterfaceComplement.js +54 -142
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +189 -201
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +71 -174
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +706 -1099
- 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 +60 -177
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +502 -1073
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js +519 -1125
- 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 +78 -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 +326 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.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/structures/IAutoBeRealizeCoderApplication.d.ts +39 -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} +10 -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 +142 -448
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +258 -532
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.d.ts +3 -2
- package/lib/orchestrate/test/orchestrateTestWrite.js +124 -90
- 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 +14 -2
- 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 -67
- package/lib/orchestrate/test/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/transformTestWriteHistories.d.ts +5 -4
- package/lib/orchestrate/test/transformTestWriteHistories.js +161 -43
- package/lib/orchestrate/test/transformTestWriteHistories.js.map +1 -1
- package/lib/structures/IAutoBeConfig.d.ts +11 -0
- 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 +9 -12
- package/src/AutoBeAgent.ts +17 -3
- package/src/constants/AutoBeSystemPromptConstant.ts +7 -6
- package/src/context/AutoBeTokenUsage.ts +85 -1
- 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 +6 -5
- package/src/orchestrate/facade/transformFacadeStateMessage.ts +2 -1
- package/src/orchestrate/index.ts +2 -2
- 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 +129 -0
- package/src/orchestrate/realize/orchestrateRealizeCoder.ts +148 -0
- package/src/orchestrate/realize/orchestrateRealizePlanner.ts +115 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +46 -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} +16 -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 +33 -16
- package/src/orchestrate/test/orchestrateTestCorrect.ts +109 -497
- package/src/orchestrate/test/orchestrateTestScenario.ts +102 -71
- package/src/orchestrate/test/orchestrateTestWrite.ts +55 -181
- 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 +14 -2
- 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 -71
- package/src/orchestrate/test/transformTestWriteHistories.ts +88 -46
- package/src/structures/IAutoBeConfig.ts +9 -0
- 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,240 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgenticaSystemPrompt,
|
|
3
|
+
IAgenticaController,
|
|
4
|
+
MicroAgentica,
|
|
5
|
+
} from "@agentica/core";
|
|
6
|
+
import {
|
|
7
|
+
AutoBeTest,
|
|
8
|
+
AutoBeTestValidateEvent,
|
|
9
|
+
IAutoBeTypeScriptCompileResult,
|
|
10
|
+
} from "@autobe/interface";
|
|
11
|
+
import {
|
|
12
|
+
ILlmApplication,
|
|
13
|
+
ILlmSchema,
|
|
14
|
+
OpenApi,
|
|
15
|
+
OpenApiTypeChecker,
|
|
16
|
+
} from "@samchon/openapi";
|
|
17
|
+
import { IPointer } from "tstl";
|
|
18
|
+
import typia, { IJsonSchemaUnit } from "typia";
|
|
19
|
+
|
|
20
|
+
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
21
|
+
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
22
|
+
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
23
|
+
import { enforceToolCall } from "../../utils/enforceToolCall";
|
|
24
|
+
import { IAutoBeTestWriteResult } from "./structures/IAutoBeTestWriteResult";
|
|
25
|
+
import { transformTestCorrectHistories } from "./transformTestCorrectHistories";
|
|
26
|
+
|
|
27
|
+
export function orchestrateTestCorrect<Model extends ILlmSchema.Model>(
|
|
28
|
+
ctx: AutoBeContext<Model>,
|
|
29
|
+
results: IAutoBeTestWriteResult[],
|
|
30
|
+
life: number = 4,
|
|
31
|
+
): Promise<AutoBeTestValidateEvent[]> {
|
|
32
|
+
return Promise.all(
|
|
33
|
+
results.map(async (written) => {
|
|
34
|
+
const event: AutoBeTestValidateEvent = await compile(ctx, written);
|
|
35
|
+
return predicate(ctx, written, event, life);
|
|
36
|
+
}),
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function predicate<Model extends ILlmSchema.Model>(
|
|
41
|
+
ctx: AutoBeContext<Model>,
|
|
42
|
+
written: IAutoBeTestWriteResult,
|
|
43
|
+
event: AutoBeTestValidateEvent,
|
|
44
|
+
life: number,
|
|
45
|
+
): Promise<AutoBeTestValidateEvent> {
|
|
46
|
+
ctx.dispatch(event);
|
|
47
|
+
return event.result.type === "failure"
|
|
48
|
+
? correct(ctx, written, event, life - 1)
|
|
49
|
+
: event;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function correct<Model extends ILlmSchema.Model>(
|
|
53
|
+
ctx: AutoBeContext<Model>,
|
|
54
|
+
written: IAutoBeTestWriteResult,
|
|
55
|
+
event: AutoBeTestValidateEvent,
|
|
56
|
+
life: number,
|
|
57
|
+
): Promise<AutoBeTestValidateEvent> {
|
|
58
|
+
if (event.result.type !== "failure") return event;
|
|
59
|
+
else if (--life <= 0) return event;
|
|
60
|
+
|
|
61
|
+
const pointer: IPointer<ICorrectTestFunctionProps | null> = {
|
|
62
|
+
value: null,
|
|
63
|
+
};
|
|
64
|
+
const agentica = new MicroAgentica({
|
|
65
|
+
model: ctx.model,
|
|
66
|
+
vendor: { ...ctx.vendor },
|
|
67
|
+
config: {
|
|
68
|
+
...(ctx.config ?? {}),
|
|
69
|
+
executor: {
|
|
70
|
+
describe: null,
|
|
71
|
+
},
|
|
72
|
+
systemPrompt: {
|
|
73
|
+
validate: (events) =>
|
|
74
|
+
[
|
|
75
|
+
AgenticaSystemPrompt.VALIDATE_REPEATED.replace(
|
|
76
|
+
"${{HISTORICAL_ERRORS}}",
|
|
77
|
+
JSON.stringify(events.map((e) => e.result.errors)),
|
|
78
|
+
),
|
|
79
|
+
AutoBeSystemPromptConstant.TEST_VALIDATE.replace(
|
|
80
|
+
"${{AutoBeTest.IStatement}}",
|
|
81
|
+
getUnionTypeName(typia.json.schema<AutoBeTest.IStatement>()),
|
|
82
|
+
).replace(
|
|
83
|
+
"${{AutoBeTest.IExpression}}",
|
|
84
|
+
getUnionTypeName(typia.json.schema<AutoBeTest.IExpression>()),
|
|
85
|
+
),
|
|
86
|
+
].join("\n\n"),
|
|
87
|
+
},
|
|
88
|
+
retry: 4,
|
|
89
|
+
},
|
|
90
|
+
histories: transformTestCorrectHistories(written, event.result),
|
|
91
|
+
controllers: [
|
|
92
|
+
createApplication({
|
|
93
|
+
model: ctx.model,
|
|
94
|
+
build: (next) => {
|
|
95
|
+
pointer.value = next;
|
|
96
|
+
},
|
|
97
|
+
}),
|
|
98
|
+
],
|
|
99
|
+
});
|
|
100
|
+
enforceToolCall(agentica);
|
|
101
|
+
|
|
102
|
+
await agentica
|
|
103
|
+
.conversate(
|
|
104
|
+
"Fix the `AutoBeTest.IFunction` data to resolve the compilation error.",
|
|
105
|
+
)
|
|
106
|
+
.finally(() => {
|
|
107
|
+
const tokenUsage = agentica.getTokenUsage();
|
|
108
|
+
ctx.usage().record(tokenUsage, ["test"]);
|
|
109
|
+
});
|
|
110
|
+
if (pointer.value === null) throw new Error("Failed to modify test code.");
|
|
111
|
+
event = await compile(ctx, {
|
|
112
|
+
...written,
|
|
113
|
+
file: {
|
|
114
|
+
...written.file,
|
|
115
|
+
function: pointer.value.function,
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
return predicate(ctx, written, event, life);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
async function compile<Model extends ILlmSchema.Model>(
|
|
122
|
+
ctx: AutoBeContext<Model>,
|
|
123
|
+
written: IAutoBeTestWriteResult,
|
|
124
|
+
): Promise<AutoBeTestValidateEvent> {
|
|
125
|
+
const compiled: IAutoBeTypeScriptCompileResult =
|
|
126
|
+
await ctx.compiler.test.compile({
|
|
127
|
+
files: {
|
|
128
|
+
...written.artifacts.dto,
|
|
129
|
+
...written.artifacts.sdk,
|
|
130
|
+
[written.file.location]: written.file.content,
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
return {
|
|
134
|
+
type: "testValidate",
|
|
135
|
+
file: written.file,
|
|
136
|
+
result: compiled,
|
|
137
|
+
created_at: new Date().toISOString(),
|
|
138
|
+
step: ctx.state().analyze?.step ?? 0,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function getUnionTypeName(unit: IJsonSchemaUnit): string {
|
|
143
|
+
if (OpenApiTypeChecker.isReference(unit.schema) === false) return "unknown";
|
|
144
|
+
|
|
145
|
+
const typeName: string = unit.schema.$ref.split("/").pop() ?? "";
|
|
146
|
+
const schema: OpenApi.IJsonSchema | undefined =
|
|
147
|
+
unit.components.schemas?.[typeName];
|
|
148
|
+
if (schema === undefined || OpenApiTypeChecker.isOneOf(schema) === false)
|
|
149
|
+
return "unknown";
|
|
150
|
+
return schema.oneOf
|
|
151
|
+
.filter(OpenApiTypeChecker.isReference)
|
|
152
|
+
.map((r) => r.$ref.split("/").pop() ?? "")
|
|
153
|
+
.join(" | ");
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function createApplication<Model extends ILlmSchema.Model>(props: {
|
|
157
|
+
model: Model;
|
|
158
|
+
build: (next: ICorrectTestFunctionProps) => void;
|
|
159
|
+
}): IAgenticaController.IClass<Model> {
|
|
160
|
+
assertSchemaModel(props.model);
|
|
161
|
+
|
|
162
|
+
const application: ILlmApplication<Model> = collection[
|
|
163
|
+
props.model
|
|
164
|
+
] as unknown as ILlmApplication<Model>;
|
|
165
|
+
return {
|
|
166
|
+
protocol: "class",
|
|
167
|
+
name: "Modify Test Code",
|
|
168
|
+
application,
|
|
169
|
+
execute: {
|
|
170
|
+
correctTestCode: (next) => {
|
|
171
|
+
props.build(next);
|
|
172
|
+
},
|
|
173
|
+
} satisfies IApplication,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const claude = typia.llm.application<
|
|
178
|
+
IApplication,
|
|
179
|
+
"claude",
|
|
180
|
+
{
|
|
181
|
+
reference: true;
|
|
182
|
+
}
|
|
183
|
+
>();
|
|
184
|
+
const collection = {
|
|
185
|
+
chatgpt: typia.llm.application<
|
|
186
|
+
IApplication,
|
|
187
|
+
"chatgpt",
|
|
188
|
+
{ reference: true }
|
|
189
|
+
>(),
|
|
190
|
+
claude,
|
|
191
|
+
llama: claude,
|
|
192
|
+
deepseek: claude,
|
|
193
|
+
"3.1": claude,
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
interface IApplication {
|
|
197
|
+
correctTestCode(props: ICorrectTestFunctionProps): void;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
interface ICorrectTestFunctionProps {
|
|
201
|
+
/**
|
|
202
|
+
* Step 1: Initial self-reflection on the source code without compiler error
|
|
203
|
+
* context.
|
|
204
|
+
*
|
|
205
|
+
* The AI agent analyzes the previously generated test code to identify
|
|
206
|
+
* potential issues, relying solely on its understanding of TypeScript syntax,
|
|
207
|
+
* testing patterns, and best practices.
|
|
208
|
+
*
|
|
209
|
+
* This encourages the agent to develop independent debugging skills before
|
|
210
|
+
* being influenced by external error messages.
|
|
211
|
+
*/
|
|
212
|
+
think_without_compile_error: string;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Step 2: Re-evaluation of the code with compiler error messages as
|
|
216
|
+
* additional context.
|
|
217
|
+
*
|
|
218
|
+
* After the initial analysis, the AI agent reviews the same code again, this
|
|
219
|
+
* time incorporating the specific TypeScript compiler error messages.
|
|
220
|
+
*
|
|
221
|
+
* This allows the agent to correlate its initial observations with concrete
|
|
222
|
+
* compilation failures and refine its understanding of what went wrong.
|
|
223
|
+
*/
|
|
224
|
+
think_again_with_compile_error: string;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Step 3: Concrete action plan for fixing the identified issues.
|
|
228
|
+
*
|
|
229
|
+
* Based on the analysis from steps 1 and 2, the AI agent formulates a
|
|
230
|
+
* specific, step-by-step solution strategy.
|
|
231
|
+
*
|
|
232
|
+
* This should include what changes need to be made, why those changes are
|
|
233
|
+
* necessary, and how they will resolve the compilation errors while
|
|
234
|
+
* maintaining the test's intended functionality.
|
|
235
|
+
*/
|
|
236
|
+
solution: string;
|
|
237
|
+
|
|
238
|
+
/** Re-written AST data to fix the compilation error. */
|
|
239
|
+
function: AutoBeTest.IFunction;
|
|
240
|
+
}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgenticaSystemPrompt,
|
|
3
|
+
IAgenticaController,
|
|
4
|
+
MicroAgentica,
|
|
5
|
+
} from "@agentica/core";
|
|
6
|
+
import {
|
|
7
|
+
AutoBeOpenApi,
|
|
8
|
+
AutoBeTest,
|
|
9
|
+
AutoBeTestScenario,
|
|
10
|
+
AutoBeTestWriteEvent,
|
|
11
|
+
} from "@autobe/interface";
|
|
12
|
+
import {
|
|
13
|
+
AutoBeEndpointComparator,
|
|
14
|
+
IAutoBeTextValidateContext,
|
|
15
|
+
validateTestFunction,
|
|
16
|
+
} from "@autobe/utils";
|
|
17
|
+
import {
|
|
18
|
+
ILlmApplication,
|
|
19
|
+
ILlmSchema,
|
|
20
|
+
IValidation,
|
|
21
|
+
OpenApi,
|
|
22
|
+
OpenApiTypeChecker,
|
|
23
|
+
} from "@samchon/openapi";
|
|
24
|
+
import { HashMap, IPointer, Pair } from "tstl";
|
|
25
|
+
import typia, { IJsonSchemaUnit } from "typia";
|
|
26
|
+
|
|
27
|
+
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
28
|
+
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
29
|
+
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
30
|
+
import { enforceToolCall } from "../../utils/enforceToolCall";
|
|
31
|
+
import { compileTestScenario } from "./compile/compileTestScenario";
|
|
32
|
+
import { IAutoBeTestScenarioArtifacts } from "./structures/IAutoBeTestScenarioArtifacts";
|
|
33
|
+
import { IAutoBeTestWriteResult } from "./structures/IAutoBeTestWriteResult";
|
|
34
|
+
import { transformTestWriteHistories } from "./transformTestWriteHistories";
|
|
35
|
+
|
|
36
|
+
export async function orchestrateTestWrite<Model extends ILlmSchema.Model>(
|
|
37
|
+
ctx: AutoBeContext<Model>,
|
|
38
|
+
scenarios: AutoBeTestScenario[],
|
|
39
|
+
life: number = 4,
|
|
40
|
+
): Promise<IAutoBeTestWriteResult[]> {
|
|
41
|
+
const start: Date = new Date();
|
|
42
|
+
let complete: number = 0;
|
|
43
|
+
|
|
44
|
+
const writes: Array<IAutoBeTestWriteResult | null> = await Promise.all(
|
|
45
|
+
/**
|
|
46
|
+
* Generate test code for each scenario. Maps through plans array to create
|
|
47
|
+
* individual test code implementations. Each scenario is processed to
|
|
48
|
+
* generate corresponding test code and progress events.
|
|
49
|
+
*/
|
|
50
|
+
scenarios.map(
|
|
51
|
+
async (
|
|
52
|
+
scenario: AutoBeTestScenario,
|
|
53
|
+
): Promise<IAutoBeTestWriteResult | null> => {
|
|
54
|
+
const artifacts: IAutoBeTestScenarioArtifacts =
|
|
55
|
+
await compileTestScenario(ctx, scenario);
|
|
56
|
+
const result: ICreateTestCodeProps | null = await (async () => {
|
|
57
|
+
try {
|
|
58
|
+
return await process(ctx, scenario, artifacts, life, null);
|
|
59
|
+
} catch {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
})();
|
|
63
|
+
if (result === null) return null;
|
|
64
|
+
|
|
65
|
+
const event: AutoBeTestWriteEvent = {
|
|
66
|
+
type: "testWrite",
|
|
67
|
+
created_at: start.toISOString(),
|
|
68
|
+
file: {
|
|
69
|
+
location: `test/features/api/${result.domain}/${scenario.functionName}.ts`,
|
|
70
|
+
function: result.function,
|
|
71
|
+
content: await ctx.compiler.test.write({
|
|
72
|
+
scenario,
|
|
73
|
+
document: ctx.state().interface!.document,
|
|
74
|
+
function: result.function,
|
|
75
|
+
}),
|
|
76
|
+
scenario,
|
|
77
|
+
},
|
|
78
|
+
completed: ++complete,
|
|
79
|
+
total: scenarios.length,
|
|
80
|
+
step: ctx.state().interface?.step ?? 0,
|
|
81
|
+
};
|
|
82
|
+
ctx.dispatch(event);
|
|
83
|
+
return {
|
|
84
|
+
artifacts,
|
|
85
|
+
file: event.file,
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
),
|
|
89
|
+
);
|
|
90
|
+
return writes.filter((w) => w !== null);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Process function that generates test code for each individual scenario. Takes
|
|
95
|
+
* the AutoBeContext and scenario information as input and uses MicroAgentica to
|
|
96
|
+
* generate appropriate test code through LLM interaction.
|
|
97
|
+
*
|
|
98
|
+
* @param ctx - The AutoBeContext containing model, vendor and configuration
|
|
99
|
+
* @param scenario - The test scenario information to generate code for
|
|
100
|
+
* @param artifacts - The artifacts containing the reference files and schemas
|
|
101
|
+
* @returns Promise resolving to ICreateTestCodeProps containing the generated
|
|
102
|
+
* test code
|
|
103
|
+
*/
|
|
104
|
+
async function process<Model extends ILlmSchema.Model>(
|
|
105
|
+
ctx: AutoBeContext<Model>,
|
|
106
|
+
scenario: AutoBeTestScenario,
|
|
107
|
+
artifacts: IAutoBeTestScenarioArtifacts,
|
|
108
|
+
life: number,
|
|
109
|
+
failure: IValidation.IFailure | null,
|
|
110
|
+
): Promise<ICreateTestCodeProps | null> {
|
|
111
|
+
// function calling
|
|
112
|
+
const trials: IValidation.IFailure[] = [];
|
|
113
|
+
const pointer: IPointer<ICreateTestCodeProps | null> = {
|
|
114
|
+
value: null,
|
|
115
|
+
};
|
|
116
|
+
const agentica = new MicroAgentica({
|
|
117
|
+
model: ctx.model,
|
|
118
|
+
vendor: ctx.vendor,
|
|
119
|
+
config: {
|
|
120
|
+
...(ctx.config ?? {}),
|
|
121
|
+
executor: {
|
|
122
|
+
describe: null,
|
|
123
|
+
},
|
|
124
|
+
systemPrompt: {
|
|
125
|
+
validate: (events) =>
|
|
126
|
+
[
|
|
127
|
+
AgenticaSystemPrompt.VALIDATE_REPEATED.replace(
|
|
128
|
+
"${{HISTORICAL_ERRORS}}",
|
|
129
|
+
JSON.stringify(events.map((e) => e.result.errors)),
|
|
130
|
+
),
|
|
131
|
+
AutoBeSystemPromptConstant.TEST_VALIDATE.replace(
|
|
132
|
+
"${{AutoBeTest.IStatement}}",
|
|
133
|
+
getUnionTypeName(typia.json.schema<AutoBeTest.IStatement>()),
|
|
134
|
+
).replace(
|
|
135
|
+
"${{AutoBeTest.IExpression}}",
|
|
136
|
+
getUnionTypeName(typia.json.schema<AutoBeTest.IExpression>()),
|
|
137
|
+
),
|
|
138
|
+
].join("\n\n"),
|
|
139
|
+
},
|
|
140
|
+
retry: 4,
|
|
141
|
+
},
|
|
142
|
+
histories: transformTestWriteHistories({
|
|
143
|
+
scenario,
|
|
144
|
+
artifacts,
|
|
145
|
+
failure,
|
|
146
|
+
}),
|
|
147
|
+
controllers: [
|
|
148
|
+
createApplication({
|
|
149
|
+
model: ctx.model,
|
|
150
|
+
document: ctx.state().interface!.document,
|
|
151
|
+
build: (next) => {
|
|
152
|
+
pointer.value = next;
|
|
153
|
+
},
|
|
154
|
+
}),
|
|
155
|
+
],
|
|
156
|
+
});
|
|
157
|
+
enforceToolCall(agentica);
|
|
158
|
+
agentica.on("validate", (e) => {
|
|
159
|
+
trials.push(e.result);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
await agentica.conversate("Create e2e test functions.").finally(() => {
|
|
163
|
+
const tokenUsage = agentica.getTokenUsage();
|
|
164
|
+
ctx.usage().record(tokenUsage, ["test"]);
|
|
165
|
+
});
|
|
166
|
+
if (pointer.value === null) {
|
|
167
|
+
console.log(
|
|
168
|
+
"failed to pass validation",
|
|
169
|
+
(trials.at(-1)?.data as ICreateTestCodeProps | undefined)?.function.draft,
|
|
170
|
+
trials.map((t) => t.errors.map((e) => e.path)),
|
|
171
|
+
JSON.stringify(trials.at(-1), null, 2),
|
|
172
|
+
);
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
console.log("Function calling success", trials.length + 1);
|
|
176
|
+
|
|
177
|
+
// custom validation by compiler
|
|
178
|
+
const document: AutoBeOpenApi.IDocument = ctx.state().interface!.document;
|
|
179
|
+
const errors: IValidation.IError[] | null = await ctx.compiler.test.validate({
|
|
180
|
+
document,
|
|
181
|
+
function: pointer.value.function,
|
|
182
|
+
});
|
|
183
|
+
return errors === null || life <= 0
|
|
184
|
+
? pointer.value
|
|
185
|
+
: process(ctx, scenario, artifacts, --life, {
|
|
186
|
+
success: false,
|
|
187
|
+
data: pointer.value,
|
|
188
|
+
errors,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function getUnionTypeName(unit: IJsonSchemaUnit): string {
|
|
193
|
+
if (OpenApiTypeChecker.isReference(unit.schema) === false) return "unknown";
|
|
194
|
+
|
|
195
|
+
const typeName: string = unit.schema.$ref.split("/").pop() ?? "";
|
|
196
|
+
const schema: OpenApi.IJsonSchema | undefined =
|
|
197
|
+
unit.components.schemas?.[typeName];
|
|
198
|
+
if (schema === undefined || OpenApiTypeChecker.isOneOf(schema) === false)
|
|
199
|
+
return "unknown";
|
|
200
|
+
return schema.oneOf
|
|
201
|
+
.filter(OpenApiTypeChecker.isReference)
|
|
202
|
+
.map((r) => r.$ref.split("/").pop() ?? "")
|
|
203
|
+
.join(" | ");
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function createApplication<Model extends ILlmSchema.Model>(props: {
|
|
207
|
+
model: Model;
|
|
208
|
+
document: AutoBeOpenApi.IDocument;
|
|
209
|
+
build: (next: ICreateTestCodeProps) => void;
|
|
210
|
+
}): IAgenticaController.IClass<Model> {
|
|
211
|
+
assertSchemaModel(props.model);
|
|
212
|
+
|
|
213
|
+
const endpoints: HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IOperation> =
|
|
214
|
+
new HashMap(
|
|
215
|
+
props.document.operations.map(
|
|
216
|
+
(op) =>
|
|
217
|
+
new Pair(
|
|
218
|
+
{
|
|
219
|
+
method: op.method,
|
|
220
|
+
path: op.path,
|
|
221
|
+
},
|
|
222
|
+
op,
|
|
223
|
+
),
|
|
224
|
+
),
|
|
225
|
+
AutoBeEndpointComparator.hashCode,
|
|
226
|
+
AutoBeEndpointComparator.equals,
|
|
227
|
+
);
|
|
228
|
+
const application: ILlmApplication<Model> = collection[
|
|
229
|
+
props.model
|
|
230
|
+
] as unknown as ILlmApplication<Model>;
|
|
231
|
+
application.functions[0].validate = (
|
|
232
|
+
input: unknown,
|
|
233
|
+
): IValidation<unknown> => {
|
|
234
|
+
const result: IValidation<ICreateTestCodeProps> =
|
|
235
|
+
typia.validate<ICreateTestCodeProps>(input);
|
|
236
|
+
if (result.success === false) return result;
|
|
237
|
+
|
|
238
|
+
const context: IAutoBeTextValidateContext = {
|
|
239
|
+
function: result.data.function,
|
|
240
|
+
document: props.document,
|
|
241
|
+
endpoints,
|
|
242
|
+
errors: [],
|
|
243
|
+
};
|
|
244
|
+
validateTestFunction(context);
|
|
245
|
+
return context.errors.length === 0
|
|
246
|
+
? result
|
|
247
|
+
: {
|
|
248
|
+
success: false,
|
|
249
|
+
data: result.data,
|
|
250
|
+
errors: context.errors,
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
return {
|
|
255
|
+
protocol: "class",
|
|
256
|
+
name: "Create Test Code",
|
|
257
|
+
application,
|
|
258
|
+
execute: {
|
|
259
|
+
createTestCode: (next) => {
|
|
260
|
+
props.build(next);
|
|
261
|
+
},
|
|
262
|
+
} satisfies IApplication,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const claude = typia.llm.application<
|
|
267
|
+
IApplication,
|
|
268
|
+
"claude",
|
|
269
|
+
{ reference: true }
|
|
270
|
+
>();
|
|
271
|
+
const collection = {
|
|
272
|
+
chatgpt: typia.llm.application<
|
|
273
|
+
IApplication,
|
|
274
|
+
"chatgpt",
|
|
275
|
+
{ reference: true }
|
|
276
|
+
>(),
|
|
277
|
+
claude,
|
|
278
|
+
llama: claude,
|
|
279
|
+
deepseek: claude,
|
|
280
|
+
"3.1": claude,
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
interface IApplication {
|
|
284
|
+
createTestCode(props: ICreateTestCodeProps): void;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
interface ICreateTestCodeProps {
|
|
288
|
+
/**
|
|
289
|
+
* Functional domain classification for test organization.
|
|
290
|
+
*
|
|
291
|
+
* Determines file structure and test categorization based on API
|
|
292
|
+
* functionality. Used for organizing tests into logical groups and directory
|
|
293
|
+
* hierarchies.
|
|
294
|
+
*
|
|
295
|
+
* ### Naming Rules:
|
|
296
|
+
*
|
|
297
|
+
* - Lowercase English words only
|
|
298
|
+
* - Singular nouns (e.g., "article", "user", "comment")
|
|
299
|
+
* - Kebab-case for compound words (e.g., "user-profile", "payment-method")
|
|
300
|
+
* - Match primary API resource being tested
|
|
301
|
+
* - Domain Name must be named only one word.
|
|
302
|
+
*
|
|
303
|
+
* ### Domain Examples:
|
|
304
|
+
*
|
|
305
|
+
* - `article` → Article management operations
|
|
306
|
+
* - `comment` → Comment-related functionality
|
|
307
|
+
* - `auth` → Authentication and authorization
|
|
308
|
+
* - `user` → User management operations
|
|
309
|
+
* - `payment` → Payment processing
|
|
310
|
+
* - `notification` → Notification system
|
|
311
|
+
*/
|
|
312
|
+
domain: string;
|
|
313
|
+
|
|
314
|
+
/** E2E test function implementation. */
|
|
315
|
+
function: AutoBeTest.IFunction;
|
|
316
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
+
import { IAutoBeTypeScriptCompileResult } from "@autobe/interface";
|
|
3
|
+
import { v4 } from "uuid";
|
|
4
|
+
|
|
5
|
+
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
6
|
+
import { IAutoBeTestWriteResult } from "./structures/IAutoBeTestWriteResult";
|
|
7
|
+
|
|
8
|
+
export const transformTestCorrectHistories = (
|
|
9
|
+
// ctx: AutoBeContext<Model>,
|
|
10
|
+
written: IAutoBeTestWriteResult,
|
|
11
|
+
failure: IAutoBeTypeScriptCompileResult.IFailure,
|
|
12
|
+
): Array<
|
|
13
|
+
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
14
|
+
> => {
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
id: v4(),
|
|
18
|
+
created_at: new Date().toISOString(),
|
|
19
|
+
type: "systemMessage",
|
|
20
|
+
text: AutoBeSystemPromptConstant.TEST_WRITE,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: v4(),
|
|
24
|
+
created_at: new Date().toISOString(),
|
|
25
|
+
type: "assistantMessage",
|
|
26
|
+
text: [
|
|
27
|
+
"## Original Code",
|
|
28
|
+
"## `AutoBeTest.IFunction` data",
|
|
29
|
+
"```json",
|
|
30
|
+
JSON.stringify(written.file.function),
|
|
31
|
+
"```",
|
|
32
|
+
"## Generated TypeScript Code",
|
|
33
|
+
"```typescript",
|
|
34
|
+
written.file.content,
|
|
35
|
+
"```",
|
|
36
|
+
"",
|
|
37
|
+
"## Compile Errors",
|
|
38
|
+
"Fix the compilation error in the provided code.",
|
|
39
|
+
"",
|
|
40
|
+
"```json",
|
|
41
|
+
JSON.stringify(failure.diagnostics),
|
|
42
|
+
"```",
|
|
43
|
+
].join("\n"),
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: v4(),
|
|
47
|
+
created_at: new Date().toISOString(),
|
|
48
|
+
type: "systemMessage",
|
|
49
|
+
text: AutoBeSystemPromptConstant.TEST_CORRECT,
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AutoBeAssistantMessageHistory,
|
|
3
3
|
AutoBeOpenApi,
|
|
4
|
+
AutoBeTestFile,
|
|
4
5
|
AutoBeTestHistory,
|
|
6
|
+
AutoBeTestScenarioEvent,
|
|
5
7
|
AutoBeTestValidateEvent,
|
|
6
|
-
|
|
8
|
+
IAutoBeTypeScriptCompileResult,
|
|
7
9
|
} from "@autobe/interface";
|
|
8
10
|
import { ILlmSchema } from "@samchon/openapi";
|
|
9
11
|
import { v4 } from "uuid";
|
|
@@ -13,6 +15,7 @@ import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
|
|
|
13
15
|
import { orchestrateTestCorrect } from "./orchestrateTestCorrect";
|
|
14
16
|
import { orchestrateTestScenario } from "./orchestrateTestScenario";
|
|
15
17
|
import { orchestrateTestWrite } from "./orchestrateTestWrite";
|
|
18
|
+
import { IAutoBeTestWriteResult } from "./structures/IAutoBeTestWriteResult";
|
|
16
19
|
|
|
17
20
|
export const orchestrateTest =
|
|
18
21
|
<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>) =>
|
|
@@ -45,41 +48,55 @@ export const orchestrateTest =
|
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
// PLAN
|
|
48
|
-
const
|
|
51
|
+
const scenarioEvent: AutoBeTestScenarioEvent =
|
|
52
|
+
await orchestrateTestScenario(ctx);
|
|
53
|
+
ctx.dispatch(scenarioEvent);
|
|
49
54
|
|
|
50
55
|
// TEST CODE
|
|
51
|
-
const
|
|
56
|
+
const written: IAutoBeTestWriteResult[] = await orchestrateTestWrite(
|
|
52
57
|
ctx,
|
|
53
|
-
scenarios,
|
|
58
|
+
scenarioEvent.scenarios,
|
|
54
59
|
);
|
|
55
|
-
|
|
56
|
-
const correct: AutoBeTestValidateEvent = await orchestrateTestCorrect(
|
|
60
|
+
const corrects: AutoBeTestValidateEvent[] = await orchestrateTestCorrect(
|
|
57
61
|
ctx,
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
written,
|
|
63
|
+
);
|
|
64
|
+
const success: AutoBeTestValidateEvent[] = corrects.filter(
|
|
65
|
+
(c) => c.result.type === "success",
|
|
60
66
|
);
|
|
67
|
+
|
|
68
|
+
// DO COMPILE
|
|
69
|
+
const files: AutoBeTestFile[] = success.map((c) => c.file);
|
|
70
|
+
const compiled: IAutoBeTypeScriptCompileResult =
|
|
71
|
+
await ctx.compiler.test.compile({
|
|
72
|
+
files: {
|
|
73
|
+
...Object.fromEntries(
|
|
74
|
+
Object.entries(ctx.state().interface!.files).filter(
|
|
75
|
+
([key]) => key.startsWith("src/api") === true,
|
|
76
|
+
),
|
|
77
|
+
),
|
|
78
|
+
...Object.fromEntries(files.map((f) => [f.location, f.content])),
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
|
|
61
82
|
const history: AutoBeTestHistory = {
|
|
62
83
|
type: "test",
|
|
63
84
|
id: v4(),
|
|
64
85
|
completed_at: new Date().toISOString(),
|
|
65
86
|
created_at: start.toISOString(),
|
|
66
|
-
files
|
|
67
|
-
compiled
|
|
87
|
+
files,
|
|
88
|
+
compiled,
|
|
68
89
|
reason: "Step to the test generation referencing the interface",
|
|
69
90
|
step: ctx.state().interface?.step ?? 0,
|
|
70
91
|
};
|
|
71
92
|
ctx.dispatch({
|
|
72
93
|
type: "testComplete",
|
|
73
94
|
created_at: start.toISOString(),
|
|
74
|
-
files:
|
|
75
|
-
|
|
76
|
-
.reduce((acc, cur) => Object.assign(acc, cur), {}),
|
|
77
|
-
compiled: correct.result,
|
|
95
|
+
files: Object.fromEntries(files.map((f) => [f.location, f.content])),
|
|
96
|
+
compiled,
|
|
78
97
|
step: ctx.state().interface?.step ?? 0,
|
|
79
98
|
});
|
|
80
|
-
|
|
81
99
|
ctx.state().test = history;
|
|
82
100
|
ctx.histories().push(history);
|
|
83
|
-
|
|
84
101
|
return history;
|
|
85
102
|
};
|