@autobe/agent 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AutoBeAgent.js +11 -4
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +6 -6
- 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 -643
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/index.mjs +5057 -7211
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js +82 -319
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js +0 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +95 -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 +56 -142
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +195 -199
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +75 -172
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +772 -1097
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/transformInterfaceHistories.js +2 -0
- package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +64 -175
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +552 -1073
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js +571 -1119
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +9 -0
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +8 -0
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.d.ts +11 -0
- package/lib/orchestrate/realize/orchestrateRealize.js +109 -0
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.d.ts +25 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js +337 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeIntegrator.d.ts +52 -0
- package/lib/orchestrate/realize/orchestrateRealizeIntegrator.js +57 -0
- package/lib/orchestrate/realize/orchestrateRealizeIntegrator.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizePlanner.d.ts +80 -0
- package/lib/orchestrate/realize/orchestrateRealizePlanner.js +53 -0
- package/lib/orchestrate/realize/orchestrateRealizePlanner.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeValidator.d.ts +46 -0
- package/lib/orchestrate/realize/orchestrateRealizeValidator.js +37 -0
- package/lib/orchestrate/realize/orchestrateRealizeValidator.js.map +1 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +33 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js +3 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js.map +1 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.d.ts +5 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js +127 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js.map +1 -0
- package/lib/orchestrate/test/compile/completeTestCode.d.ts +2 -0
- package/lib/orchestrate/test/compile/completeTestCode.js +21 -0
- package/lib/orchestrate/test/compile/completeTestCode.js.map +1 -0
- package/lib/orchestrate/test/{filterTestFileName.js → compile/filterTestFileName.js} +1 -1
- package/lib/orchestrate/test/compile/filterTestFileName.js.map +1 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.d.ts +3 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.js +27 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -0
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +5 -0
- package/lib/orchestrate/test/{compileTestScenario.js → compile/getTestScenarioArtifacts.js} +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 +150 -448
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +272 -530
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.d.ts +3 -2
- package/lib/orchestrate/test/orchestrateTestWrite.js +139 -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 +168 -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 +8 -7
- package/src/AutoBeAgent.ts +17 -3
- package/src/constants/AutoBeSystemPromptConstant.ts +6 -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 +169 -0
- package/src/orchestrate/realize/orchestrateRealizeCoder.ts +156 -0
- package/src/orchestrate/realize/orchestrateRealizeIntegrator.ts +75 -0
- package/src/orchestrate/realize/orchestrateRealizePlanner.ts +115 -0
- package/src/orchestrate/realize/orchestrateRealizeValidator.ts +64 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +36 -0
- package/src/orchestrate/realize/transformRealizeCoderHistories.ts +136 -0
- package/src/orchestrate/test/compile/completeTestCode.ts +35 -0
- package/src/orchestrate/test/{filterTestFileName.ts → compile/filterTestFileName.ts} +1 -1
- package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +24 -0
- package/src/orchestrate/test/{compileTestScenario.ts → compile/getTestScenarioArtifacts.ts} +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
|
@@ -45,332 +45,96 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.orchestrateTestCorrect =
|
|
48
|
+
exports.orchestrateTestCorrect = void 0;
|
|
49
49
|
const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
|
|
50
50
|
const core_1 = require("@agentica/core");
|
|
51
51
|
const typia_1 = __importDefault(require("typia"));
|
|
52
52
|
const assertSchemaModel_1 = require("../../context/assertSchemaModel");
|
|
53
|
-
const backoffRetry_1 = require("../../utils/backoffRetry");
|
|
54
53
|
const enforceToolCall_1 = require("../../utils/enforceToolCall");
|
|
55
|
-
const
|
|
56
|
-
const
|
|
54
|
+
const forceRetry_1 = require("../../utils/forceRetry");
|
|
55
|
+
const completeTestCode_1 = require("./compile/completeTestCode");
|
|
57
56
|
const transformTestCorrectHistories_1 = require("./transformTestCorrectHistories");
|
|
58
|
-
|
|
59
|
-
return
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// 1) Build map of new test files from progress events
|
|
66
|
-
const testFiles = Object.fromEntries(codes.map((c) => [c.filename, c.content]));
|
|
67
|
-
// 2) Keep only files outside the test directory from current state
|
|
68
|
-
const retainedFiles = Object.fromEntries(Object.entries((_b = (_a = ctx.state().interface) === null || _a === void 0 ? void 0 : _a.files) !== null && _b !== void 0 ? _b : {}).filter(([key]) => (0, filterTestFileName_1.filterTestFileName)(key)));
|
|
69
|
-
// 3) Merge and filter: keep .ts/.json, drop anything under "benchmark"
|
|
70
|
-
const external = (location) => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
const content = yield ctx.compiler.typescript.getExternal(location);
|
|
72
|
-
if (content === undefined)
|
|
73
|
-
throw new Error(`File not found: ${location}`);
|
|
74
|
-
return { [location]: content };
|
|
57
|
+
const orchestrateTestCorrect = (ctx_1, writeResult_1, ...args_1) => __awaiter(void 0, [ctx_1, writeResult_1, ...args_1], void 0, function* (ctx, writeResult, life = 4) {
|
|
58
|
+
return Promise.all(writeResult.map((w) => (0, forceRetry_1.forceRetry)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
const event = yield compile(ctx, {
|
|
60
|
+
artifacts: w.artifacts,
|
|
61
|
+
scenario: w.scenario,
|
|
62
|
+
location: w.event.location,
|
|
63
|
+
script: w.event.final,
|
|
75
64
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return event;
|
|
65
|
+
return predicate(ctx, {
|
|
66
|
+
artifacts: w.artifacts,
|
|
67
|
+
scenario: w.scenario,
|
|
68
|
+
location: w.event.location,
|
|
69
|
+
script: w.event.final,
|
|
70
|
+
}, event, life);
|
|
71
|
+
}))));
|
|
72
|
+
});
|
|
73
|
+
exports.orchestrateTestCorrect = orchestrateTestCorrect;
|
|
74
|
+
const compile = (ctx, func) => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
const compiled = yield ctx.compiler.test.compile({
|
|
77
|
+
files: Object.assign(Object.assign(Object.assign({}, func.artifacts.dto), func.artifacts.sdk), { [func.location]: func.script }),
|
|
90
78
|
});
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
step: (_d = (_c = ctx.state().interface) === null || _c === void 0 ? void 0 : _c.step) !== null && _d !== void 0 ? _d : 0,
|
|
135
|
-
});
|
|
136
|
-
throw new Error(JSON.stringify(result.error, null, 2));
|
|
137
|
-
}
|
|
138
|
-
// Make the diagnostics object (e.g. { "test/features/api/article.ts": [error1, error2] })
|
|
139
|
-
const diagnostics = {};
|
|
140
|
-
result.diagnostics.forEach((d) => {
|
|
141
|
-
var _a;
|
|
142
|
-
if (d.file === null)
|
|
143
|
-
return;
|
|
144
|
-
diagnostics[d.file] = (_a = diagnostics[d.file]) !== null && _a !== void 0 ? _a : [];
|
|
145
|
-
diagnostics[d.file].push(d);
|
|
146
|
-
});
|
|
147
|
-
if (Object.keys(diagnostics).length === 0) {
|
|
148
|
-
/**
|
|
149
|
-
* SUCCESS (Because typescript compiler can't success to compile the json
|
|
150
|
-
* files, so result could be failure. but it's success to compile the ts
|
|
151
|
-
* files.)
|
|
152
|
-
*/
|
|
153
|
-
return {
|
|
154
|
-
type: "testValidate",
|
|
155
|
-
created_at: new Date().toISOString(),
|
|
156
|
-
files: testFiles,
|
|
157
|
-
result: Object.assign(Object.assign({}, result), { type: "success" }),
|
|
158
|
-
step: (_f = (_e = ctx.state().interface) === null || _e === void 0 ? void 0 : _e.step) !== null && _f !== void 0 ? _f : 0,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
// Compile Failed
|
|
162
|
-
ctx.dispatch({
|
|
163
|
-
type: "testValidate",
|
|
164
|
-
created_at: new Date().toISOString(),
|
|
165
|
-
files: testFiles,
|
|
166
|
-
result,
|
|
167
|
-
step: (_h = (_g = ctx.state().interface) === null || _g === void 0 ? void 0 : _g.step) !== null && _h !== void 0 ? _h : 0,
|
|
168
|
-
});
|
|
169
|
-
if (life <= 0)
|
|
170
|
-
return {
|
|
171
|
-
type: "testValidate",
|
|
172
|
-
created_at: new Date().toISOString(),
|
|
173
|
-
files: testFiles,
|
|
174
|
-
result,
|
|
175
|
-
step: (_k = (_j = ctx.state().interface) === null || _j === void 0 ? void 0 : _j.step) !== null && _k !== void 0 ? _k : 0,
|
|
176
|
-
};
|
|
177
|
-
// VALIDATION FAILED
|
|
178
|
-
const validatedFiles = yield Promise.all(Object.entries(diagnostics).map((_a) => __awaiter(this, [_a], void 0, function* ([filename, d]) {
|
|
179
|
-
var _b, _c;
|
|
180
|
-
const file = testFiles.find((f) => f.location === filename);
|
|
181
|
-
const code = file === null || file === void 0 ? void 0 : file.content;
|
|
182
|
-
const scenario = file === null || file === void 0 ? void 0 : file.scenario;
|
|
183
|
-
const response = yield process(ctx, d, code, scenario);
|
|
184
|
-
ctx.dispatch({
|
|
185
|
-
type: "testCorrect",
|
|
186
|
-
created_at: new Date().toISOString(),
|
|
187
|
-
files: Object.assign(Object.assign({}, testFiles), { [filename]: response.content }),
|
|
188
|
-
result,
|
|
189
|
-
solution: response.solution,
|
|
190
|
-
think_without_compile_error: response.think_without_compile_error,
|
|
191
|
-
think_again_with_compile_error: response.think_again_with_compile_error,
|
|
192
|
-
step: (_c = (_b = ctx.state().interface) === null || _b === void 0 ? void 0 : _b.step) !== null && _c !== void 0 ? _c : 0,
|
|
193
|
-
});
|
|
194
|
-
return {
|
|
195
|
-
location: filename,
|
|
196
|
-
content: response.content,
|
|
197
|
-
scenario: scenario,
|
|
198
|
-
};
|
|
199
|
-
})));
|
|
200
|
-
return step(ctx, Object.entries(entireFiles)
|
|
201
|
-
.map(([filename, content]) => {
|
|
202
|
-
const overwritten = validatedFiles.find((el) => el.location === filename);
|
|
203
|
-
return overwritten
|
|
204
|
-
? { [overwritten.location]: overwritten.content }
|
|
205
|
-
: {
|
|
206
|
-
[filename]: content,
|
|
207
|
-
};
|
|
208
|
-
})
|
|
209
|
-
.reduce((acc, cur) => Object.assign(acc, cur), {}), testFiles.map((f) => {
|
|
210
|
-
const validated = validatedFiles.find((v) => v.location === f.location);
|
|
211
|
-
return validated ? validated : f;
|
|
212
|
-
}), life - 1);
|
|
79
|
+
return {
|
|
80
|
+
type: "testValidate",
|
|
81
|
+
file: {
|
|
82
|
+
scenario: func.scenario,
|
|
83
|
+
location: func.location,
|
|
84
|
+
content: func.script,
|
|
85
|
+
},
|
|
86
|
+
result: compiled,
|
|
87
|
+
created_at: new Date().toISOString(),
|
|
88
|
+
step: (_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : 0,
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
const predicate = (ctx, content, event, life) => __awaiter(void 0, void 0, void 0, function* () {
|
|
92
|
+
ctx.dispatch(event);
|
|
93
|
+
return event.result.type === "failure"
|
|
94
|
+
? correct(ctx, content, event, life - 1)
|
|
95
|
+
: event;
|
|
96
|
+
});
|
|
97
|
+
const correct = (ctx, content, validate, life) => __awaiter(void 0, void 0, void 0, function* () {
|
|
98
|
+
var _a, _b, _c;
|
|
99
|
+
if (validate.result.type !== "failure")
|
|
100
|
+
return validate;
|
|
101
|
+
else if (--life <= 0)
|
|
102
|
+
return validate;
|
|
103
|
+
const pointer = {
|
|
104
|
+
value: null,
|
|
105
|
+
};
|
|
106
|
+
const agentica = new core_1.MicroAgentica({
|
|
107
|
+
model: ctx.model,
|
|
108
|
+
vendor: ctx.vendor,
|
|
109
|
+
config: Object.assign(Object.assign({}, ((_a = ctx.config) !== null && _a !== void 0 ? _a : {})), { executor: {
|
|
110
|
+
describe: null,
|
|
111
|
+
}, retry: 4 }),
|
|
112
|
+
histories: (0, transformTestCorrectHistories_1.transformTestCorrectHistories)(content, validate.result),
|
|
113
|
+
controllers: [
|
|
114
|
+
createApplication({
|
|
115
|
+
model: ctx.model,
|
|
116
|
+
artifacts: content.artifacts,
|
|
117
|
+
build: (next) => {
|
|
118
|
+
pointer.value = next;
|
|
119
|
+
},
|
|
120
|
+
}),
|
|
121
|
+
],
|
|
213
122
|
});
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
* @param ctx The AutoBeContext containing application state and configuration
|
|
221
|
-
* @param diagnostics Array of TypeScript compiler diagnostics for the errors
|
|
222
|
-
* @param code The source code content to be fixed
|
|
223
|
-
* @returns Promise resolving to corrected test function properties
|
|
224
|
-
*/
|
|
225
|
-
function process(ctx, diagnostics, code, scenario) {
|
|
226
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
227
|
-
var _a;
|
|
228
|
-
const pointer = {
|
|
229
|
-
value: null,
|
|
230
|
-
};
|
|
231
|
-
const artifacts = yield (0, compileTestScenario_1.compileTestScenario)(ctx, scenario);
|
|
232
|
-
const lines = code.split("\n").map((line, num, arr) => {
|
|
233
|
-
const start = arr
|
|
234
|
-
.slice(0, num)
|
|
235
|
-
.map((el) => el.length + 1)
|
|
236
|
-
.reduce((acc, cur) => acc + cur, 0);
|
|
237
|
-
return {
|
|
238
|
-
line: num + 1,
|
|
239
|
-
text: line,
|
|
240
|
-
start: start,
|
|
241
|
-
end: start + line.length + 1, // exclusive
|
|
242
|
-
};
|
|
243
|
-
});
|
|
244
|
-
const agentica = new core_1.MicroAgentica({
|
|
245
|
-
model: ctx.model,
|
|
246
|
-
vendor: Object.assign({}, ctx.vendor),
|
|
247
|
-
config: Object.assign({}, ((_a = ctx.config) !== null && _a !== void 0 ? _a : {})),
|
|
248
|
-
histories: (0, transformTestCorrectHistories_1.transformTestCorrectHistories)(code, artifacts, diagnostics.map((diagnostic) => diagnostic.start === undefined || diagnostic.length === undefined
|
|
249
|
-
? ""
|
|
250
|
-
: formatDiagnostic(code, lines, diagnostic))),
|
|
251
|
-
controllers: [
|
|
252
|
-
createApplication({
|
|
253
|
-
model: ctx.model,
|
|
254
|
-
build: (next) => {
|
|
255
|
-
pointer.value = next;
|
|
256
|
-
},
|
|
257
|
-
}),
|
|
258
|
-
],
|
|
259
|
-
tokenUsage: ctx.usage(),
|
|
260
|
-
});
|
|
261
|
-
(0, enforceToolCall_1.enforceToolCall)(agentica);
|
|
262
|
-
yield (0, backoffRetry_1.randomBackoffRetry)(() => __awaiter(this, void 0, void 0, function* () {
|
|
263
|
-
yield agentica.conversate([
|
|
264
|
-
"# Instructions",
|
|
265
|
-
"1. Focus on the specific error location and message",
|
|
266
|
-
"2. Provide the corrected TypeScript code",
|
|
267
|
-
"3. Ensure the fix resolves the compilation error",
|
|
268
|
-
"",
|
|
269
|
-
"Return only the fixed code without explanations.",
|
|
270
|
-
].join("\n"));
|
|
271
|
-
}));
|
|
272
|
-
if (pointer.value === null)
|
|
273
|
-
throw new Error("Failed to modify test code.");
|
|
274
|
-
const typeReferences = Array.from(new Set(Object.keys(artifacts.document.components.schemas).map((key) => key.split(".")[0])));
|
|
275
|
-
pointer.value.content = pointer.value.content
|
|
276
|
-
.replace(/^[ \t]*import\b[\s\S]*?;[ \t]*$/gm, "")
|
|
277
|
-
.trim();
|
|
278
|
-
pointer.value.content = [
|
|
279
|
-
`import { TestValidator } from "@nestia/e2e";`,
|
|
280
|
-
`import typia, { tags } from "typia";`,
|
|
281
|
-
"",
|
|
282
|
-
`import api from "@ORGANIZATION/PROJECT-api";`,
|
|
283
|
-
...typeReferences.map((ref) => `import type { ${ref} } from "@ORGANIZATION/PROJECT-api/lib/structures/${ref}";`),
|
|
284
|
-
"",
|
|
285
|
-
pointer.value.content,
|
|
286
|
-
].join("\n");
|
|
287
|
-
pointer.value.content = pointer.value.content.replaceAll('string & Format<"uuid">', 'string & tags.Format<"uuid">');
|
|
288
|
-
return pointer.value;
|
|
123
|
+
(0, enforceToolCall_1.enforceToolCall)(agentica);
|
|
124
|
+
yield agentica
|
|
125
|
+
.conversate("Fix the `AutoBeTest.IFunction` data to resolve the compilation error.")
|
|
126
|
+
.finally(() => {
|
|
127
|
+
const tokenUsage = agentica.getTokenUsage();
|
|
128
|
+
ctx.usage().record(tokenUsage, ["test"]);
|
|
289
129
|
});
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
const {
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
const errorLine = (_a = lines.find((line) => line.end > start)) !== null && _a !== void 0 ? _a : null;
|
|
299
|
-
const lineText = (_b = errorLine === null || errorLine === void 0 ? void 0 : errorLine.text) !== null && _b !== void 0 ? _b : "";
|
|
300
|
-
const hints = getHints(message, lineText);
|
|
301
|
-
function createAdjustedArray(n) {
|
|
302
|
-
let start = n - 2;
|
|
303
|
-
// 시작 값이 음수라면, 0부터 시작해서 5개의 숫자 생성
|
|
304
|
-
if (start < 0) {
|
|
305
|
-
start = 0;
|
|
306
|
-
}
|
|
307
|
-
return Array.from({ length: 5 }, (_, i) => start + i);
|
|
308
|
-
}
|
|
309
|
-
const errorLines = createAdjustedArray((_c = errorLine === null || errorLine === void 0 ? void 0 : errorLine.line) !== null && _c !== void 0 ? _c : 0);
|
|
310
|
-
const context = errorLines
|
|
311
|
-
.map((num) => {
|
|
312
|
-
var _a, _b;
|
|
313
|
-
if (num === (errorLine === null || errorLine === void 0 ? void 0 : errorLine.line)) {
|
|
314
|
-
if (lines[num - 1]) {
|
|
315
|
-
return `${(_a = lines[num - 1]) === null || _a === void 0 ? void 0 : _a.text} // <- ERROR LINE (line:${num})`;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
if (lines[num - 1]) {
|
|
319
|
-
return (_b = lines[num - 1]) === null || _b === void 0 ? void 0 : _b.text;
|
|
320
|
-
}
|
|
321
|
-
return null;
|
|
322
|
-
})
|
|
323
|
-
.filter((el) => el !== null);
|
|
324
|
-
return [
|
|
325
|
-
"## Error Information",
|
|
326
|
-
`- Position: Characters ${start} to ${end}`,
|
|
327
|
-
`- Error Message: ${message}`,
|
|
328
|
-
`- Error Lines: \n${context.length
|
|
329
|
-
? [
|
|
330
|
-
"\t```ts", //
|
|
331
|
-
...context.map((el) => `\t${el}`),
|
|
332
|
-
"\t```",
|
|
333
|
-
].join("\n")
|
|
334
|
-
: "(none)"}`,
|
|
335
|
-
`- Problematic Code: ${problematicCode.length > 0 ? `\`${problematicCode}\`` : "(none)"}`,
|
|
336
|
-
...hints.map((hint) => `- Hint: ${hint}`),
|
|
337
|
-
].join("\n");
|
|
338
|
-
}
|
|
339
|
-
return ["## Error Information", `- Error Message: ${message}`].join("\n");
|
|
340
|
-
}
|
|
341
|
-
function getHints(message, lineText) {
|
|
342
|
-
const isTestValidator = lineText.includes("TestValidator");
|
|
343
|
-
const isTypia = message === "Cannot find name 'Format'. Did you mean 'FormData'?";
|
|
344
|
-
const isJest = message === "Cannot find name 'expect'.";
|
|
345
|
-
const isCurrying = isTestValidator && message === "Expected 1 arguments, but got 2";
|
|
346
|
-
const isAssignability = /Argument of type '([^']+)' is not assignable to parameter of type '([^']+)'/.test(message);
|
|
347
|
-
const hints = [];
|
|
348
|
-
if (isTypia) {
|
|
349
|
-
hints.push("If you want to use typia tags, use `tags.Format` instead of `Format`.");
|
|
350
|
-
}
|
|
351
|
-
if (isJest) {
|
|
352
|
-
hints.push('Detected invalid `expect` usage. Use `TestValidator.equals("description")(expected)(actual)`.');
|
|
353
|
-
}
|
|
354
|
-
if (isCurrying) {
|
|
355
|
-
hints.push("`TestValidator.equals` is a curried function and must be called in **three steps**: `title → expected → actual`.");
|
|
356
|
-
}
|
|
357
|
-
else if (isTestValidator) {
|
|
358
|
-
hints.push("The second argument `expected` must be assignable from the type of `actual`. Consider swapping the order if you get a type error.");
|
|
359
|
-
}
|
|
360
|
-
if (isAssignability && isTestValidator) {
|
|
361
|
-
const match = lineText
|
|
362
|
-
.trim()
|
|
363
|
-
.match(/TestValidator\.equals\("([^"]+)"\)\(([^)]+)\)\(([^)]+)\)/);
|
|
364
|
-
if (match) {
|
|
365
|
-
const [, title, expected, actual] = match;
|
|
366
|
-
if (actual.includes(expected)) {
|
|
367
|
-
hints.push(`You can try rearranging the order like this: TestValidator.equals("${title}")(${actual})(${expected})`);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
return hints;
|
|
372
|
-
}
|
|
373
|
-
function createApplication(props) {
|
|
130
|
+
if (pointer.value === null)
|
|
131
|
+
throw new Error("Failed to modify test code.");
|
|
132
|
+
ctx.dispatch(Object.assign({ type: "testCorrect", created_at: new Date().toISOString(), file: validate.file, result: validate.result, step: (_c = (_b = ctx.state().analyze) === null || _b === void 0 ? void 0 : _b.step) !== null && _c !== void 0 ? _c : 0 }, pointer.value));
|
|
133
|
+
const newContent = Object.assign(Object.assign({}, content), { script: pointer.value.final });
|
|
134
|
+
const newValidate = yield compile(ctx, newContent);
|
|
135
|
+
return predicate(ctx, newContent, newValidate, life);
|
|
136
|
+
});
|
|
137
|
+
const createApplication = (props) => {
|
|
374
138
|
(0, assertSchemaModel_1.assertSchemaModel)(props.model);
|
|
375
139
|
const application = collection[props.model];
|
|
376
140
|
return {
|
|
@@ -378,12 +142,14 @@ function createApplication(props) {
|
|
|
378
142
|
name: "Modify Test Code",
|
|
379
143
|
application,
|
|
380
144
|
execute: {
|
|
381
|
-
|
|
145
|
+
rewrite: (next) => {
|
|
146
|
+
next.draft = (0, completeTestCode_1.completeTestCode)(props.artifacts, next.draft);
|
|
147
|
+
next.final = (0, completeTestCode_1.completeTestCode)(props.artifacts, next.final);
|
|
382
148
|
props.build(next);
|
|
383
149
|
},
|
|
384
150
|
},
|
|
385
151
|
};
|
|
386
|
-
}
|
|
152
|
+
};
|
|
387
153
|
const claude = {
|
|
388
154
|
model: "claude",
|
|
389
155
|
options: {
|
|
@@ -392,40 +158,48 @@ const claude = {
|
|
|
392
158
|
},
|
|
393
159
|
functions: [
|
|
394
160
|
{
|
|
395
|
-
name: "
|
|
161
|
+
name: "rewrite",
|
|
396
162
|
parameters: {
|
|
397
|
-
description: "
|
|
163
|
+
description: " Complete specification for error correction workflow including\nanalysis steps, draft implementation, review process, and final code\ngeneration\n\n------------------------------\n\nCurrent Type: {@link IAutoBeTestCorrectApplication.IProps}",
|
|
398
164
|
type: "object",
|
|
399
165
|
properties: {
|
|
400
166
|
think_without_compile_error: {
|
|
401
|
-
description: "Step 1: Initial
|
|
167
|
+
description: "Step 1: Initial analysis and understanding without compilation error\ncontext.\n\nAI analyzes the original test scenario, business requirements, and\nintended functionality without being influenced by compilation errors.\nThis clean analysis establishes a clear understanding of what the test\nshould accomplish, the expected business workflow, and the correct API\nintegration patterns.\n\nThis step ensures that error correction doesn't lose sight of the\noriginal test purpose and helps maintain the intended business logic\nwhile addressing technical compilation issues. The AI develops a\ncomprehensive understanding of the test requirements before diving into\nerror-specific details.\n\nWorkflow: Scenario understanding \u2192 Business logic analysis \u2192 Intended\nfunctionality mapping",
|
|
402
168
|
type: "string"
|
|
403
169
|
},
|
|
404
170
|
think_again_with_compile_error: {
|
|
405
|
-
|
|
171
|
+
title: "Step 2: Compilation error analysis and root cause identification",
|
|
172
|
+
description: "Step 2: Compilation error analysis and root cause identification.\n\nAI re-analyzes the scenario and implementation with full awareness of\ncompilation errors and diagnostic information. This step involves\nsystematic examination of error messages, identification of error\npatterns, and understanding of how compilation issues relate to the\nintended functionality.\n\nThe AI correlates compilation diagnostics with the original requirements\nto understand where the implementation diverged from correct TypeScript\nusage while maintaining the business logic intent. This analysis forms\nthe foundation for targeted error correction strategies.\n\nWorkflow: Error diagnostic analysis \u2192 Root cause identification \u2192\nCorrection strategy planning",
|
|
173
|
+
type: "string"
|
|
174
|
+
},
|
|
175
|
+
draft: {
|
|
176
|
+
title: "Step 3: Draft corrected TypeScript E2E test code implementation",
|
|
177
|
+
description: "Step 3: Draft corrected TypeScript E2E test code implementation.\n\nAI generates the first corrected version of the test code based on error\nanalysis and correction strategies. This draft addresses all identified\ncompilation errors while preserving the original business logic and test\nworkflow. The code must be compilation-error-free and follow all\nestablished conventions.\n\nThe implementation incorporates lessons learned from error analysis to\nproduce properly typed, syntactically correct code that maintains the\nintended test functionality. All type safety requirements and framework\nconventions must be followed in this corrected implementation.\n\nWorkflow: Error correction \u2192 TypeScript implementation \u2192 Functional\npreservation Critical: Must resolve all compilation errors while\nmaintaining original test intent",
|
|
406
178
|
type: "string"
|
|
407
179
|
},
|
|
408
|
-
|
|
409
|
-
title: "Step
|
|
410
|
-
description: "Step
|
|
180
|
+
review: {
|
|
181
|
+
title: "Step 4: Code review and correction validation",
|
|
182
|
+
description: "Step 4: Code review and correction validation.\n\nAI performs a comprehensive review of the corrected draft implementation,\nvalidating that all compilation errors have been resolved and that the\ncode maintains the original functionality. This review examines both\ntechnical correctness and business logic preservation.\n\nThe review process includes verification of TypeScript compilation\ncompatibility, API integration correctness, test workflow completeness,\nand adherence to all quality standards. Any remaining issues or potential\nimprovements are identified for incorporation into the final\nimplementation.\n\nWorkflow: Draft validation \u2192 Compilation verification \u2192 Functionality\nreview \u2192 Quality assessment",
|
|
411
183
|
type: "string"
|
|
412
184
|
},
|
|
413
|
-
|
|
414
|
-
title: "Step
|
|
415
|
-
description: "Step
|
|
185
|
+
final: {
|
|
186
|
+
title: "Step 5: Final production-ready corrected test code",
|
|
187
|
+
description: "Step 5: Final production-ready corrected test code.\n\nAI produces the final, polished version of the corrected test code\nincorporating all review feedback and validation results. This code\nrepresents the completed error correction, guaranteed to compile\nsuccessfully while preserving all original test functionality and\nbusiness logic.\n\nThe final implementation resolves all compilation issues, maintains\nstrict type safety, follows all established conventions, and delivers a\nproduction-ready test that accurately validates the intended API\nbehaviors and user workflows.\n\nWorkflow: Review integration \u2192 Final refinement \u2192 Production-ready\nimplementation This is the ultimate deliverable that will replace the\ncompilation-failed code.",
|
|
416
188
|
type: "string"
|
|
417
189
|
}
|
|
418
190
|
},
|
|
419
191
|
required: [
|
|
420
192
|
"think_without_compile_error",
|
|
421
193
|
"think_again_with_compile_error",
|
|
422
|
-
"
|
|
423
|
-
"
|
|
194
|
+
"draft",
|
|
195
|
+
"review",
|
|
196
|
+
"final"
|
|
424
197
|
],
|
|
425
198
|
additionalProperties: false,
|
|
426
199
|
$defs: {}
|
|
427
200
|
},
|
|
428
|
-
|
|
201
|
+
description: "Main entry point for AI Function Call - analyzes compilation errors and\ngenerates corrected E2E test code.\n\nThe AI executes this function to perform the complete error correction\nworkflow: error-free analysis \u2192 compilation error analysis \u2192 draft\ncorrection \u2192 code review \u2192 final corrected implementation. This multi-step\nprocess ensures systematic error resolution while preserving original test\nfunctionality and maintaining code quality.\n\nThe corrector first analyzes the scenario without considering compilation\nerrors to understand the intended functionality, then incorporates\ncompilation diagnostics to identify specific issues, and finally produces\ncorrected code through iterative refinement with comprehensive review and\nvalidation.",
|
|
202
|
+
validate: (() => { const _io0 = input => "string" === typeof input.think_without_compile_error && "string" === typeof input.think_again_with_compile_error && "string" === typeof input.draft && "string" === typeof input.review && "string" === typeof input.final; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.think_without_compile_error || _report(_exceptionable, {
|
|
429
203
|
path: _path + ".think_without_compile_error",
|
|
430
204
|
expected: "string",
|
|
431
205
|
value: input.think_without_compile_error
|
|
@@ -433,25 +207,29 @@ const claude = {
|
|
|
433
207
|
path: _path + ".think_again_with_compile_error",
|
|
434
208
|
expected: "string",
|
|
435
209
|
value: input.think_again_with_compile_error
|
|
436
|
-
}), "string" === typeof input.
|
|
437
|
-
path: _path + ".
|
|
210
|
+
}), "string" === typeof input.draft || _report(_exceptionable, {
|
|
211
|
+
path: _path + ".draft",
|
|
212
|
+
expected: "string",
|
|
213
|
+
value: input.draft
|
|
214
|
+
}), "string" === typeof input.review || _report(_exceptionable, {
|
|
215
|
+
path: _path + ".review",
|
|
438
216
|
expected: "string",
|
|
439
|
-
value: input.
|
|
440
|
-
}), "string" === typeof input.
|
|
441
|
-
path: _path + ".
|
|
217
|
+
value: input.review
|
|
218
|
+
}), "string" === typeof input.final || _report(_exceptionable, {
|
|
219
|
+
path: _path + ".final",
|
|
442
220
|
expected: "string",
|
|
443
|
-
value: input.
|
|
221
|
+
value: input.final
|
|
444
222
|
})].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
|
|
445
223
|
if (false === __is(input)) {
|
|
446
224
|
errors = [];
|
|
447
225
|
_report = __typia_transform__validateReport._validateReport(errors);
|
|
448
226
|
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
449
227
|
path: _path + "",
|
|
450
|
-
expected: "
|
|
228
|
+
expected: "IAutoBeTestCorrectApplication.IProps",
|
|
451
229
|
value: input
|
|
452
230
|
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
453
231
|
path: _path + "",
|
|
454
|
-
expected: "
|
|
232
|
+
expected: "IAutoBeTestCorrectApplication.IProps",
|
|
455
233
|
value: input
|
|
456
234
|
}))(input, "$input", true);
|
|
457
235
|
const success = 0 === errors.length;
|
|
@@ -482,40 +260,48 @@ const collection = {
|
|
|
482
260
|
},
|
|
483
261
|
functions: [
|
|
484
262
|
{
|
|
485
|
-
name: "
|
|
263
|
+
name: "rewrite",
|
|
486
264
|
parameters: {
|
|
487
|
-
description: "
|
|
265
|
+
description: " Complete specification for error correction workflow including\nanalysis steps, draft implementation, review process, and final code\ngeneration\n\n------------------------------\n\nCurrent Type: {@link IAutoBeTestCorrectApplication.IProps}",
|
|
488
266
|
type: "object",
|
|
489
267
|
properties: {
|
|
490
268
|
think_without_compile_error: {
|
|
491
|
-
description: "Step 1: Initial
|
|
269
|
+
description: "Step 1: Initial analysis and understanding without compilation error\ncontext.\n\nAI analyzes the original test scenario, business requirements, and\nintended functionality without being influenced by compilation errors.\nThis clean analysis establishes a clear understanding of what the test\nshould accomplish, the expected business workflow, and the correct API\nintegration patterns.\n\nThis step ensures that error correction doesn't lose sight of the\noriginal test purpose and helps maintain the intended business logic\nwhile addressing technical compilation issues. The AI develops a\ncomprehensive understanding of the test requirements before diving into\nerror-specific details.\n\nWorkflow: Scenario understanding \u2192 Business logic analysis \u2192 Intended\nfunctionality mapping",
|
|
492
270
|
type: "string"
|
|
493
271
|
},
|
|
494
272
|
think_again_with_compile_error: {
|
|
495
|
-
|
|
273
|
+
title: "Step 2: Compilation error analysis and root cause identification",
|
|
274
|
+
description: "Step 2: Compilation error analysis and root cause identification.\n\nAI re-analyzes the scenario and implementation with full awareness of\ncompilation errors and diagnostic information. This step involves\nsystematic examination of error messages, identification of error\npatterns, and understanding of how compilation issues relate to the\nintended functionality.\n\nThe AI correlates compilation diagnostics with the original requirements\nto understand where the implementation diverged from correct TypeScript\nusage while maintaining the business logic intent. This analysis forms\nthe foundation for targeted error correction strategies.\n\nWorkflow: Error diagnostic analysis \u2192 Root cause identification \u2192\nCorrection strategy planning",
|
|
496
275
|
type: "string"
|
|
497
276
|
},
|
|
498
|
-
|
|
499
|
-
title: "Step 3:
|
|
500
|
-
description: "Step 3:
|
|
277
|
+
draft: {
|
|
278
|
+
title: "Step 3: Draft corrected TypeScript E2E test code implementation",
|
|
279
|
+
description: "Step 3: Draft corrected TypeScript E2E test code implementation.\n\nAI generates the first corrected version of the test code based on error\nanalysis and correction strategies. This draft addresses all identified\ncompilation errors while preserving the original business logic and test\nworkflow. The code must be compilation-error-free and follow all\nestablished conventions.\n\nThe implementation incorporates lessons learned from error analysis to\nproduce properly typed, syntactically correct code that maintains the\nintended test functionality. All type safety requirements and framework\nconventions must be followed in this corrected implementation.\n\nWorkflow: Error correction \u2192 TypeScript implementation \u2192 Functional\npreservation Critical: Must resolve all compilation errors while\nmaintaining original test intent",
|
|
501
280
|
type: "string"
|
|
502
281
|
},
|
|
503
|
-
|
|
504
|
-
title: "Step 4:
|
|
505
|
-
description: "Step 4:
|
|
282
|
+
review: {
|
|
283
|
+
title: "Step 4: Code review and correction validation",
|
|
284
|
+
description: "Step 4: Code review and correction validation.\n\nAI performs a comprehensive review of the corrected draft implementation,\nvalidating that all compilation errors have been resolved and that the\ncode maintains the original functionality. This review examines both\ntechnical correctness and business logic preservation.\n\nThe review process includes verification of TypeScript compilation\ncompatibility, API integration correctness, test workflow completeness,\nand adherence to all quality standards. Any remaining issues or potential\nimprovements are identified for incorporation into the final\nimplementation.\n\nWorkflow: Draft validation \u2192 Compilation verification \u2192 Functionality\nreview \u2192 Quality assessment",
|
|
285
|
+
type: "string"
|
|
286
|
+
},
|
|
287
|
+
final: {
|
|
288
|
+
title: "Step 5: Final production-ready corrected test code",
|
|
289
|
+
description: "Step 5: Final production-ready corrected test code.\n\nAI produces the final, polished version of the corrected test code\nincorporating all review feedback and validation results. This code\nrepresents the completed error correction, guaranteed to compile\nsuccessfully while preserving all original test functionality and\nbusiness logic.\n\nThe final implementation resolves all compilation issues, maintains\nstrict type safety, follows all established conventions, and delivers a\nproduction-ready test that accurately validates the intended API\nbehaviors and user workflows.\n\nWorkflow: Review integration \u2192 Final refinement \u2192 Production-ready\nimplementation This is the ultimate deliverable that will replace the\ncompilation-failed code.",
|
|
506
290
|
type: "string"
|
|
507
291
|
}
|
|
508
292
|
},
|
|
509
293
|
required: [
|
|
510
294
|
"think_without_compile_error",
|
|
511
295
|
"think_again_with_compile_error",
|
|
512
|
-
"
|
|
513
|
-
"
|
|
296
|
+
"draft",
|
|
297
|
+
"review",
|
|
298
|
+
"final"
|
|
514
299
|
],
|
|
515
300
|
additionalProperties: false,
|
|
516
301
|
$defs: {}
|
|
517
302
|
},
|
|
518
|
-
|
|
303
|
+
description: "Main entry point for AI Function Call - analyzes compilation errors and\ngenerates corrected E2E test code.\n\nThe AI executes this function to perform the complete error correction\nworkflow: error-free analysis \u2192 compilation error analysis \u2192 draft\ncorrection \u2192 code review \u2192 final corrected implementation. This multi-step\nprocess ensures systematic error resolution while preserving original test\nfunctionality and maintaining code quality.\n\nThe corrector first analyzes the scenario without considering compilation\nerrors to understand the intended functionality, then incorporates\ncompilation diagnostics to identify specific issues, and finally produces\ncorrected code through iterative refinement with comprehensive review and\nvalidation.",
|
|
304
|
+
validate: (() => { const _io0 = input => "string" === typeof input.think_without_compile_error && "string" === typeof input.think_again_with_compile_error && "string" === typeof input.draft && "string" === typeof input.review && "string" === typeof input.final; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.think_without_compile_error || _report(_exceptionable, {
|
|
519
305
|
path: _path + ".think_without_compile_error",
|
|
520
306
|
expected: "string",
|
|
521
307
|
value: input.think_without_compile_error
|
|
@@ -523,25 +309,29 @@ const collection = {
|
|
|
523
309
|
path: _path + ".think_again_with_compile_error",
|
|
524
310
|
expected: "string",
|
|
525
311
|
value: input.think_again_with_compile_error
|
|
526
|
-
}), "string" === typeof input.
|
|
527
|
-
path: _path + ".
|
|
312
|
+
}), "string" === typeof input.draft || _report(_exceptionable, {
|
|
313
|
+
path: _path + ".draft",
|
|
314
|
+
expected: "string",
|
|
315
|
+
value: input.draft
|
|
316
|
+
}), "string" === typeof input.review || _report(_exceptionable, {
|
|
317
|
+
path: _path + ".review",
|
|
528
318
|
expected: "string",
|
|
529
|
-
value: input.
|
|
530
|
-
}), "string" === typeof input.
|
|
531
|
-
path: _path + ".
|
|
319
|
+
value: input.review
|
|
320
|
+
}), "string" === typeof input.final || _report(_exceptionable, {
|
|
321
|
+
path: _path + ".final",
|
|
532
322
|
expected: "string",
|
|
533
|
-
value: input.
|
|
323
|
+
value: input.final
|
|
534
324
|
})].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
|
|
535
325
|
if (false === __is(input)) {
|
|
536
326
|
errors = [];
|
|
537
327
|
_report = __typia_transform__validateReport._validateReport(errors);
|
|
538
328
|
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
539
329
|
path: _path + "",
|
|
540
|
-
expected: "
|
|
330
|
+
expected: "IAutoBeTestCorrectApplication.IProps",
|
|
541
331
|
value: input
|
|
542
332
|
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
543
333
|
path: _path + "",
|
|
544
|
-
expected: "
|
|
334
|
+
expected: "IAutoBeTestCorrectApplication.IProps",
|
|
545
335
|
value: input
|
|
546
336
|
}))(input, "$input", true);
|
|
547
337
|
const success = 0 === errors.length;
|
|
@@ -566,93 +356,5 @@ const collection = {
|
|
|
566
356
|
llama: claude,
|
|
567
357
|
deepseek: claude,
|
|
568
358
|
"3.1": claude,
|
|
569
|
-
"3.0": {
|
|
570
|
-
model: "3.0",
|
|
571
|
-
options: {
|
|
572
|
-
constraint: true,
|
|
573
|
-
recursive: 3,
|
|
574
|
-
separate: null
|
|
575
|
-
},
|
|
576
|
-
functions: [
|
|
577
|
-
{
|
|
578
|
-
name: "correctTestCode",
|
|
579
|
-
parameters: {
|
|
580
|
-
type: "object",
|
|
581
|
-
properties: {
|
|
582
|
-
think_without_compile_error: {
|
|
583
|
-
type: "string",
|
|
584
|
-
description: "Step 1: Initial self-reflection on the source code without compiler error\ncontext.\n\nThe AI agent analyzes the previously generated test code to identify\npotential issues, relying solely on its understanding of TypeScript syntax,\ntesting patterns, and best practices.\n\nThis encourages the agent to develop independent debugging skills before\nbeing influenced by external error messages."
|
|
585
|
-
},
|
|
586
|
-
think_again_with_compile_error: {
|
|
587
|
-
type: "string",
|
|
588
|
-
description: "Step 2: Re-evaluation of the code with compiler error messages as\nadditional context.\n\nAfter the initial analysis, the AI agent reviews the same code again, this\ntime incorporating the specific TypeScript compiler error messages.\n\nThis allows the agent to correlate its initial observations with concrete\ncompilation failures and refine its understanding of what went wrong."
|
|
589
|
-
},
|
|
590
|
-
solution: {
|
|
591
|
-
type: "string",
|
|
592
|
-
title: "Step 3: Concrete action plan for fixing the identified issues",
|
|
593
|
-
description: "Step 3: Concrete action plan for fixing the identified issues.\n\nBased on the analysis from steps 1 and 2, the AI agent formulates a\nspecific, step-by-step solution strategy.\n\nThis should include what changes need to be made, why those changes are\nnecessary, and how they will resolve the compilation errors while\nmaintaining the test's intended functionality."
|
|
594
|
-
},
|
|
595
|
-
content: {
|
|
596
|
-
type: "string",
|
|
597
|
-
title: "Step 4: The corrected TypeScript test code",
|
|
598
|
-
description: "Step 4: The corrected TypeScript test code.\n\nThe final, properly fixed TypeScript code that should compile without\nerrors.\n\nThis represents the implementation of the solution plan from step 3,\ncontaining all necessary corrections to make the test code syntactically\nvalid and functionally correct."
|
|
599
|
-
}
|
|
600
|
-
},
|
|
601
|
-
required: [
|
|
602
|
-
"think_without_compile_error",
|
|
603
|
-
"think_again_with_compile_error",
|
|
604
|
-
"solution",
|
|
605
|
-
"content"
|
|
606
|
-
],
|
|
607
|
-
description: "Current Type: {@link ICorrectTestFunctionProps}",
|
|
608
|
-
additionalProperties: false
|
|
609
|
-
},
|
|
610
|
-
validate: (() => { const _io0 = input => "string" === typeof input.think_without_compile_error && "string" === typeof input.think_again_with_compile_error && "string" === typeof input.solution && "string" === typeof input.content; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.think_without_compile_error || _report(_exceptionable, {
|
|
611
|
-
path: _path + ".think_without_compile_error",
|
|
612
|
-
expected: "string",
|
|
613
|
-
value: input.think_without_compile_error
|
|
614
|
-
}), "string" === typeof input.think_again_with_compile_error || _report(_exceptionable, {
|
|
615
|
-
path: _path + ".think_again_with_compile_error",
|
|
616
|
-
expected: "string",
|
|
617
|
-
value: input.think_again_with_compile_error
|
|
618
|
-
}), "string" === typeof input.solution || _report(_exceptionable, {
|
|
619
|
-
path: _path + ".solution",
|
|
620
|
-
expected: "string",
|
|
621
|
-
value: input.solution
|
|
622
|
-
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
623
|
-
path: _path + ".content",
|
|
624
|
-
expected: "string",
|
|
625
|
-
value: input.content
|
|
626
|
-
})].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
|
|
627
|
-
if (false === __is(input)) {
|
|
628
|
-
errors = [];
|
|
629
|
-
_report = __typia_transform__validateReport._validateReport(errors);
|
|
630
|
-
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
631
|
-
path: _path + "",
|
|
632
|
-
expected: "ICorrectTestFunctionProps",
|
|
633
|
-
value: input
|
|
634
|
-
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
635
|
-
path: _path + "",
|
|
636
|
-
expected: "ICorrectTestFunctionProps",
|
|
637
|
-
value: input
|
|
638
|
-
}))(input, "$input", true);
|
|
639
|
-
const success = 0 === errors.length;
|
|
640
|
-
return success ? {
|
|
641
|
-
success,
|
|
642
|
-
data: input
|
|
643
|
-
} : {
|
|
644
|
-
success,
|
|
645
|
-
errors,
|
|
646
|
-
data: input
|
|
647
|
-
};
|
|
648
|
-
}
|
|
649
|
-
return {
|
|
650
|
-
success: true,
|
|
651
|
-
data: input
|
|
652
|
-
};
|
|
653
|
-
}; })()
|
|
654
|
-
}
|
|
655
|
-
]
|
|
656
|
-
},
|
|
657
359
|
};
|
|
658
360
|
//# sourceMappingURL=orchestrateTestCorrect.js.map
|