@autobe/agent 0.6.0 → 0.7.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.
Files changed (77) hide show
  1. package/lib/constants/AutoBeSystemPromptConstant.d.ts +4 -1
  2. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  3. package/lib/factory/createAutoBeApplication.js +1 -1
  4. package/lib/factory/createAutoBeApplication.js.map +1 -1
  5. package/lib/index.mjs +1704 -144
  6. package/lib/index.mjs.map +1 -1
  7. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js +15 -18
  8. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +1 -1
  9. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js +3 -5
  10. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js.map +1 -1
  11. package/lib/orchestrate/analyze/orchestrateAnalyze.d.ts +25 -0
  12. package/lib/orchestrate/analyze/orchestrateAnalyze.js +103 -25
  13. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  14. package/lib/orchestrate/index.d.ts +1 -1
  15. package/lib/orchestrate/index.js +1 -1
  16. package/lib/orchestrate/index.js.map +1 -1
  17. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +3 -1
  18. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  19. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +3 -1
  20. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
  21. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +3 -1
  22. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  23. package/lib/orchestrate/interface/transformInterfaceHistories.js +26 -0
  24. package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -1
  25. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +6 -5
  26. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  27. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.d.ts +1 -1
  28. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +21 -1
  29. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
  30. package/lib/orchestrate/{orchestrateTest.d.ts → test/orchestrateTest.d.ts} +2 -2
  31. package/lib/orchestrate/test/orchestrateTest.js +70 -0
  32. package/lib/orchestrate/test/orchestrateTest.js.map +1 -0
  33. package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +4 -0
  34. package/lib/orchestrate/test/orchestrateTestCorrect.js +543 -0
  35. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -0
  36. package/lib/orchestrate/test/orchestrateTestProgress.d.ts +4 -0
  37. package/lib/orchestrate/test/orchestrateTestProgress.js +403 -0
  38. package/lib/orchestrate/test/orchestrateTestProgress.js.map +1 -0
  39. package/lib/orchestrate/test/orchestrateTestScenario.d.ts +4 -0
  40. package/lib/orchestrate/test/orchestrateTestScenario.js +700 -0
  41. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -0
  42. package/lib/orchestrate/test/transformTestCorrectHistories.d.ts +2 -0
  43. package/lib/orchestrate/test/transformTestCorrectHistories.js +47 -0
  44. package/lib/orchestrate/test/transformTestCorrectHistories.js.map +1 -0
  45. package/lib/orchestrate/test/transformTestHistories.d.ts +3 -0
  46. package/lib/orchestrate/test/transformTestHistories.js +74 -0
  47. package/lib/orchestrate/test/transformTestHistories.js.map +1 -0
  48. package/lib/orchestrate/test/transformTestProgressHistories.d.ts +2 -0
  49. package/lib/orchestrate/test/transformTestProgressHistories.js +47 -0
  50. package/lib/orchestrate/test/transformTestProgressHistories.js.map +1 -0
  51. package/lib/orchestrate/test/transformTestScenarioHistories.d.ts +4 -0
  52. package/lib/orchestrate/test/transformTestScenarioHistories.js +176 -0
  53. package/lib/orchestrate/test/transformTestScenarioHistories.js.map +1 -0
  54. package/package.json +4 -4
  55. package/src/constants/AutoBeSystemPromptConstant.ts +4 -1
  56. package/src/factory/createAutoBeApplication.ts +1 -1
  57. package/src/orchestrate/analyze/AutoBeAnalyzeAgent.ts +18 -21
  58. package/src/orchestrate/analyze/AutoBeAnalyzeReviewer.ts +2 -4
  59. package/src/orchestrate/analyze/orchestrateAnalyze.ts +53 -20
  60. package/src/orchestrate/index.ts +1 -1
  61. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +3 -1
  62. package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +3 -1
  63. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +3 -1
  64. package/src/orchestrate/interface/transformInterfaceHistories.ts +25 -0
  65. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +4 -1
  66. package/src/orchestrate/prisma/transformPrismaComponentsHistories.ts +21 -0
  67. package/src/orchestrate/test/orchestrateTest.ts +86 -0
  68. package/src/orchestrate/test/orchestrateTestCorrect.ts +368 -0
  69. package/src/orchestrate/test/orchestrateTestProgress.ts +264 -0
  70. package/src/orchestrate/test/orchestrateTestScenario.ts +178 -0
  71. package/src/orchestrate/test/transformTestCorrectHistories.ts +51 -0
  72. package/src/orchestrate/test/transformTestHistories.ts +77 -0
  73. package/src/orchestrate/test/transformTestProgressHistories.ts +51 -0
  74. package/src/orchestrate/test/transformTestScenarioHistories.ts +184 -0
  75. package/lib/orchestrate/orchestrateTest.js +0 -19
  76. package/lib/orchestrate/orchestrateTest.js.map +0 -1
  77. package/src/orchestrate/orchestrateTest.ts +0 -18
