@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.
Files changed (168) hide show
  1. package/lib/AutoBeAgent.js +11 -4
  2. package/lib/AutoBeAgent.js.map +1 -1
  3. package/lib/constants/AutoBeSystemPromptConstant.d.ts +7 -6
  4. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  5. package/lib/context/AutoBeTokenUsage.d.ts +15 -1
  6. package/lib/context/AutoBeTokenUsage.js +56 -1
  7. package/lib/context/AutoBeTokenUsage.js.map +1 -1
  8. package/lib/factory/createAutoBeApplication.js +288 -653
  9. package/lib/factory/createAutoBeApplication.js.map +1 -1
  10. package/lib/index.mjs +4225 -6681
  11. package/lib/index.mjs.map +1 -1
  12. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js +80 -321
  13. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +1 -1
  14. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js +0 -1
  15. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js.map +1 -1
  16. package/lib/orchestrate/analyze/orchestrateAnalyze.js +93 -266
  17. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  18. package/lib/orchestrate/facade/transformFacadeStateMessage.js +2 -2
  19. package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
  20. package/lib/orchestrate/index.d.ts +2 -2
  21. package/lib/orchestrate/index.js +4 -4
  22. package/lib/orchestrate/index.js.map +1 -1
  23. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +54 -142
  24. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  25. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +189 -201
  26. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
  27. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +71 -174
  28. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  29. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +706 -1099
  30. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  31. package/lib/orchestrate/interface/transformInterfaceHistories.js +2 -0
  32. package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -1
  33. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +60 -177
  34. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  35. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +502 -1073
  36. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  37. package/lib/orchestrate/prisma/orchestratePrismaSchema.js +519 -1125
  38. package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -1
  39. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +9 -0
  40. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
  41. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +8 -0
  42. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
  43. package/lib/orchestrate/realize/orchestrateRealize.d.ts +11 -0
  44. package/lib/orchestrate/realize/orchestrateRealize.js +78 -0
  45. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -0
  46. package/lib/orchestrate/realize/orchestrateRealizeCoder.d.ts +25 -0
  47. package/lib/orchestrate/realize/orchestrateRealizeCoder.js +326 -0
  48. package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -0
  49. package/lib/orchestrate/realize/orchestrateRealizePlanner.d.ts +80 -0
  50. package/lib/orchestrate/realize/orchestrateRealizePlanner.js +53 -0
  51. package/lib/orchestrate/realize/orchestrateRealizePlanner.js.map +1 -0
  52. package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +39 -0
  53. package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js +3 -0
  54. package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js.map +1 -0
  55. package/lib/orchestrate/realize/transformRealizeCoderHistories.d.ts +5 -0
  56. package/lib/orchestrate/realize/transformRealizeCoderHistories.js +127 -0
  57. package/lib/orchestrate/realize/transformRealizeCoderHistories.js.map +1 -0
  58. package/lib/orchestrate/test/compile/completeTestCode.d.ts +2 -0
  59. package/lib/orchestrate/test/compile/completeTestCode.js +21 -0
  60. package/lib/orchestrate/test/compile/completeTestCode.js.map +1 -0
  61. package/lib/orchestrate/test/{filterTestFileName.js → compile/filterTestFileName.js} +1 -1
  62. package/lib/orchestrate/test/compile/filterTestFileName.js.map +1 -0
  63. package/lib/orchestrate/test/compile/getTestExternalDeclarations.d.ts +3 -0
  64. package/lib/orchestrate/test/compile/getTestExternalDeclarations.js +27 -0
  65. package/lib/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -0
  66. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +5 -0
  67. package/lib/orchestrate/test/{compileTestScenario.js → compile/getTestScenarioArtifacts.js} +10 -5
  68. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -0
  69. package/lib/orchestrate/test/orchestrateTest.js +14 -9
  70. package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
  71. package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +3 -2
  72. package/lib/orchestrate/test/orchestrateTestCorrect.js +142 -448
  73. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  74. package/lib/orchestrate/test/orchestrateTestScenario.js +258 -532
  75. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  76. package/lib/orchestrate/test/orchestrateTestWrite.d.ts +3 -2
  77. package/lib/orchestrate/test/orchestrateTestWrite.js +124 -90
  78. package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  79. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +121 -0
  80. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.js +3 -0
  81. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.js.map +1 -0
  82. package/lib/orchestrate/test/structures/IAutoBeTestFunction.d.ts +8 -0
  83. package/lib/{utils/types/BackoffOptions.js → orchestrate/test/structures/IAutoBeTestFunction.js} +1 -1
  84. package/lib/orchestrate/test/structures/IAutoBeTestFunction.js.map +1 -0
  85. package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +14 -2
  86. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +112 -0
  87. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.js +3 -0
  88. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.js.map +1 -0
  89. package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.d.ts +7 -0
  90. package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.js +3 -0
  91. package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.js.map +1 -0
  92. package/lib/orchestrate/test/transformTestCorrectHistories.d.ts +3 -2
  93. package/lib/orchestrate/test/transformTestCorrectHistories.js +28 -67
  94. package/lib/orchestrate/test/transformTestCorrectHistories.js.map +1 -1
  95. package/lib/orchestrate/test/transformTestWriteHistories.d.ts +5 -4
  96. package/lib/orchestrate/test/transformTestWriteHistories.js +161 -43
  97. package/lib/orchestrate/test/transformTestWriteHistories.js.map +1 -1
  98. package/lib/structures/IAutoBeConfig.d.ts +11 -0
  99. package/lib/utils/backoffRetry.d.ts +4 -7
  100. package/lib/utils/backoffRetry.js +19 -37
  101. package/lib/utils/backoffRetry.js.map +1 -1
  102. package/lib/utils/forceRetry.d.ts +1 -0
  103. package/lib/{orchestrate/orchestrateRealize.js → utils/forceRetry.js} +15 -8
  104. package/lib/utils/forceRetry.js.map +1 -0
  105. package/package.json +9 -12
  106. package/src/AutoBeAgent.ts +17 -3
  107. package/src/constants/AutoBeSystemPromptConstant.ts +7 -6
  108. package/src/context/AutoBeTokenUsage.ts +85 -1
  109. package/src/factory/createAutoBeApplication.ts +2 -3
  110. package/src/orchestrate/analyze/AutoBeAnalyzeAgent.ts +8 -3
  111. package/src/orchestrate/analyze/AutoBeAnalyzeReviewer.ts +0 -1
  112. package/src/orchestrate/analyze/orchestrateAnalyze.ts +6 -5
  113. package/src/orchestrate/facade/transformFacadeStateMessage.ts +2 -1
  114. package/src/orchestrate/index.ts +2 -2
  115. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +4 -3
  116. package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +26 -23
  117. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +6 -4
  118. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +14 -11
  119. package/src/orchestrate/interface/transformInterfaceHistories.ts +2 -0
  120. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +10 -5
  121. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +11 -5
  122. package/src/orchestrate/prisma/orchestratePrismaSchema.ts +16 -8
  123. package/src/orchestrate/prisma/transformPrismaComponentsHistories.ts +9 -0
  124. package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +8 -0
  125. package/src/orchestrate/realize/orchestrateRealize.ts +129 -0
  126. package/src/orchestrate/realize/orchestrateRealizeCoder.ts +148 -0
  127. package/src/orchestrate/realize/orchestrateRealizePlanner.ts +115 -0
  128. package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +46 -0
  129. package/src/orchestrate/realize/transformRealizeCoderHistories.ts +136 -0
  130. package/src/orchestrate/test/compile/completeTestCode.ts +35 -0
  131. package/src/orchestrate/test/{filterTestFileName.ts → compile/filterTestFileName.ts} +1 -1
  132. package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +24 -0
  133. package/src/orchestrate/test/{compileTestScenario.ts → compile/getTestScenarioArtifacts.ts} +16 -8
  134. package/src/orchestrate/test/experimental/orchestrateTestCorrect.ast +240 -0
  135. package/src/orchestrate/test/experimental/orchestrateTestWrite.ast +316 -0
  136. package/src/orchestrate/test/experimental/transformTestCorrectHistories.ast +52 -0
  137. package/src/orchestrate/test/orchestrateTest.ts +33 -16
  138. package/src/orchestrate/test/orchestrateTestCorrect.ts +109 -497
  139. package/src/orchestrate/test/orchestrateTestScenario.ts +102 -71
  140. package/src/orchestrate/test/orchestrateTestWrite.ts +55 -181
  141. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +126 -0
  142. package/src/orchestrate/test/structures/IAutoBeTestFunction.ts +10 -0
  143. package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +14 -2
  144. package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +117 -0
  145. package/src/orchestrate/test/structures/IAutoBeTestWriteResult.ts +9 -0
  146. package/src/orchestrate/test/transformTestCorrectHistories.ts +38 -71
  147. package/src/orchestrate/test/transformTestWriteHistories.ts +88 -46
  148. package/src/structures/IAutoBeConfig.ts +9 -0
  149. package/src/utils/backoffRetry.ts +25 -36
  150. package/src/utils/forceRetry.ts +13 -0
  151. package/lib/factory/invertOpenApiDocument.d.ts +0 -3
  152. package/lib/factory/invertOpenApiDocument.js +0 -51
  153. package/lib/factory/invertOpenApiDocument.js.map +0 -1
  154. package/lib/orchestrate/orchestrateRealize.d.ts +0 -5
  155. package/lib/orchestrate/orchestrateRealize.js.map +0 -1
  156. package/lib/orchestrate/test/compileTestScenario.d.ts +0 -5
  157. package/lib/orchestrate/test/compileTestScenario.js.map +0 -1
  158. package/lib/orchestrate/test/filterTestFileName.js.map +0 -1
  159. package/lib/utils/StringUtil.d.ts +0 -4
  160. package/lib/utils/StringUtil.js +0 -43
  161. package/lib/utils/StringUtil.js.map +0 -1
  162. package/lib/utils/types/BackoffOptions.d.ts +0 -12
  163. package/lib/utils/types/BackoffOptions.js.map +0 -1
  164. package/src/factory/invertOpenApiDocument.ts +0 -63
  165. package/src/orchestrate/orchestrateRealize.ts +0 -18
  166. package/src/utils/StringUtil.ts +0 -45
  167. package/src/utils/types/BackoffOptions.ts +0 -15
  168. /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 = 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 compileTestScenario_1 = require("./compileTestScenario");
