@autobe/agent 0.9.1 → 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 +16 -5
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +6 -4
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/AutoBeTokenUsage.d.ts +15 -1
- package/lib/context/AutoBeTokenUsage.js +56 -1
- package/lib/context/AutoBeTokenUsage.js.map +1 -1
- package/lib/context/IAutoBeApplicationProps.d.ts +0 -61
- package/lib/factory/createAutoBeApplication.js +298 -773
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/index.mjs +5116 -7271
- 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 +97 -294
- 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/orchestrateInterface.js +9 -3
- package/lib/orchestrate/interface/orchestrateInterface.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} +11 -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 -349
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +323 -566
- 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 -76
- 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 +32 -22
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +2 -0
- 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 -41
- package/lib/orchestrate/test/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/transformTestWriteHistories.d.ts +5 -4
- package/lib/orchestrate/test/transformTestWriteHistories.js +169 -32
- package/lib/orchestrate/test/transformTestWriteHistories.js.map +1 -1
- package/lib/structures/IAutoBeConfig.d.ts +11 -0
- package/lib/structures/IAutoBeProps.d.ts +12 -1
- 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 -8
- package/src/AutoBeAgent.ts +26 -4
- package/src/constants/AutoBeSystemPromptConstant.ts +6 -4
- package/src/context/AutoBeTokenUsage.ts +85 -1
- package/src/context/IAutoBeApplicationProps.ts +0 -62
- 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 +8 -37
- package/src/orchestrate/facade/transformFacadeStateMessage.ts +2 -1
- package/src/orchestrate/index.ts +2 -2
- package/src/orchestrate/interface/orchestrateInterface.ts +7 -0
- 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} +17 -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 +38 -16
- package/src/orchestrate/test/orchestrateTestCorrect.ts +111 -338
- package/src/orchestrate/test/orchestrateTestScenario.ts +114 -69
- package/src/orchestrate/test/orchestrateTestWrite.ts +55 -153
- 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 +32 -22
- package/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.ts +3 -0
- 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 -43
- package/src/orchestrate/test/transformTestWriteHistories.ts +89 -35
- package/src/structures/IAutoBeConfig.ts +9 -0
- package/src/structures/IAutoBeProps.ts +17 -1
- 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
|
@@ -8,6 +8,7 @@ import typia from "typia";
|
|
|
8
8
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
9
9
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
10
10
|
import { enforceToolCall } from "../../utils/enforceToolCall";
|
|
11
|
+
import { forceRetry } from "../../utils/forceRetry";
|
|
11
12
|
import { transformPrismaSchemaHistories } from "./transformPrismaSchemaHistories";
|
|
12
13
|
|
|
13
14
|
export async function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(
|
|
@@ -23,11 +24,13 @@ export async function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(
|
|
|
23
24
|
let i: number = 0;
|
|
24
25
|
return await Promise.all(
|
|
25
26
|
components.map(async (c) => {
|
|
26
|
-
const result: IMakePrismaSchemaFileProps = await
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
const result: IMakePrismaSchemaFileProps = await forceRetry(() =>
|
|
28
|
+
process(ctx, {
|
|
29
|
+
filename: c.filename,
|
|
30
|
+
tables: c.tables,
|
|
31
|
+
entireTables,
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
31
34
|
const event: AutoBePrismaSchemasEvent = {
|
|
32
35
|
type: "prismaSchemas",
|
|
33
36
|
created_at: start.toISOString(),
|
|
@@ -58,9 +61,11 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
58
61
|
vendor: ctx.vendor,
|
|
59
62
|
config: {
|
|
60
63
|
...(ctx.config ?? {}),
|
|
64
|
+
executor: {
|
|
65
|
+
describe: null,
|
|
66
|
+
},
|
|
61
67
|
},
|
|
62
68
|
histories: transformPrismaSchemaHistories(ctx.state().analyze!, component),
|
|
63
|
-
tokenUsage: ctx.usage(),
|
|
64
69
|
controllers: [
|
|
65
70
|
createApplication({
|
|
66
71
|
model: ctx.model,
|
|
@@ -78,7 +83,11 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
78
83
|
],
|
|
79
84
|
});
|
|
80
85
|
enforceToolCall(agentica);
|
|
81
|
-
await agentica.conversate("Make prisma schema file please")
|
|
86
|
+
await agentica.conversate("Make prisma schema file please").finally(() => {
|
|
87
|
+
const tokenUsage = agentica.getTokenUsage();
|
|
88
|
+
ctx.usage().record(tokenUsage, ["prisma"]);
|
|
89
|
+
});
|
|
90
|
+
|
|
82
91
|
if (pointer.value === null)
|
|
83
92
|
throw new Error("Unreachable code: Prisma Schema not generated");
|
|
84
93
|
return pointer.value;
|
|
@@ -119,7 +128,6 @@ const collection = {
|
|
|
119
128
|
llama: claude,
|
|
120
129
|
deepseek: claude,
|
|
121
130
|
"3.1": claude,
|
|
122
|
-
"3.0": typia.llm.application<IApplication, "3.0">(),
|
|
123
131
|
};
|
|
124
132
|
|
|
125
133
|
interface IApplication {
|
|
@@ -68,6 +68,15 @@ export const transformPrismaComponentsHistories = (
|
|
|
68
68
|
"For example:",
|
|
69
69
|
"",
|
|
70
70
|
"* `mv_shopping_daily_stats`",
|
|
71
|
+
"",
|
|
72
|
+
"## User Role Handling",
|
|
73
|
+
"",
|
|
74
|
+
"If the Requirement Analysis Report contains User Role information, **do not normalize** user roles into a single table.",
|
|
75
|
+
"Instead, create separate tables for each distinct role mentioned in the requirements.",
|
|
76
|
+
"",
|
|
77
|
+
"For example, if the requirements mention User, Admin, and Moderator roles:",
|
|
78
|
+
"",
|
|
79
|
+
"* Create separate tables: `User`, `Admin`, `Moderator` (or with prefix: `shopping_user`, `shopping_admin`, `shopping_moderator`)",
|
|
71
80
|
].join("\n"),
|
|
72
81
|
},
|
|
73
82
|
];
|
|
@@ -59,6 +59,14 @@ export const transformPrismaSchemaHistories = (
|
|
|
59
59
|
...component.tables.map((table) => ` - ${table}`),
|
|
60
60
|
` - Entire tables you can reference:`,
|
|
61
61
|
...component.entireTables.map((table) => ` - ${table}`),
|
|
62
|
+
"",
|
|
63
|
+
"## User Role Rules",
|
|
64
|
+
"",
|
|
65
|
+
"**CRITICAL**: For User Role tables (User, Admin, Moderator, etc.):",
|
|
66
|
+
"1. **Separate tables** - Each role = independent table (User, Admin, Moderator tables)",
|
|
67
|
+
"2. **No `role` field** - Never include role enum fields in any table",
|
|
68
|
+
"",
|
|
69
|
+
"You can use TPT (Table Per Type) pattern with FK relationships if needed, or completely separate tables.",
|
|
62
70
|
].join("\n"),
|
|
63
71
|
},
|
|
64
72
|
];
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AutoBeAssistantMessageHistory,
|
|
3
|
+
AutoBeRealizeHistory,
|
|
4
|
+
} from "@autobe/interface";
|
|
5
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
6
|
+
import { v4 } from "uuid";
|
|
7
|
+
|
|
8
|
+
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
9
|
+
import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
|
|
10
|
+
import { orchestrateRealizeCoder } from "./orchestrateRealizeCoder";
|
|
11
|
+
import { orchestrateRealizeIntegrator } from "./orchestrateRealizeIntegrator";
|
|
12
|
+
import { orchestrateRealizePlanner } from "./orchestrateRealizePlanner";
|
|
13
|
+
import {
|
|
14
|
+
RealizeValidatorOutput,
|
|
15
|
+
orchestrateRealizeValidator,
|
|
16
|
+
} from "./orchestrateRealizeValidator";
|
|
17
|
+
import { IAutoBeRealizeCoderApplication } from "./structures/IAutoBeRealizeCoderApplication";
|
|
18
|
+
|
|
19
|
+
export const orchestrateRealize =
|
|
20
|
+
<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>) =>
|
|
21
|
+
async (
|
|
22
|
+
props: IAutoBeApplicationProps,
|
|
23
|
+
): Promise<AutoBeAssistantMessageHistory | AutoBeRealizeHistory> => {
|
|
24
|
+
props;
|
|
25
|
+
|
|
26
|
+
const ops = ctx.state().interface?.document.operations;
|
|
27
|
+
if (!ops) {
|
|
28
|
+
throw new Error();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const codes: (
|
|
32
|
+
| IAutoBeRealizeCoderApplication.RealizeCoderOutput
|
|
33
|
+
| FAILED
|
|
34
|
+
)[] = await Promise.all(
|
|
35
|
+
ops.map(async (op) =>
|
|
36
|
+
pipe(
|
|
37
|
+
op,
|
|
38
|
+
(op) => orchestrateRealizePlanner(ctx, op),
|
|
39
|
+
(p) => orchestrateRealizeCoder(ctx, op, p),
|
|
40
|
+
),
|
|
41
|
+
),
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const vaildates: (RealizeValidatorOutput | FAILED)[] = await Promise.all(
|
|
45
|
+
codes
|
|
46
|
+
.filter((el) => el !== FAILED)
|
|
47
|
+
.map(async (c) =>
|
|
48
|
+
pipe(
|
|
49
|
+
c,
|
|
50
|
+
(c) => orchestrateRealizeIntegrator(ctx, c),
|
|
51
|
+
(i) => orchestrateRealizeValidator(ctx, i),
|
|
52
|
+
),
|
|
53
|
+
),
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
if (vaildates.length) {
|
|
57
|
+
if (vaildates.every((v) => v !== FAILED)) {
|
|
58
|
+
const files = {
|
|
59
|
+
...ctx.state().interface?.files,
|
|
60
|
+
...vaildates
|
|
61
|
+
.map((v) => ({ [v.location]: v.content }))
|
|
62
|
+
.reduce((acc, cur) => Object.assign(acc, cur), {}),
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const compiled = await ctx.compiler.typescript.compile({ files });
|
|
66
|
+
|
|
67
|
+
const now = new Date().toISOString();
|
|
68
|
+
ctx.dispatch({
|
|
69
|
+
type: "realizeComplete",
|
|
70
|
+
compiled: compiled,
|
|
71
|
+
created_at: now,
|
|
72
|
+
files: files,
|
|
73
|
+
step: ctx.state().analyze?.step ?? 0,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
id: v4(),
|
|
78
|
+
type: "realize",
|
|
79
|
+
completed_at: now,
|
|
80
|
+
created_at: now,
|
|
81
|
+
compiled,
|
|
82
|
+
files,
|
|
83
|
+
reason: props.reason,
|
|
84
|
+
step: ctx.state().analyze?.step ?? 0,
|
|
85
|
+
} satisfies AutoBeRealizeHistory;
|
|
86
|
+
} else {
|
|
87
|
+
const total = codes.length;
|
|
88
|
+
const failedCount = codes.filter((code) => code === FAILED).length;
|
|
89
|
+
const successCount = total - failedCount;
|
|
90
|
+
|
|
91
|
+
const now = new Date().toISOString();
|
|
92
|
+
ctx.dispatch({
|
|
93
|
+
type: "assistantMessage",
|
|
94
|
+
text: [
|
|
95
|
+
`Out of ${total} code blocks, ${successCount} succeeded, but ${failedCount} failed.`,
|
|
96
|
+
`The process has been stopped due to the failure. Please review the failed steps and try again.`,
|
|
97
|
+
].join("\n"),
|
|
98
|
+
created_at: now,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
id: v4(),
|
|
103
|
+
type: "assistantMessage",
|
|
104
|
+
completed_at: now,
|
|
105
|
+
created_at: now,
|
|
106
|
+
text: [
|
|
107
|
+
`Out of ${total} code blocks, ${successCount} succeeded, but ${failedCount} failed.`,
|
|
108
|
+
`The process has been stopped due to the failure. Please review the failed steps and try again.`,
|
|
109
|
+
].join("\n"),
|
|
110
|
+
} satisfies AutoBeAssistantMessageHistory;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const now = new Date().toISOString();
|
|
115
|
+
ctx.dispatch({
|
|
116
|
+
type: "assistantMessage",
|
|
117
|
+
text: "Any codes can not be generated.",
|
|
118
|
+
created_at: now,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
id: v4(),
|
|
123
|
+
type: "assistantMessage",
|
|
124
|
+
completed_at: now,
|
|
125
|
+
created_at: now,
|
|
126
|
+
text: "Any codes can not be generated.",
|
|
127
|
+
} satisfies AutoBeAssistantMessageHistory;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const FAILED = Symbol("FAILED");
|
|
131
|
+
export type FAILED = typeof FAILED;
|
|
132
|
+
|
|
133
|
+
export function pipe<A, B>(
|
|
134
|
+
a: A,
|
|
135
|
+
ab: (a: A) => Promise<B | FAILED>,
|
|
136
|
+
): Promise<B | FAILED>;
|
|
137
|
+
|
|
138
|
+
export function pipe<A, B, C>(
|
|
139
|
+
a: A,
|
|
140
|
+
ab: (a: A) => Promise<B | FAILED>,
|
|
141
|
+
bc: (b: B) => Promise<C | FAILED>,
|
|
142
|
+
): Promise<C | FAILED>;
|
|
143
|
+
|
|
144
|
+
export function pipe<A, B, C, D>(
|
|
145
|
+
a: A,
|
|
146
|
+
ab: (a: A) => Promise<B | FAILED>,
|
|
147
|
+
bc: (b: B) => Promise<C | FAILED>,
|
|
148
|
+
cd: (c: C) => Promise<D | FAILED>,
|
|
149
|
+
): Promise<D | FAILED>;
|
|
150
|
+
|
|
151
|
+
export function pipe<A, B, C, D, E>(
|
|
152
|
+
a: A,
|
|
153
|
+
ab: (a: A) => Promise<B | FAILED>,
|
|
154
|
+
bc: (b: B) => Promise<C | FAILED>,
|
|
155
|
+
cd: (c: C) => Promise<D | FAILED>,
|
|
156
|
+
de: (d: D) => Promise<E | FAILED>,
|
|
157
|
+
): Promise<E | FAILED>;
|
|
158
|
+
|
|
159
|
+
export function pipe(
|
|
160
|
+
a: any,
|
|
161
|
+
...fns: Array<(arg: any) => Promise<any>>
|
|
162
|
+
): Promise<any> {
|
|
163
|
+
return fns.reduce((prev, fn) => {
|
|
164
|
+
return prev.then((result) => {
|
|
165
|
+
if (result === FAILED) return FAILED;
|
|
166
|
+
return fn(result);
|
|
167
|
+
});
|
|
168
|
+
}, Promise.resolve(a));
|
|
169
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { IAgenticaController, MicroAgentica } from "@agentica/core";
|
|
2
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
3
|
+
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
4
|
+
import sortImport from "@trivago/prettier-plugin-sort-imports";
|
|
5
|
+
import { format } from "prettier";
|
|
6
|
+
import { IPointer } from "tstl";
|
|
7
|
+
import typia from "typia";
|
|
8
|
+
|
|
9
|
+
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
10
|
+
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
11
|
+
import { enforceToolCall } from "../../utils/enforceToolCall";
|
|
12
|
+
import { getTestScenarioArtifacts } from "../test/compile/getTestScenarioArtifacts";
|
|
13
|
+
import { IAutoBeTestScenarioArtifacts } from "../test/structures/IAutoBeTestScenarioArtifacts";
|
|
14
|
+
import { FAILED } from "./orchestrateRealize";
|
|
15
|
+
import { RealizePlannerOutput } from "./orchestrateRealizePlanner";
|
|
16
|
+
import { IAutoBeRealizeCoderApplication } from "./structures/IAutoBeRealizeCoderApplication";
|
|
17
|
+
import { transformRealizeCoderHistories } from "./transformRealizeCoderHistories";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Generates a TypeScript function implementation based on the given plan.
|
|
21
|
+
*
|
|
22
|
+
* This function transforms the plan (function name, input/output schema,
|
|
23
|
+
* constraints, and scenarios) into a complete TypeScript function as a string.
|
|
24
|
+
* It is responsible only for producing the code logic, and does not handle
|
|
25
|
+
* imports, exports, or formatting.
|
|
26
|
+
*
|
|
27
|
+
* Import statements are handled separately and will be injected automatically.
|
|
28
|
+
* Any unused imports will be removed by tooling (e.g. eslint).
|
|
29
|
+
*
|
|
30
|
+
* Type annotations should be omitted whenever possible to favor TypeScript's
|
|
31
|
+
* type inference, unless explicit types are critical to correctness.
|
|
32
|
+
*
|
|
33
|
+
* @param ctx - AutoBE execution context
|
|
34
|
+
* @param props - Planning result describing what function to generate
|
|
35
|
+
* @returns The generated function name and TypeScript code
|
|
36
|
+
*/
|
|
37
|
+
export const orchestrateRealizeCoder = async <Model extends ILlmSchema.Model>(
|
|
38
|
+
ctx: AutoBeContext<Model>,
|
|
39
|
+
operation: AutoBeOpenApi.IOperation,
|
|
40
|
+
props: RealizePlannerOutput,
|
|
41
|
+
): Promise<IAutoBeRealizeCoderApplication.RealizeCoderOutput | FAILED> => {
|
|
42
|
+
const artifacts: IAutoBeTestScenarioArtifacts =
|
|
43
|
+
await getTestScenarioArtifacts(ctx, {
|
|
44
|
+
endpoint: {
|
|
45
|
+
method: operation.method,
|
|
46
|
+
path: operation.path,
|
|
47
|
+
},
|
|
48
|
+
dependencies: [],
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const pointer: IPointer<Pick<
|
|
52
|
+
IAutoBeRealizeCoderApplication.RealizeCoderOutput,
|
|
53
|
+
"implementationCode"
|
|
54
|
+
> | null> = {
|
|
55
|
+
value: null,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const controller = createApplication({
|
|
59
|
+
model: ctx.model,
|
|
60
|
+
build: (props) => {
|
|
61
|
+
pointer.value = props.result;
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const agent = new MicroAgentica({
|
|
66
|
+
controllers: [controller],
|
|
67
|
+
model: ctx.model,
|
|
68
|
+
vendor: ctx.vendor,
|
|
69
|
+
config: {
|
|
70
|
+
...ctx.config,
|
|
71
|
+
executor: {
|
|
72
|
+
describe: null,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
histories: transformRealizeCoderHistories(ctx.state(), props, artifacts),
|
|
76
|
+
});
|
|
77
|
+
enforceToolCall(agent);
|
|
78
|
+
|
|
79
|
+
await agent.conversate("Write code.");
|
|
80
|
+
const tokenUsage = agent.getTokenUsage();
|
|
81
|
+
ctx.usage().record(tokenUsage, ["realize"]);
|
|
82
|
+
|
|
83
|
+
if (pointer.value === null) {
|
|
84
|
+
return FAILED;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
pointer.value.implementationCode = await format(
|
|
88
|
+
pointer.value.implementationCode,
|
|
89
|
+
{
|
|
90
|
+
parser: "typescript",
|
|
91
|
+
plugins: [sortImport, await import("prettier-plugin-jsdoc")],
|
|
92
|
+
importOrder: ["<THIRD_PARTY_MODULES>", "^[./]"],
|
|
93
|
+
importOrderSeparation: true,
|
|
94
|
+
importOrderSortSpecifiers: true,
|
|
95
|
+
importOrderParserPlugins: ["decorators-legacy", "typescript", "jsx"],
|
|
96
|
+
},
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
pointer.value.implementationCode = pointer.value.implementationCode
|
|
100
|
+
.replaceAll('import { MyGlobal } from "../MyGlobal";', "")
|
|
101
|
+
.replaceAll('import typia, { tags } from "typia";', "")
|
|
102
|
+
.replaceAll('import { Prisma } from "@prisma/client";', "")
|
|
103
|
+
.replaceAll('import { jwtDecode } from "./jwtDecode"', "");
|
|
104
|
+
|
|
105
|
+
pointer.value.implementationCode = [
|
|
106
|
+
'import { MyGlobal } from "../MyGlobal";',
|
|
107
|
+
'import typia, { tags } from "typia";',
|
|
108
|
+
'import { Prisma } from "@prisma/client";',
|
|
109
|
+
'import { jwtDecode } from "./jwtDecode"',
|
|
110
|
+
"",
|
|
111
|
+
pointer.value.implementationCode,
|
|
112
|
+
].join("\n");
|
|
113
|
+
|
|
114
|
+
return { ...pointer.value, functionName: props.functionName };
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
function createApplication<Model extends ILlmSchema.Model>(props: {
|
|
118
|
+
model: Model;
|
|
119
|
+
build: (next: IAutoBeRealizeCoderApplication.IProps) => void;
|
|
120
|
+
}): IAgenticaController.IClass<Model> {
|
|
121
|
+
assertSchemaModel(props.model);
|
|
122
|
+
|
|
123
|
+
const application: ILlmApplication<Model> = collection[
|
|
124
|
+
props.model
|
|
125
|
+
] as unknown as ILlmApplication<Model>;
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
protocol: "class",
|
|
129
|
+
name: "Write code",
|
|
130
|
+
application,
|
|
131
|
+
execute: {
|
|
132
|
+
programing: (next) => {
|
|
133
|
+
props.build(next);
|
|
134
|
+
},
|
|
135
|
+
} satisfies IAutoBeRealizeCoderApplication,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const claude = typia.llm.application<
|
|
140
|
+
IAutoBeRealizeCoderApplication,
|
|
141
|
+
"claude",
|
|
142
|
+
{
|
|
143
|
+
reference: true;
|
|
144
|
+
}
|
|
145
|
+
>();
|
|
146
|
+
const collection = {
|
|
147
|
+
chatgpt: typia.llm.application<
|
|
148
|
+
IAutoBeRealizeCoderApplication,
|
|
149
|
+
"chatgpt",
|
|
150
|
+
{ reference: true }
|
|
151
|
+
>(),
|
|
152
|
+
claude,
|
|
153
|
+
llama: claude,
|
|
154
|
+
deepseek: claude,
|
|
155
|
+
"3.1": claude,
|
|
156
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
|
|
3
|
+
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
4
|
+
import { IAutoBeRealizeCoderApplication } from "./structures/IAutoBeRealizeCoderApplication";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The result of integrating the generated code into the actual application
|
|
8
|
+
* files (e.g., controller).
|
|
9
|
+
*/
|
|
10
|
+
export interface RealizeIntegratorOutput {
|
|
11
|
+
/**
|
|
12
|
+
* Indicates the result of the integration process.
|
|
13
|
+
*
|
|
14
|
+
* - "success": The function was correctly inserted, imported, and passed
|
|
15
|
+
* compilation.
|
|
16
|
+
* - "fail": The integration did not complete (e.g., target controller not
|
|
17
|
+
* found, syntax error).
|
|
18
|
+
* - "exception": An unexpected error occurred (e.g., I/O failure, invalid
|
|
19
|
+
* context state).
|
|
20
|
+
*/
|
|
21
|
+
result: "success" | "fail" | "exception";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Integrates the generated function into an appropriate controller file,
|
|
26
|
+
* handling insertion, import, and static validation.
|
|
27
|
+
*
|
|
28
|
+
* This function performs the following steps:
|
|
29
|
+
*
|
|
30
|
+
* 1. **Locate appropriate controller file**
|
|
31
|
+
*
|
|
32
|
+
* - Usually matches `*.controller.ts`
|
|
33
|
+
* - May be based on inferred target (e.g., from functionName or folder structure)
|
|
34
|
+
* 2. **Insert the generated function into the file content**
|
|
35
|
+
*
|
|
36
|
+
* - Ensures proper placement, such as inside a class or export block
|
|
37
|
+
* - May replace or append to existing function stubs
|
|
38
|
+
* 3. **Inject required imports automatically**
|
|
39
|
+
*
|
|
40
|
+
* - Identifies any missing imports (e.g., DTOs, utility functions)
|
|
41
|
+
* - Ensures imports are added without duplication
|
|
42
|
+
* 4. **Check for compile-time safety**
|
|
43
|
+
*
|
|
44
|
+
* - Ensures TypeScript type-checking passes
|
|
45
|
+
* - Verifies that Nestia-generated routers still function without error
|
|
46
|
+
* - If compilation fails or static types are invalid, marks result as `"fail"`
|
|
47
|
+
*
|
|
48
|
+
* ⚠️ Note: This step **must not rely on runtime execution**. It only guarantees
|
|
49
|
+
* static, structural validity (i.e., valid TypeScript).
|
|
50
|
+
*
|
|
51
|
+
* @param ctx - AutoBE context including current source files and settings
|
|
52
|
+
* @param props - Output from the code generation step to be integrated
|
|
53
|
+
* @returns Integration status, indicating success or failure of insertion
|
|
54
|
+
*/
|
|
55
|
+
export const orchestrateRealizeIntegrator = async <
|
|
56
|
+
Model extends ILlmSchema.Model,
|
|
57
|
+
>(
|
|
58
|
+
ctx: AutoBeContext<Model>,
|
|
59
|
+
props: IAutoBeRealizeCoderApplication.RealizeCoderOutput,
|
|
60
|
+
): Promise<RealizeIntegratorOutput> => {
|
|
61
|
+
props;
|
|
62
|
+
|
|
63
|
+
const controllers: [string, string][] = Object.entries(
|
|
64
|
+
ctx.state().interface?.files ?? {},
|
|
65
|
+
).filter(([filename]) => {
|
|
66
|
+
return filename.endsWith("controller.ts");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// Placeholder: insert props.implementationCode into selected controller
|
|
70
|
+
// Inject necessary import statements for used types/functions
|
|
71
|
+
// Optionally run TypeScript compiler in dry-run mode to validate correctness
|
|
72
|
+
controllers;
|
|
73
|
+
|
|
74
|
+
return null!;
|
|
75
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
2
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
3
|
+
|
|
4
|
+
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
5
|
+
|
|
6
|
+
export interface RealizePlannerOutput {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the function to be generated.
|
|
9
|
+
*
|
|
10
|
+
* Derived from the Swagger path and method. The function name must be written
|
|
11
|
+
* in snake_case. It serves as the entry point in both code generation and
|
|
12
|
+
* test code.
|
|
13
|
+
*
|
|
14
|
+
* Once the function is generated, the function name and file name will be the
|
|
15
|
+
* same. The generated file will be located at
|
|
16
|
+
* `src/providers/${function_name}.ts`.
|
|
17
|
+
*/
|
|
18
|
+
functionName: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Definition of path and query parameters extracted from the OpenAPI spec.
|
|
22
|
+
*
|
|
23
|
+
* Includes input values passed via URL path or query string. Used for type
|
|
24
|
+
* definitions, validation, and function signature construction.
|
|
25
|
+
*/
|
|
26
|
+
parameters: AutoBeOpenApi.IParameter[];
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Schema definition for the request body input.
|
|
30
|
+
*
|
|
31
|
+
* Extracted from the requestBody section of Swagger. Represents the input
|
|
32
|
+
* data passed in the body (e.g., JSON). Used for generating function
|
|
33
|
+
* arguments or DTOs.
|
|
34
|
+
*/
|
|
35
|
+
inputSchema: AutoBeOpenApi.IRequestBody | null;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Schema definition for the response body.
|
|
39
|
+
*
|
|
40
|
+
* Extracted from the responses section of Swagger. Used to define the return
|
|
41
|
+
* type and expected output in test code.
|
|
42
|
+
*/
|
|
43
|
+
outputSchema: AutoBeOpenApi.IResponseBody | null;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Natural language description of the function’s purpose.
|
|
47
|
+
*
|
|
48
|
+
* Extracted from the summary or description field of Swagger. Used for code
|
|
49
|
+
* documentation, test scenario generation, and conveying function intent.
|
|
50
|
+
*/
|
|
51
|
+
description: string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* HTTP method information.
|
|
55
|
+
*
|
|
56
|
+
* Extracted from the Swagger operation method. Used to define the request
|
|
57
|
+
* type during code and test generation.
|
|
58
|
+
*/
|
|
59
|
+
operationType: "get" | "post" | "put" | "delete" | "patch";
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* List of scenario descriptions for test code generation.
|
|
63
|
+
*
|
|
64
|
+
* Each scenario describes the expected behavior of the function under certain
|
|
65
|
+
* conditions. Used as a basis for TDD-style automated test generation.
|
|
66
|
+
*/
|
|
67
|
+
testScenarios: string[];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Generates a planning result that defines what kind of function should be
|
|
72
|
+
* created, based solely on the provided Swagger (OpenAPI) operation — without
|
|
73
|
+
* using an LLM.
|
|
74
|
+
*
|
|
75
|
+
* This function analyzes the structure of the OpenAPI operation (such as the
|
|
76
|
+
* path, method, parameters, request/response schema, and descriptions) to
|
|
77
|
+
* determine the appropriate function name, input/output types, and purpose of
|
|
78
|
+
* the function.
|
|
79
|
+
*
|
|
80
|
+
* The result of this function (`RealizePlannerOutput`) will be passed to the
|
|
81
|
+
* next step in the AutoBE pipeline, which is responsible for generating the
|
|
82
|
+
* actual implementation code.
|
|
83
|
+
*
|
|
84
|
+
* @param ctx - AutoBE context including model and configuration
|
|
85
|
+
* @param operation - A single OpenAPI operation object to analyze and plan
|
|
86
|
+
* @returns A planning object containing all structural information needed to
|
|
87
|
+
* generate the function
|
|
88
|
+
*/
|
|
89
|
+
export const orchestrateRealizePlanner = async <Model extends ILlmSchema.Model>(
|
|
90
|
+
ctx: AutoBeContext<Model>,
|
|
91
|
+
operation: AutoBeOpenApi.IOperation,
|
|
92
|
+
): Promise<RealizePlannerOutput> => {
|
|
93
|
+
const testScenarios =
|
|
94
|
+
ctx
|
|
95
|
+
.state()
|
|
96
|
+
.test?.files.filter(
|
|
97
|
+
(el) =>
|
|
98
|
+
el.scenario.endpoint.method === operation.method &&
|
|
99
|
+
el.scenario.endpoint.path === operation.path,
|
|
100
|
+
) ?? [];
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
description: operation.description,
|
|
104
|
+
parameters: operation.parameters,
|
|
105
|
+
inputSchema: operation.requestBody,
|
|
106
|
+
outputSchema: operation.responseBody,
|
|
107
|
+
operationType: operation.method,
|
|
108
|
+
testScenarios: testScenarios.map((el) => el.scenario.draft),
|
|
109
|
+
functionName: `${operation.method}_${operation.path
|
|
110
|
+
.replaceAll("/", "_")
|
|
111
|
+
.replaceAll("-", "_")
|
|
112
|
+
.replaceAll("{", "$")
|
|
113
|
+
.replaceAll("}", "")}`,
|
|
114
|
+
} satisfies RealizePlannerOutput;
|
|
115
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
|
|
3
|
+
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
4
|
+
import { RealizeIntegratorOutput } from "./orchestrateRealizeIntegrator";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The result of validating the integrated code by running tests or static
|
|
8
|
+
* checks.
|
|
9
|
+
*/
|
|
10
|
+
export interface RealizeValidatorOutput {
|
|
11
|
+
/** File path or location of the generated provider logic file. */
|
|
12
|
+
location: string;
|
|
13
|
+
|
|
14
|
+
/** The full TypeScript source code content of the generated provider file. */
|
|
15
|
+
content: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Overall result of the test execution.
|
|
19
|
+
*
|
|
20
|
+
* - "success": All tests passed successfully.
|
|
21
|
+
* - "fail": Some tests failed.
|
|
22
|
+
* - "exception": An unexpected error occurred during test execution.
|
|
23
|
+
*/
|
|
24
|
+
result: "success" | "fail" | "exception";
|
|
25
|
+
|
|
26
|
+
/** Total number of test cases executed. */
|
|
27
|
+
total: number;
|
|
28
|
+
|
|
29
|
+
/** Number of tests that passed. */
|
|
30
|
+
success: number;
|
|
31
|
+
|
|
32
|
+
/** Number of tests that failed. */
|
|
33
|
+
fail: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Validates the integrated provider logic by returning the generated source
|
|
38
|
+
* code along with the summary of test execution results.
|
|
39
|
+
*
|
|
40
|
+
* This function serves as the final step to:
|
|
41
|
+
*
|
|
42
|
+
* - Provide the full TypeScript implementation files created/updated during
|
|
43
|
+
* integration.
|
|
44
|
+
* - Return a detailed summary of the automated test outcomes executed against
|
|
45
|
+
* that code.
|
|
46
|
+
*
|
|
47
|
+
* It does not throw errors; all failures or exceptions are reported via the
|
|
48
|
+
* `result` property.
|
|
49
|
+
*
|
|
50
|
+
* @param ctx - AutoBE execution context
|
|
51
|
+
* @param props - Result from the integration step
|
|
52
|
+
* @returns An object containing provider file content and test results
|
|
53
|
+
*/
|
|
54
|
+
export const orchestrateRealizeValidator = async <
|
|
55
|
+
Model extends ILlmSchema.Model,
|
|
56
|
+
>(
|
|
57
|
+
ctx: AutoBeContext<Model>,
|
|
58
|
+
props: RealizeIntegratorOutput,
|
|
59
|
+
): Promise<RealizeValidatorOutput> => {
|
|
60
|
+
ctx;
|
|
61
|
+
props;
|
|
62
|
+
|
|
63
|
+
return null!;
|
|
64
|
+
};
|