@@ -85,6 +85,31 @@ export const transformInterfaceHistories = (
85
85
  "",
86
86
  state.analyze.reason,
87
87
  "",
88
+ "## Prefix",
89
+ "",
90
+ `* Prefix provided by the user: ${state.analyze?.prefix ?? null}`,
91
+ `* When defining TypeScript interfaces, the interface name must be in PascalCase. The property names, however, do not need to follow this convention.`,
92
+ "",
93
+ "The user wants all TypeScript identifiers (such as interfaces, types, and functions) to start with the prefix provided below. ",
94
+ "If the prefix is `null`, it should be ignored. ",
95
+ "If a prefix is provided, all identifier names **must begin with it**.",
96
+ "",
97
+ "However, if there is a special-purpose prefix like `mv` (e.g., for materialized view handlers or performance-related utilities), it **must precede** the given prefix.",
98
+ "",
99
+ "## Prefix Example",
100
+ "",
101
+ "If the prefix is `shopping`, then names should be like:",
102
+ "",
103
+ "* `shoppingSales`",
104
+ "* `shoppingSaleOptions`",
105
+ "* `shoppingCreateSale()`",
106
+ "",
107
+ "In cases where an identifier is created for performance-optimized logic or special processing (e.g., materialized view handling), the `mv` prefix must come first. ",
108
+ "For example:",
109
+ "",
110
+ "* `mvShoppingDailyStats`",
111
+ "* `mvShoppingAggregateView`",
112
+ "",
88
113
  // Requirement Analysis Report
89
114
  `## Requirement Analysis Report`,
90
115
  "",
@@ -25,13 +25,16 @@ export async function orchestratePrismaComponents<
25
25
  const pointer: IPointer<IExtractComponentsProps | null> = {
26
26
  value: null,
27
27
  };
28
+
29
+ const prefix = ctx.state().analyze?.prefix ?? null;
30
+
28
31
  const agentica: MicroAgentica<Model> = new MicroAgentica({
29
32
  model: ctx.model,
30
33
  vendor: ctx.vendor,
31
34
  config: {
32
35
  ...(ctx.config ?? {}),
33
36
  },
34
- histories: transformPrismaComponentsHistories(ctx.state()),
37
+ histories: transformPrismaComponentsHistories(ctx.state(), prefix),
35
38
  tokenUsage: ctx.usage(),
36
39
  controllers: [
37
40
  createApplication({
@@ -6,6 +6,7 @@ import { AutoBeState } from "../../context/AutoBeState";
6
6
 
7
7
  export const transformPrismaComponentsHistories = (
8
8
  state: AutoBeState,
9
+ prefix: string | null = null,
9
10
  ): Array<
10
11
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
11
12
  > => {
@@ -47,6 +48,26 @@ export const transformPrismaComponentsHistories = (
47
48
  "```json",
48
49
  JSON.stringify(state.analyze.files),
49
50
  "```",
51
+ "## Prefix",
52
+ "",
53
+ `* Prefix provided by the user: ${prefix}`,
54
+ "",
55
+ "The user wants all database schema (table) names to start with the prefix provided below.",
56
+ "If the prefix is `null`, it should be ignored.",
57
+ "If a prefix is provided, all table names **must begin with it**.",
58
+ "However, if there is a special-purpose prefix like `mv` (for materialized views), it **must precede** the given prefix.",
59
+ "",
60
+ "## Prefix Example",
61
+ "",
62
+ "If the prefix is `shopping`, then table names should be like:",
63
+ "",
64
+ "* `shopping_sales`",
65
+ "* `shopping_sale_options`",
66
+ "",
67
+ "In cases where a table is created for performance optimization purposes (e.g., materialized views), the `mv_` prefix must come first.",
68
+ "For example:",
69
+ "",
70
+ "* `mv_shopping_daily_stats`",
50
71
  ].join("\n"),
51
72
  },
52
73
  ];
@@ -0,0 +1,86 @@
1
+ import {
2
+ AutoBeAssistantMessageHistory,
3
+ AutoBeTestHistory,
4
+ AutoBeTestProgressEvent,
5
+ } from "@autobe/interface";
6
+ import { AutoBeTestScenarioEvent } from "@autobe/interface/src/events/AutoBeTestScenarioEvent";
7
+ import { ILlmSchema } from "@samchon/openapi";
8
+ import { v4 } from "uuid";
9
+
10
+ import { AutoBeContext } from "../../context/AutoBeContext";
11
+ import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
12
+ import { orchestrateTestCorrect } from "./orchestrateTestCorrect";
13
+ import { orchestrateTestProgress } from "./orchestrateTestProgress";
14
+ import { orchestrateTestScenario } from "./orchestrateTestScenario";
15
+
16
+ export const orchestrateTest =
17
+ <Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>) =>
18
+ async (
19
+ props: IAutoBeApplicationProps,
20
+ ): Promise<AutoBeAssistantMessageHistory | AutoBeTestHistory> => {
21
+ const start: Date = new Date();
22
+ ctx.dispatch({
23
+ type: "testStart",
24
+ created_at: start.toISOString(),
25
+ reason: props.reason,
26
+ step: ctx.state().analyze?.step ?? 0,
27
+ });
28
+
29
+ const operations = ctx.state().interface?.document.operations ?? [];
30
+ if (operations.length === 0) {
31
+ const history: AutoBeAssistantMessageHistory = {
32
+ id: v4(),
33
+ type: "assistantMessage",
34
+ created_at: start.toISOString(),
35
+ completed_at: new Date().toISOString(),
36
+ text:
37
+ "Unable to write test code because there are no Operations, " +
38
+ "please check if the Interface agent is called.",
39
+ };
40
+
41
+ ctx.histories().push(history);
42
+ ctx.dispatch(history);
43
+
44
+ return history;
45
+ }
46
+
47
+ // SCENARIOS
48
+ const scenarioEvent: AutoBeTestScenarioEvent =
49
+ await orchestrateTestScenario(ctx);
50
+
51
+ const scenarios = scenarioEvent.scenarios
52
+ .map((scenario) => {
53
+ return scenario.scenarios;
54
+ })
55
+ .flat();
56
+
57
+ const codes: AutoBeTestProgressEvent[] = await orchestrateTestProgress(
58
+ ctx,
59
+ scenarios,
60
+ );
61
+
62
+ const correct = await orchestrateTestCorrect(ctx, codes);
63
+
64
+ const history: AutoBeTestHistory = {
65
+ type: "test",
66
+ id: v4(),
67
+ completed_at: new Date().toISOString(),
68
+ created_at: start.toISOString(),
69
+ files: correct.files,
70
+ compiled: correct.result,
71
+ reason: "Step to the test generation referencing the interface",
72
+ step: ctx.state().interface?.step ?? 0,
73
+ };
74
+
75
+ ctx.dispatch({
76
+ type: "testComplete",
77
+ created_at: start.toISOString(),
78
+ files: correct.files,
79
+ step: ctx.state().interface?.step ?? 0,
80
+ });
81
+
82
+ ctx.state().test = history;
83
+ ctx.histories().push(history);
84
+
85
+ return history;
86
+ };
@@ -0,0 +1,368 @@
1
+ import { IAgenticaController, MicroAgentica } from "@agentica/core";
2
+ import {
3
+ AutoBeTestProgressEvent,
4
+ AutoBeTestValidateEvent,
5
+ IAutoBeTypeScriptCompilerResult,
6
+ } from "@autobe/interface";
7
+ import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
8
+ import { IPointer } from "tstl";
9
+ import typia from "typia";
10
+
11
+ import { AutoBeContext } from "../../context/AutoBeContext";
12
+ import { assertSchemaModel } from "../../context/assertSchemaModel";
13
+ import { transformTestCorrectHistories } from "./transformTestCorrectHistories";
14
+
15
+ export async function orchestrateTestCorrect<Model extends ILlmSchema.Model>(
16
+ ctx: AutoBeContext<Model>,
17
+ codes: AutoBeTestProgressEvent[],
18
+ retry = 8,
19
+ ): Promise<AutoBeTestValidateEvent> {
20
+ // 1) Build map of new test files from progress events
21
+ const testFiles = Object.fromEntries(
22
+ codes.map(({ filename, content }) => [
23
+ `test/features/api/${filename}`,
24
+ content,
25
+ ]),
26
+ );
27
+
28
+ // 2) Keep only files outside the test directory from current state
29
+ const retainedFiles = Object.fromEntries(
30
+ Object.entries(ctx.state().interface?.files ?? {}).filter(
31
+ ([filename]) => !filename.startsWith("test/features/api"),
32
+ ),
33
+ );
34
+
35
+ // 3) Merge and filter: keep .ts/.json, drop anything under "benchmark"
36
+ const mergedFiles = { ...retainedFiles, ...testFiles };
37
+ const files = Object.fromEntries(
38
+ Object.entries(mergedFiles).filter(
39
+ ([filename]) =>
40
+ (filename.endsWith(".ts") && !filename.startsWith("test/benchmark/")) ||
41
+ filename.endsWith(".json"),
42
+ ),
43
+ );
44
+
45
+ // 4) Ask the LLM to correct the filtered file set
46
+ const response = await step(ctx, files, retry);
47
+
48
+ // 5) Combine original + corrected files and dispatch event
49
+ const event: AutoBeTestValidateEvent = {
50
+ ...response,
51
+ type: "testValidate",
52
+ files: { ...mergedFiles, ...response.files },
53
+ };
54
+
55
+ return event;
56
+ }
57
+
58
+ /**
59
+ * Modifies test code for each file and checks for compilation errors. When
60
+ * compilation errors occur, it uses LLM to fix the code and attempts
61
+ * recompilation. This process repeats up to the maximum retry count until
62
+ * compilation succeeds.
63
+ *
64
+ * The function is a critical part of the test generation pipeline that ensures
65
+ * all generated test files are syntactically correct and compilable.
66
+ *
67
+ * @param ctx AutoBe context object
68
+ * @param files Map of files to compile (filename: content)
69
+ * @param life Number of remaining retry attempts
70
+ * @returns Event object containing successful compilation result and modified
71
+ * files
72
+ */
73
+ async function step<Model extends ILlmSchema.Model>(
74
+ ctx: AutoBeContext<Model>,
75
+ files: Record<string, string>,
76
+ life: number,
77
+ ): Promise<AutoBeTestValidateEvent> {
78
+ // COMPILE TEST CODE
79
+ const result = await ctx.compiler.typescript({
80
+ files,
81
+ });
82
+
83
+ if (result.type === "success") {
84
+ // SUCCESS
85
+ return {
86
+ type: "testValidate",
87
+ created_at: new Date().toISOString(),
88
+ files,
89
+ result,
90
+ step: ctx.state().interface?.step ?? 0,
91
+ };
92
+ }
93
+
94
+ // EXCEPTION ERROR
95
+ if (result.type === "exception") {
96
+ ctx.dispatch({
97
+ type: "testValidate",
98
+ created_at: new Date().toISOString(),
99
+ files,
100
+ result,
101
+ step: ctx.state().interface?.step ?? 0,
102
+ });
103
+
104
+ throw new Error(JSON.stringify(result.error, null, 2));
105
+ }
106
+
107
+ // Make the diagnostics object (e.g. { "test/features/api/article.ts": [error1, error2] })
108
+ const diagnostics: Record<
109
+ string,
110
+ IAutoBeTypeScriptCompilerResult.IDiagnostic[]
111
+ > = {};
112
+
113
+ result.diagnostics.forEach((d) => {
114
+ if (d.file === null) return;
115
+
116
+ diagnostics[d.file] = diagnostics[d.file] ?? [];
117
+ diagnostics[d.file].push(d);
118
+ });
119
+
120
+ if (Object.keys(diagnostics).length === 0) {
121
+ /**
122
+ * SUCCESS (Because typescript compiler can't success to compile the json
123
+ * files, so result could be failure. but it's success to compile the ts
124
+ * files.)
125
+ */
126
+ return {
127
+ type: "testValidate",
128
+ created_at: new Date().toISOString(),
129
+ files,
130
+ result: {
131
+ ...result,
132
+ type: "success",
133
+ },
134
+ step: ctx.state().interface?.step ?? 0,
135
+ };
136
+ }
137
+
138
+ // Compile Failed
139
+ ctx.dispatch({
140
+ type: "testValidate",
141
+ created_at: new Date().toISOString(),
142
+ files,
143
+ result,
144
+ step: ctx.state().interface?.step ?? 0,
145
+ });
146
+
147
+ if (life <= 0)
148
+ return {
149
+ type: "testValidate",
150
+ created_at: new Date().toISOString(),
151
+ files,
152
+ result,
153
+ step: ctx.state().interface?.step ?? 0,
154
+ };
155
+
156
+ // VALIDATION FAILED
157
+ const validate = await Promise.all(
158
+ Object.entries(diagnostics).map(async ([filename, d]) => {
159
+ const code = files[filename];
160
+ const response = await process(ctx, d, code);
161
+
162
+ ctx.dispatch({
163
+ type: "testCorrect",
164
+ created_at: new Date().toISOString(),
165
+ files: { ...files, [filename]: response.content },
166
+ result,
167
+ solution: response.solution,
168
+ think_without_compile_error: response.think_without_compile_error,
169
+ think_again_with_compile_error: response.think_again_with_compile_error,
170
+ step: ctx.state().interface?.step ?? 0,
171
+ });
172
+
173
+ // Return [filename, modified code]
174
+ return [filename, response.content];
175
+ }),
176
+ );
177
+
178
+ const newFiles = { ...files, ...Object.fromEntries(validate) };
179
+
180
+ return step(ctx, newFiles, life - 1);
181
+ }
182
+
183
+ /**
184
+ * Modifies the code of test files where errors occurred. This function
185
+ * processes TypeScript compiler diagnostics and attempts to fix compilation
186
+ * errors.
187
+ *
188
+ * @param ctx The AutoBeContext containing application state and configuration
189
+ * @param diagnostics Array of TypeScript compiler diagnostics for the errors
190
+ * @param code The source code content to be fixed
191
+ * @returns Promise resolving to corrected test function properties
192
+ */
193
+ async function process<Model extends ILlmSchema.Model>(
194
+ ctx: AutoBeContext<Model>,
195
+ diagnostics: IAutoBeTypeScriptCompilerResult.IDiagnostic[],
196
+ code: string,
197
+ ): Promise<ICorrectTestFunctionProps> {
198
+ const pointer: IPointer<ICorrectTestFunctionProps | null> = {
199
+ value: null,
200
+ };
201
+
202
+ const apiFiles = Object.entries(ctx.state().interface?.files ?? {})
203
+ .filter(([filename]) => {
204
+ return filename.startsWith("src/api/");
205
+ })
206
+ .reduce<Record<string, string>>((acc, [filename, content]) => {
207
+ return Object.assign(acc, { [filename]: content });
208
+ }, {});
209
+
210
+ const dtoFiles = Object.entries(ctx.state().interface?.files ?? {})
211
+ .filter(([filename]) => {
212
+ return filename.startsWith("src/api/structures/");
213
+ })
214
+ .reduce<Record<string, string>>((acc, [filename, content]) => {
215
+ return Object.assign(acc, { [filename]: content });
216
+ }, {});
217
+
218
+ const agentica = new MicroAgentica({
219
+ model: ctx.model,
220
+ vendor: { ...ctx.vendor },
221
+ config: {
222
+ ...(ctx.config ?? {}),
223
+ },
224
+ histories: transformTestCorrectHistories(apiFiles, dtoFiles),
225
+ controllers: [
226
+ createApplication({
227
+ model: ctx.model,
228
+ build: (next) => {
229
+ pointer.value = next;
230
+ },
231
+ }),
232
+ ],
233
+ });
234
+
235
+ agentica.on("request", async (event) => {
236
+ if (event.body.tools) event.body.tool_choice = "required";
237
+ });
238
+
239
+ await agentica.conversate(
240
+ [
241
+ "Fix the compilation error in the provided code.",
242
+ "",
243
+ "## Original Code",
244
+ "```typescript",
245
+ code,
246
+ "```",
247
+ "",
248
+ diagnostics.map((diagnostic) => {
249
+ if (diagnostic.start === undefined || diagnostic.length === undefined)
250
+ return "";
251
+
252
+ return [
253
+ "## Error Information",
254
+ `- Position: Characters ${diagnostic.start} to ${diagnostic.start + diagnostic.length}`,
255
+ `- Error Message: ${diagnostic.messageText}`,
256
+ `- Problematic Code: \`${code.substring(diagnostic.start, diagnostic.start + diagnostic.length)}\``,
257
+ "",
258
+ ].join("\n");
259
+ }),
260
+ "## Instructions",
261
+ "1. Focus on the specific error location and message",
262
+ "2. Provide the corrected TypeScript code",
263
+ "3. Ensure the fix resolves the compilation error",
264
+ "",
265
+ "Return only the fixed code without explanations.",
266
+ ].join("\n"),
267
+ );
268
+
269
+ if (pointer.value === null) throw new Error("Failed to modify test code.");
270
+
271
+ return pointer.value;
272
+ }
273
+
274
+ function createApplication<Model extends ILlmSchema.Model>(props: {
275
+ model: Model;
276
+ build: (next: ICorrectTestFunctionProps) => void;
277
+ }): IAgenticaController.IClass<Model> {
278
+ assertSchemaModel(props.model);
279
+
280
+ const application: ILlmApplication<Model> = collection[
281
+ props.model
282
+ ] as unknown as ILlmApplication<Model>;
283
+ return {
284
+ protocol: "class",
285
+ name: "Modify Test Code",
286
+ application,
287
+ execute: {
288
+ correctTestCode: (next) => {
289
+ props.build(next);
290
+ },
291
+ } satisfies IApplication,
292
+ };
293
+ }
294
+
295
+ const claude = typia.llm.application<
296
+ IApplication,
297
+ "claude",
298
+ {
299
+ reference: true;
300
+ }
301
+ >();
302
+ const collection = {
303
+ chatgpt: typia.llm.application<
304
+ IApplication,
305
+ "chatgpt",
306
+ { reference: true }
307
+ >(),
308
+ claude,
309
+ llama: claude,
310
+ deepseek: claude,
311
+ "3.1": claude,
312
+ "3.0": typia.llm.application<IApplication, "3.0">(),
313
+ };
314
+
315
+ interface IApplication {
316
+ correctTestCode(props: ICorrectTestFunctionProps): void;
317
+ }
318
+
319
+ interface ICorrectTestFunctionProps {
320
+ /**
321
+ * Step 1: Initial self-reflection on the source code without compiler error
322
+ * context.
323
+ *
324
+ * The AI agent analyzes the previously generated test code to identify
325
+ * potential issues, relying solely on its understanding of TypeScript syntax,
326
+ * testing patterns, and best practices.
327
+ *
328
+ * This encourages the agent to develop independent debugging skills before
329
+ * being influenced by external error messages.
330
+ */
331
+ think_without_compile_error: string;
332
+
333
+ /**
334
+ * Step 2: Re-evaluation of the code with compiler error messages as
335
+ * additional context.
336
+ *
337
+ * After the initial analysis, the AI agent reviews the same code again, this
338
+ * time incorporating the specific TypeScript compiler error messages.
339
+ *
340
+ * This allows the agent to correlate its initial observations with concrete
341
+ * compilation failures and refine its understanding of what went wrong.
342
+ */
343
+ think_again_with_compile_error: string;
344
+
345
+ /**
346
+ * Step 3: Concrete action plan for fixing the identified issues.
347
+ *
348
+ * Based on the analysis from steps 1 and 2, the AI agent formulates a
349
+ * specific, step-by-step solution strategy.
350
+ *
351
+ * This should include what changes need to be made, why those changes are
352
+ * necessary, and how they will resolve the compilation errors while
353
+ * maintaining the test's intended functionality.
354
+ */
355
+ solution: string;
356
+
357
+ /**
358
+ * Step 4: The corrected TypeScript test code.
359
+ *
360
+ * The final, properly fixed TypeScript code that should compile without
361
+ * errors.
362
+ *
363
+ * This represents the implementation of the solution plan from step 3,
364
+ * containing all necessary corrections to make the test code syntactically
365
+ * valid and functionally correct.
366
+ */
367
+ content: string;
368
+ }