56
- const filterTestFileName_1 = require("./filterTestFileName");
54
+ const forceRetry_1 = require("../../utils/forceRetry");
55
+ const completeTestCode_1 = require("./compile/completeTestCode");
57
56
  const transformTestCorrectHistories_1 = require("./transformTestCorrectHistories");
58
- function orchestrateTestCorrect(ctx_1, codes_1, scenarios_1) {
59
- return __awaiter(this, arguments, void 0, function* (ctx, codes, scenarios, life = 4) {
60
- var _a, _b;
61
- const files = codes.map(({ filename, content }, index) => {
62
- const scenario = scenarios[index];
63
- return { location: filename, content, scenario };
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
- const mergedFiles = Object.assign(Object.assign(Object.assign(Object.assign({}, retainedFiles), testFiles), (yield external("node_modules/@nestia/e2e/lib/TestValidator.d.ts"))), (yield external("node_modules/@nestia/fetcher/lib/IConnection.d.ts")));
77
- // 4) Ask the LLM to correct the filtered file set
78
- const response = yield step(ctx, mergedFiles, files, life);
79
- // 5) Combine original + corrected files and dispatch event
80
- const event = Object.assign(Object.assign({}, response), { type: "testValidate", files: [
81
- ...Object.entries(mergedFiles).map(([filename, content]) => {
82
- return {
83
- location: filename,
84
- content,
85
- };
86
- }),
87
- ...response.files,
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
- * Modifies test code for each file and checks for compilation errors. When
94
- * compilation errors occur, it uses LLM to fix the code and attempts
95
- * recompilation. This process repeats up to the maximum retry count until
96
- * compilation succeeds.
97
- *
98
- * The function is a critical part of the test generation pipeline that ensures
99
- * all generated test files are syntactically correct and compilable.
100
- *
101
- * @param ctx AutoBe context object
102
- * @param entireFiles Map of all files to compile (filename: content)
103
- * @param testFiles Map of files to compile (filename: content)
104
- * @param life Number of remaining retry attempts
105
- * @returns Event object containing successful compilation result and modified
106
- * files
107
- */
108
- function step(ctx, entireFiles, testFiles, life) {
109
- return __awaiter(this, void 0, void 0, function* () {
110
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
111
- // COMPILE TEST CODE
112
- const result = yield ctx.compiler.typescript.compile({
113
- files: Object.assign(Object.assign({}, entireFiles), testFiles
114
- .map((el) => ({ [el.location]: el.content }))
115
- .reduce((acc, cur) => Object.assign(acc, cur), {})),
116
- });
117
- if (result.type === "success") {
118
- // SUCCESS
119
- return {
120
- type: "testValidate",
121
- created_at: new Date().toISOString(),
122
- files: testFiles,
123
- result,
124
- step: (_b = (_a = ctx.state().interface) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : 0,
125
- };
126
- }
127
- // EXCEPTION ERROR
128
- if (result.type === "exception") {
129
- ctx.dispatch({
130
- type: "testValidate",
131
- created_at: new Date().toISOString(),
132
- files: testFiles,
133
- result,
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
- * Modifies the code of test files where errors occurred. This function
217
- * processes TypeScript compiler diagnostics and attempts to fix compilation
218
- * errors.
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
- function formatDiagnostic(code, lines, diagnostic) {
292
- var _a, _b, _c;
293
- const { start, length, messageText } = diagnostic;
294
- const message = messageText;
295
- if (typeof start === "number" && typeof length === "number") {
296
- const end = start + length;
297
- const problematicCode = code.substring(start, end);
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
- correctTestCode: (next) => {
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,44 @@ const claude = {
392
158
  },
393
159
  functions: [
394
160
  {
395
- name: "correctTestCode",
161
+ name: "rewrite",
396
162
  parameters: {
397
- description: "Current Type: {@link ICorrectTestFunctionProps}",
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 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.",
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
- 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.",
171
+ 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",
172
+ type: "string"
173
+ },
174
+ draft: {
175
+ 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
176
  type: "string"
407
177
  },
408
- solution: {
409
- title: "Step 3: Concrete action plan for fixing the identified issues",
410
- 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.",
178
+ review: {
179
+ 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
180
  type: "string"
412
181
  },
413
- content: {
414
- title: "Step 4: The corrected TypeScript test code",
415
- 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.",
182
+ final: {
183
+ 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
184
  type: "string"
417
185
  }
418
186
  },
419
187
  required: [
420
188
  "think_without_compile_error",
421
189
  "think_again_with_compile_error",
422
- "solution",
423
- "content"
190
+ "draft",
191
+ "review",
192
+ "final"
424
193
  ],
425
194
  additionalProperties: false,
426
195
  $defs: {}
427
196
  },
428
- 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, {
197
+ 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.",
198
+ 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
199
  path: _path + ".think_without_compile_error",
430
200
  expected: "string",
431
201
  value: input.think_without_compile_error
@@ -433,25 +203,29 @@ const claude = {
433
203
  path: _path + ".think_again_with_compile_error",
434
204
  expected: "string",
435
205
  value: input.think_again_with_compile_error
436
- }), "string" === typeof input.solution || _report(_exceptionable, {
437
- path: _path + ".solution",
206
+ }), "string" === typeof input.draft || _report(_exceptionable, {
207
+ path: _path + ".draft",
208
+ expected: "string",
209
+ value: input.draft
210
+ }), "string" === typeof input.review || _report(_exceptionable, {
211
+ path: _path + ".review",
438
212
  expected: "string",
439
- value: input.solution
440
- }), "string" === typeof input.content || _report(_exceptionable, {
441
- path: _path + ".content",
213
+ value: input.review
214
+ }), "string" === typeof input.final || _report(_exceptionable, {
215
+ path: _path + ".final",
442
216
  expected: "string",
443
- value: input.content
217
+ value: input.final
444
218
  })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
445
219
  if (false === __is(input)) {
446
220
  errors = [];
447
221
  _report = __typia_transform__validateReport._validateReport(errors);
448
222
  ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
449
223
  path: _path + "",
450
- expected: "ICorrectTestFunctionProps",
224
+ expected: "IAutoBeTestCorrectApplication.IProps",
451
225
  value: input
452
226
  })) && _vo0(input, _path + "", true) || _report(true, {
453
227
  path: _path + "",
454
- expected: "ICorrectTestFunctionProps",
228
+ expected: "IAutoBeTestCorrectApplication.IProps",
455
229
  value: input
456
230
  }))(input, "$input", true);
457
231
  const success = 0 === errors.length;
@@ -482,40 +256,44 @@ const collection = {
482
256
  },
483
257
  functions: [
484
258
  {
485
- name: "correctTestCode",
259
+ name: "rewrite",
486
260
  parameters: {
487
- description: "Current Type: {@link ICorrectTestFunctionProps}",
261
+ 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
262
  type: "object",
489
263
  properties: {
490
264
  think_without_compile_error: {
491
- 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.",
265
+ 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
266
  type: "string"
493
267
  },
494
268
  think_again_with_compile_error: {
495
- 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.",
269
+ 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
270
  type: "string"
497
271
  },
498
- solution: {
499
- title: "Step 3: Concrete action plan for fixing the identified issues",
500
- 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.",
272
+ draft: {
273
+ 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
274
  type: "string"
502
275
  },
503
- content: {
504
- title: "Step 4: The corrected TypeScript test code",
505
- 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.",
276
+ review: {
277
+ 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",
278
+ type: "string"
279
+ },
280
+ final: {
281
+ 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
282
  type: "string"
507
283
  }
508
284
  },
509
285
  required: [
510
286
  "think_without_compile_error",
511
287
  "think_again_with_compile_error",
512
- "solution",
513
- "content"
288
+ "draft",
289
+ "review",
290
+ "final"
514
291
  ],
515
292
  additionalProperties: false,
516
293
  $defs: {}
517
294
  },
518
- 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, {
295
+ 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.",
296
+ 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
297
  path: _path + ".think_without_compile_error",
520
298
  expected: "string",
521
299
  value: input.think_without_compile_error
@@ -523,25 +301,29 @@ const collection = {
523
301
  path: _path + ".think_again_with_compile_error",
524
302
  expected: "string",
525
303
  value: input.think_again_with_compile_error
526
- }), "string" === typeof input.solution || _report(_exceptionable, {
527
- path: _path + ".solution",
304
+ }), "string" === typeof input.draft || _report(_exceptionable, {
305
+ path: _path + ".draft",
306
+ expected: "string",
307
+ value: input.draft
308
+ }), "string" === typeof input.review || _report(_exceptionable, {
309
+ path: _path + ".review",
528
310
  expected: "string",
529
- value: input.solution
530
- }), "string" === typeof input.content || _report(_exceptionable, {
531
- path: _path + ".content",
311
+ value: input.review
312
+ }), "string" === typeof input.final || _report(_exceptionable, {
313
+ path: _path + ".final",
532
314
  expected: "string",
533
- value: input.content
315
+ value: input.final
534
316
  })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
535
317
  if (false === __is(input)) {
536
318
  errors = [];
537
319
  _report = __typia_transform__validateReport._validateReport(errors);
538
320
  ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
539
321
  path: _path + "",
540
- expected: "ICorrectTestFunctionProps",
322
+ expected: "IAutoBeTestCorrectApplication.IProps",
541
323
  value: input
542
324
  })) && _vo0(input, _path + "", true) || _report(true, {
543
325
  path: _path + "",
544
- expected: "ICorrectTestFunctionProps",
326
+ expected: "IAutoBeTestCorrectApplication.IProps",
545
327
  value: input
546
328
  }))(input, "$input", true);
547
329
  const success = 0 === errors.length;
@@ -566,93 +348,5 @@ const collection = {
566
348
  llama: claude,
567
349
  deepseek: claude,
568
350
  "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
351
  };
658
352
  //# sourceMappingURL=orchestrateTestCorrect.js.map