@autobe/agent 0.14.6 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AutoBeMockAgent.js +1 -1
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +10 -8
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/index.mjs +1276 -834
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js +4 -9
- package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -8
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.js +1 -1
- package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.js.map +1 -1
- package/lib/orchestrate/analyze/transformAnalyzeWriteHistories.js +1 -1
- package/lib/orchestrate/analyze/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.d.ts +3 -0
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js +65 -0
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.d.ts +4 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +62 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.d.ts +4 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +28 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.d.ts +3 -0
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +28 -0
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.d.ts +4 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +28 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.d.ts +3 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js +63 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +4 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +28 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterface.js +14 -9
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +13 -40
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.d.ts +3 -2
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +52 -32
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +4 -0
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +350 -0
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +249 -225
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.d.ts +4 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +411 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +55 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointApplication.d.ts +23 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +108 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +122 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +75 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.js.map +1 -0
- package/lib/orchestrate/interface/{OpenApiEndpointComparator.d.ts → utils/OpenApiEndpointComparator.d.ts} +1 -0
- package/lib/orchestrate/interface/{OpenApiEndpointComparator.js → utils/OpenApiEndpointComparator.js} +6 -0
- package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealize.js +16 -2
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +5 -7
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +2 -2
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js +3 -2
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +1 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +34 -13
- package/lib/orchestrate/realize/transformRealizeAuthorization.js +1 -1
- package/lib/orchestrate/realize/transformRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/transformRealizeAuthorizationCorrectHistories.js +1 -1
- package/lib/orchestrate/realize/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js +5 -5
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js.map +1 -1
- package/lib/orchestrate/realize/utils/InternalFileSystem.d.ts +8 -0
- package/lib/orchestrate/realize/utils/InternalFileSystem.js +17 -0
- package/lib/orchestrate/realize/utils/InternalFileSystem.js.map +1 -0
- package/lib/orchestrate/realize/utils/ProviderFileSystem.d.ts +3 -0
- package/lib/orchestrate/realize/utils/ProviderFileSystem.js +8 -0
- package/lib/orchestrate/realize/utils/ProviderFileSystem.js.map +1 -0
- package/lib/orchestrate/realize/utils/replaceImportStatements.js +2 -2
- package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js +36 -36
- package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js.map +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +1 -0
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +29 -13
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/transformTestWriteHistories.js +3 -2
- package/lib/orchestrate/test/transformTestWriteHistories.js.map +1 -1
- package/lib/utils/arrayToRecord.d.ts +17 -0
- package/lib/utils/arrayToRecord.js +19 -0
- package/lib/utils/arrayToRecord.js.map +1 -0
- package/lib/utils/backoffRetry.js +0 -1
- package/lib/utils/backoffRetry.js.map +1 -1
- package/package.json +5 -5
- package/src/AutoBeMockAgent.ts +1 -1
- package/src/constants/AutoBeSystemPromptConstant.ts +10 -8
- package/src/orchestrate/analyze/orchestrateAnalyzeReviewer.ts +1 -3
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +1 -3
- package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +75 -0
- package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +69 -0
- package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +34 -0
- package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +32 -0
- package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +34 -0
- package/src/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.ts +66 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +34 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +17 -8
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +22 -97
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +48 -55
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +109 -0
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +81 -120
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +197 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.ts +58 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointApplication.ts +24 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +112 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +125 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +76 -0
- package/src/orchestrate/interface/{OpenApiEndpointComparator.ts → utils/OpenApiEndpointComparator.ts} +8 -0
- package/src/orchestrate/realize/orchestrateRealize.ts +19 -2
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +6 -19
- package/src/orchestrate/realize/orchestrateRealizeCoder.ts +3 -6
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +1 -1
- package/src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts +42 -24
- package/src/orchestrate/realize/transformRealizeCoderHistories.ts +4 -4
- package/src/orchestrate/realize/utils/InternalFileSystem.ts +12 -0
- package/src/orchestrate/realize/utils/ProviderFileSystem.ts +4 -0
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +2 -2
- package/src/orchestrate/realize/writeCodeUntilCompilePassed.ts +59 -53
- package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +1 -0
- package/src/orchestrate/test/orchestrateTestScenario.ts +4 -2
- package/src/utils/arrayToRecord.ts +49 -0
- package/src/utils/backoffRetry.ts +0 -1
- package/lib/orchestrate/interface/OpenApiEndpointComparator.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.d.ts +0 -4
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +0 -473
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +0 -1
- package/lib/orchestrate/interface/transformInterfaceHistories.d.ts +0 -3
- package/lib/orchestrate/interface/transformInterfaceHistories.js +0 -149
- package/lib/orchestrate/interface/transformInterfaceHistories.js.map +0 -1
- package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +0 -292
- package/src/orchestrate/interface/transformInterfaceHistories.ts +0 -152
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformInterfaceHistories = void 0;
|
|
4
|
-
const uuid_1 = require("uuid");
|
|
5
|
-
const transformInterfaceHistories = (state, systemMessage) => {
|
|
6
|
-
var _a, _b;
|
|
7
|
-
if (state.analyze === null)
|
|
8
|
-
return [
|
|
9
|
-
{
|
|
10
|
-
id: (0, uuid_1.v4)(),
|
|
11
|
-
created_at: new Date().toISOString(),
|
|
12
|
-
type: "systemMessage",
|
|
13
|
-
text: [
|
|
14
|
-
"Requirement analysis is not yet completed.",
|
|
15
|
-
"Don't call the any tool function,",
|
|
16
|
-
"but say to process the requirement analysis.",
|
|
17
|
-
].join(" "),
|
|
18
|
-
},
|
|
19
|
-
];
|
|
20
|
-
else if (state.prisma === null)
|
|
21
|
-
return [
|
|
22
|
-
{
|
|
23
|
-
id: (0, uuid_1.v4)(),
|
|
24
|
-
created_at: new Date().toISOString(),
|
|
25
|
-
type: "systemMessage",
|
|
26
|
-
text: [
|
|
27
|
-
"Prisma DB schema generation is not yet completed.",
|
|
28
|
-
"Don't call the any tool function,",
|
|
29
|
-
"but say to process the Prisma DB schema generation.",
|
|
30
|
-
].join(" "),
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
else if (state.analyze.step !== state.prisma.step)
|
|
34
|
-
return [
|
|
35
|
-
{
|
|
36
|
-
id: (0, uuid_1.v4)(),
|
|
37
|
-
created_at: new Date().toISOString(),
|
|
38
|
-
type: "systemMessage",
|
|
39
|
-
text: [
|
|
40
|
-
"Prisma DB schema generation has not been updated",
|
|
41
|
-
"for the latest requirement analysis.",
|
|
42
|
-
"Don't call the any tool function,",
|
|
43
|
-
"but say to re-process the Prisma DB schema generation.",
|
|
44
|
-
].join(" "),
|
|
45
|
-
},
|
|
46
|
-
];
|
|
47
|
-
else if (state.prisma.compiled.type !== "success")
|
|
48
|
-
return [
|
|
49
|
-
{
|
|
50
|
-
id: (0, uuid_1.v4)(),
|
|
51
|
-
created_at: new Date().toISOString(),
|
|
52
|
-
type: "systemMessage",
|
|
53
|
-
text: [
|
|
54
|
-
"Prisma DB schema generation has not been updated",
|
|
55
|
-
"for the latest requirement analysis.",
|
|
56
|
-
"Don't call the any tool function,",
|
|
57
|
-
"but say to re-process the Prisma DB schema generation.",
|
|
58
|
-
].join(" "),
|
|
59
|
-
},
|
|
60
|
-
];
|
|
61
|
-
return [
|
|
62
|
-
{
|
|
63
|
-
id: (0, uuid_1.v4)(),
|
|
64
|
-
created_at: new Date().toISOString(),
|
|
65
|
-
type: "systemMessage",
|
|
66
|
-
text: systemMessage,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
id: (0, uuid_1.v4)(),
|
|
70
|
-
created_at: new Date().toISOString(),
|
|
71
|
-
type: "assistantMessage",
|
|
72
|
-
text: [
|
|
73
|
-
"Requirement analysis and Prisma DB schema generation are ready.",
|
|
74
|
-
"",
|
|
75
|
-
"Call the provided tool function to generate the OpenAPI document",
|
|
76
|
-
"referencing below requirement analysis and Prisma DB schema.",
|
|
77
|
-
"",
|
|
78
|
-
// User Request
|
|
79
|
-
`## User Request`,
|
|
80
|
-
"",
|
|
81
|
-
state.analyze.reason,
|
|
82
|
-
"",
|
|
83
|
-
"## Prefix",
|
|
84
|
-
"",
|
|
85
|
-
`* Prefix provided by the user: ${(_b = (_a = state.analyze) === null || _a === void 0 ? void 0 : _a.prefix) !== null && _b !== void 0 ? _b : null}`,
|
|
86
|
-
`* When defining TypeScript interfaces, the interface name must be in PascalCase. The property names, however, do not need to follow this convention.`,
|
|
87
|
-
"",
|
|
88
|
-
"The user wants all TypeScript identifiers (such as interfaces, types, and functions) to start with the prefix provided below. ",
|
|
89
|
-
"If the prefix is `null`, it should be ignored. ",
|
|
90
|
-
"If a prefix is provided, all identifier names **must begin with it**.",
|
|
91
|
-
"",
|
|
92
|
-
"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.",
|
|
93
|
-
"",
|
|
94
|
-
"## Prefix Example",
|
|
95
|
-
"",
|
|
96
|
-
"If the prefix is `shopping`, then names should be like:",
|
|
97
|
-
"",
|
|
98
|
-
"* `shoppingSales`",
|
|
99
|
-
"* `shoppingSaleOptions`",
|
|
100
|
-
"* `shoppingCreateSale()`",
|
|
101
|
-
"",
|
|
102
|
-
"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. ",
|
|
103
|
-
"For example:",
|
|
104
|
-
"",
|
|
105
|
-
"* `mvShoppingDailyStats`",
|
|
106
|
-
"* `mvShoppingAggregateView`",
|
|
107
|
-
"",
|
|
108
|
-
// Requirement Analysis Report
|
|
109
|
-
`## Requirement Analysis Report`,
|
|
110
|
-
"",
|
|
111
|
-
"```json",
|
|
112
|
-
JSON.stringify(state.analyze.files),
|
|
113
|
-
"```",
|
|
114
|
-
].join("\n"),
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
id: (0, uuid_1.v4)(),
|
|
118
|
-
created_at: new Date().toISOString(),
|
|
119
|
-
type: "assistantMessage",
|
|
120
|
-
text: [
|
|
121
|
-
"Database schema and entity relationship diagrams are ready.",
|
|
122
|
-
"You should also look at this and consider logic including membership/login and token issuance.",
|
|
123
|
-
"You can use table's name to define role in operations.",
|
|
124
|
-
"",
|
|
125
|
-
"## Critical Schema Verification Instructions",
|
|
126
|
-
"",
|
|
127
|
-
"**IMPORTANT**: When generating API operations and descriptions:",
|
|
128
|
-
"1. ONLY reference fields that ACTUALLY EXIST in the Prisma schema below",
|
|
129
|
-
"2. NEVER assume common fields like `deleted_at`, `created_by`, `updated_by`, `is_deleted` exist",
|
|
130
|
-
"3. For DELETE operations:",
|
|
131
|
-
" - If schema HAS soft delete fields (e.g., `deleted_at`), describe soft delete behavior",
|
|
132
|
-
" - If schema LACKS soft delete fields, describe hard delete behavior",
|
|
133
|
-
"4. Verify EVERY field reference against the actual schema before including in descriptions",
|
|
134
|
-
"",
|
|
135
|
-
"## Prisma DB Schema",
|
|
136
|
-
"```json",
|
|
137
|
-
JSON.stringify(state.prisma.schemas),
|
|
138
|
-
"```",
|
|
139
|
-
"",
|
|
140
|
-
"## Entity Relationship Diagrams",
|
|
141
|
-
"```json",
|
|
142
|
-
JSON.stringify(state.prisma.compiled.diagrams),
|
|
143
|
-
"```",
|
|
144
|
-
].join("\n"),
|
|
145
|
-
},
|
|
146
|
-
];
|
|
147
|
-
};
|
|
148
|
-
exports.transformInterfaceHistories = transformInterfaceHistories;
|
|
149
|
-
//# sourceMappingURL=transformInterfaceHistories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transformInterfaceHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/interface/transformInterfaceHistories.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
import { IAgenticaController, MicroAgentica } from "@agentica/core";
|
|
2
|
-
import { AutoBeOpenApi } from "@autobe/interface";
|
|
3
|
-
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
4
|
-
import { OpenApiV3_1Emender } from "@samchon/openapi/lib/converters/OpenApiV3_1Emender";
|
|
5
|
-
import { IPointer } from "tstl";
|
|
6
|
-
import typia from "typia";
|
|
7
|
-
import { v4 } from "uuid";
|
|
8
|
-
|
|
9
|
-
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
10
|
-
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
11
|
-
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
12
|
-
import { divideArray } from "../../utils/divideArray";
|
|
13
|
-
import { enforceToolCall } from "../../utils/enforceToolCall";
|
|
14
|
-
import { forceRetry } from "../../utils/forceRetry";
|
|
15
|
-
import { transformInterfaceHistories } from "./transformInterfaceHistories";
|
|
16
|
-
|
|
17
|
-
export async function orchestrateInterfaceComponents<
|
|
18
|
-
Model extends ILlmSchema.Model,
|
|
19
|
-
>(
|
|
20
|
-
ctx: AutoBeContext<Model>,
|
|
21
|
-
operations: AutoBeOpenApi.IOperation[],
|
|
22
|
-
capacity: number = 12,
|
|
23
|
-
): Promise<AutoBeOpenApi.IComponents> {
|
|
24
|
-
const typeNames: Set<string> = new Set();
|
|
25
|
-
for (const op of operations) {
|
|
26
|
-
if (op.requestBody !== null) typeNames.add(op.requestBody.typeName);
|
|
27
|
-
if (op.responseBody !== null) typeNames.add(op.responseBody.typeName);
|
|
28
|
-
}
|
|
29
|
-
const matrix: string[][] = divideArray({
|
|
30
|
-
array: Array.from(typeNames),
|
|
31
|
-
capacity,
|
|
32
|
-
});
|
|
33
|
-
let progress: number = 0;
|
|
34
|
-
|
|
35
|
-
const x: AutoBeOpenApi.IComponents = {
|
|
36
|
-
schemas: {},
|
|
37
|
-
authorization: ctx.state().analyze?.roles,
|
|
38
|
-
};
|
|
39
|
-
for (const y of await Promise.all(
|
|
40
|
-
matrix.map(async (it) => {
|
|
41
|
-
const row: AutoBeOpenApi.IComponents = await divideAndConquer(
|
|
42
|
-
ctx,
|
|
43
|
-
operations,
|
|
44
|
-
it,
|
|
45
|
-
3,
|
|
46
|
-
(count) => {
|
|
47
|
-
progress += count;
|
|
48
|
-
},
|
|
49
|
-
);
|
|
50
|
-
ctx.dispatch({
|
|
51
|
-
type: "interfaceComponents",
|
|
52
|
-
components: row,
|
|
53
|
-
completed: progress,
|
|
54
|
-
total: typeNames.size,
|
|
55
|
-
step: ctx.state().analyze?.step ?? 0,
|
|
56
|
-
created_at: new Date().toISOString(),
|
|
57
|
-
});
|
|
58
|
-
return row;
|
|
59
|
-
}),
|
|
60
|
-
)) {
|
|
61
|
-
Object.assign(x.schemas, y.schemas);
|
|
62
|
-
}
|
|
63
|
-
return x;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
67
|
-
ctx: AutoBeContext<Model>,
|
|
68
|
-
operations: AutoBeOpenApi.IOperation[],
|
|
69
|
-
typeNames: string[],
|
|
70
|
-
retry: number,
|
|
71
|
-
progress: (completed: number) => void,
|
|
72
|
-
): Promise<AutoBeOpenApi.IComponents> {
|
|
73
|
-
const remained: Set<string> = new Set(typeNames);
|
|
74
|
-
const components: AutoBeOpenApi.IComponents = {
|
|
75
|
-
schemas: {},
|
|
76
|
-
};
|
|
77
|
-
for (let i: number = 0; i < retry; ++i) {
|
|
78
|
-
if (remained.size === 0) break;
|
|
79
|
-
const before: number = remained.size;
|
|
80
|
-
const newbie: AutoBeOpenApi.IComponents = await forceRetry(() =>
|
|
81
|
-
process(ctx, operations, components, remained),
|
|
82
|
-
);
|
|
83
|
-
for (const key of Object.keys(newbie.schemas)) {
|
|
84
|
-
components.schemas[key] = newbie.schemas[key];
|
|
85
|
-
remained.delete(key);
|
|
86
|
-
}
|
|
87
|
-
if (before - remained.size !== 0) progress(before - remained.size);
|
|
88
|
-
}
|
|
89
|
-
return components;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
async function process<Model extends ILlmSchema.Model>(
|
|
93
|
-
ctx: AutoBeContext<Model>,
|
|
94
|
-
operations: AutoBeOpenApi.IOperation[],
|
|
95
|
-
oldbie: AutoBeOpenApi.IComponents,
|
|
96
|
-
remained: Set<string>,
|
|
97
|
-
): Promise<AutoBeOpenApi.IComponents> {
|
|
98
|
-
const pointer: IPointer<AutoBeOpenApi.IComponents | null> = {
|
|
99
|
-
value: null,
|
|
100
|
-
};
|
|
101
|
-
const agentica: MicroAgentica<Model> = new MicroAgentica({
|
|
102
|
-
model: ctx.model,
|
|
103
|
-
vendor: ctx.vendor,
|
|
104
|
-
config: {
|
|
105
|
-
...(ctx.config ?? {}),
|
|
106
|
-
executor: {
|
|
107
|
-
describe: null,
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
histories: [
|
|
111
|
-
...transformInterfaceHistories(
|
|
112
|
-
ctx.state(),
|
|
113
|
-
AutoBeSystemPromptConstant.INTERFACE_SCHEMA,
|
|
114
|
-
),
|
|
115
|
-
{
|
|
116
|
-
id: v4(),
|
|
117
|
-
created_at: new Date().toISOString(),
|
|
118
|
-
type: "assistantMessage",
|
|
119
|
-
text: [
|
|
120
|
-
"Here is the OpenAPI operations generated by phase 2.",
|
|
121
|
-
"",
|
|
122
|
-
"```json",
|
|
123
|
-
JSON.stringify(operations),
|
|
124
|
-
"```",
|
|
125
|
-
].join("\n"),
|
|
126
|
-
},
|
|
127
|
-
],
|
|
128
|
-
controllers: [
|
|
129
|
-
createApplication({
|
|
130
|
-
model: ctx.model,
|
|
131
|
-
build: async (components) => {
|
|
132
|
-
pointer.value ??= {
|
|
133
|
-
schemas: {},
|
|
134
|
-
};
|
|
135
|
-
Object.assign(pointer.value.schemas, components.schemas);
|
|
136
|
-
},
|
|
137
|
-
pointer,
|
|
138
|
-
}),
|
|
139
|
-
],
|
|
140
|
-
});
|
|
141
|
-
enforceToolCall(agentica);
|
|
142
|
-
|
|
143
|
-
const already: string[] = Object.keys(oldbie.schemas);
|
|
144
|
-
await agentica
|
|
145
|
-
.conversate(
|
|
146
|
-
[
|
|
147
|
-
"Make type components please.",
|
|
148
|
-
"",
|
|
149
|
-
"Here is the list of request/response bodies' type names from",
|
|
150
|
-
"OpenAPI operations. Make type components of them. If more object",
|
|
151
|
-
"types are required during making the components, please make them",
|
|
152
|
-
"too.",
|
|
153
|
-
"",
|
|
154
|
-
...Array.from(remained).map((k) => `- \`${k}\``),
|
|
155
|
-
...(already.length !== 0
|
|
156
|
-
? [
|
|
157
|
-
"",
|
|
158
|
-
"> By the way, here is the list of components schemas what you've",
|
|
159
|
-
"> already made. So, you don't need to make them again.",
|
|
160
|
-
">",
|
|
161
|
-
...already.map((k) => `> - \`${k}\``),
|
|
162
|
-
]
|
|
163
|
-
: []),
|
|
164
|
-
].join("\n"),
|
|
165
|
-
)
|
|
166
|
-
.finally(() => {
|
|
167
|
-
const tokenUsage = agentica.getTokenUsage();
|
|
168
|
-
ctx.usage().record(tokenUsage, ["interface"]);
|
|
169
|
-
});
|
|
170
|
-
if (pointer.value === null) {
|
|
171
|
-
// never be happened
|
|
172
|
-
throw new Error("Failed to create components.");
|
|
173
|
-
}
|
|
174
|
-
return OpenApiV3_1Emender.convertComponents(
|
|
175
|
-
pointer.value,
|
|
176
|
-
) as AutoBeOpenApi.IComponents;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
function createApplication<Model extends ILlmSchema.Model>(props: {
|
|
180
|
-
model: Model;
|
|
181
|
-
build: (components: AutoBeOpenApi.IComponents) => Promise<void>;
|
|
182
|
-
pointer: IPointer<AutoBeOpenApi.IComponents | null>;
|
|
183
|
-
}): IAgenticaController.IClass<Model> {
|
|
184
|
-
assertSchemaModel(props.model);
|
|
185
|
-
|
|
186
|
-
const application: ILlmApplication<Model> = collection[
|
|
187
|
-
props.model
|
|
188
|
-
] as unknown as ILlmApplication<Model>;
|
|
189
|
-
return {
|
|
190
|
-
protocol: "class",
|
|
191
|
-
name: "interface",
|
|
192
|
-
application,
|
|
193
|
-
execute: {
|
|
194
|
-
makeComponents: async (next) => {
|
|
195
|
-
await props.build(next.components);
|
|
196
|
-
},
|
|
197
|
-
} satisfies IApplication,
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const claude = typia.llm.application<
|
|
202
|
-
IApplication,
|
|
203
|
-
"claude",
|
|
204
|
-
{ reference: true }
|
|
205
|
-
>();
|
|
206
|
-
const collection = {
|
|
207
|
-
chatgpt: typia.llm.application<
|
|
208
|
-
IApplication,
|
|
209
|
-
"chatgpt",
|
|
210
|
-
{ reference: true }
|
|
211
|
-
>(),
|
|
212
|
-
claude,
|
|
213
|
-
llama: claude,
|
|
214
|
-
deepseek: claude,
|
|
215
|
-
"3.1": claude,
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
interface IApplication {
|
|
219
|
-
/**
|
|
220
|
-
* Generate OpenAPI components containing named schema types.
|
|
221
|
-
*
|
|
222
|
-
* This method receives a complete set of schema components and integrates
|
|
223
|
-
* them into the final OpenAPI specification. It processes all entity schemas,
|
|
224
|
-
* their variants, and related type definitions to ensure a comprehensive and
|
|
225
|
-
* consistent API design.
|
|
226
|
-
*
|
|
227
|
-
* The provided components should include schemas for all entities identified
|
|
228
|
-
* in the previous phases of API path/method definition and operation
|
|
229
|
-
* creation. This ensures that the final OpenAPI document has complete type
|
|
230
|
-
* coverage for all operations.
|
|
231
|
-
*
|
|
232
|
-
* CRITICAL: All schema definitions must follow the established naming
|
|
233
|
-
* conventions (IEntityName, IEntityName.ICreate, etc.) and must be thoroughly
|
|
234
|
-
* documented with descriptions that reference the original Prisma schema
|
|
235
|
-
* comments.
|
|
236
|
-
*
|
|
237
|
-
* @param props Properties containing components to generate.
|
|
238
|
-
*/
|
|
239
|
-
makeComponents(props: IMakeComponentsProps): void;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
interface IMakeComponentsProps {
|
|
243
|
-
/**
|
|
244
|
-
* Complete set of schema components for the OpenAPI specification.
|
|
245
|
-
*
|
|
246
|
-
* This property contains comprehensive type definitions for all entities in
|
|
247
|
-
* the system. It is the central repository of all named schema types that
|
|
248
|
-
* will be used throughout the API specification.
|
|
249
|
-
*
|
|
250
|
-
* CRITICAL REQUIREMENT: All object types MUST be defined as named types in
|
|
251
|
-
* the components.schemas section. Inline anonymous object definitions are
|
|
252
|
-
* strictly prohibited.
|
|
253
|
-
*
|
|
254
|
-
* This components object should include:
|
|
255
|
-
*
|
|
256
|
-
* - Main entity types (IEntityName)
|
|
257
|
-
* - Operation-specific variants (.ICreate, .IUpdate, .ISummary, etc.)
|
|
258
|
-
* - Container types (IPage<T> for pagination)
|
|
259
|
-
* - Enumeration types
|
|
260
|
-
*
|
|
261
|
-
* All schema definitions must include detailed descriptions that reference
|
|
262
|
-
* the original Prisma schema comments and thoroughly document each property.
|
|
263
|
-
* Every property that references an object must use a $ref to a named type in
|
|
264
|
-
* the components.schemas section. This applies to all objects in request
|
|
265
|
-
* bodies, response bodies, and properties that are objects or arrays of
|
|
266
|
-
* objects.
|
|
267
|
-
*
|
|
268
|
-
* Example structure:
|
|
269
|
-
*
|
|
270
|
-
* ```typescript
|
|
271
|
-
* {
|
|
272
|
-
* components: {
|
|
273
|
-
* schemas: {
|
|
274
|
-
* IUser: {
|
|
275
|
-
* type: "object",
|
|
276
|
-
* properties: {
|
|
277
|
-
* id: { type: "string", format: "uuid" },
|
|
278
|
-
* email: { type: "string", format: "email" },
|
|
279
|
-
* profile: { "$ref": "#/components/schemas/IUserProfile" }
|
|
280
|
-
* },
|
|
281
|
-
* required: ["id", "email"],
|
|
282
|
-
* description: "User entity representing system account holders..."
|
|
283
|
-
* },
|
|
284
|
-
* "IUser.ICreate": { ... },
|
|
285
|
-
* // Additional schemas
|
|
286
|
-
* }
|
|
287
|
-
* }
|
|
288
|
-
* }
|
|
289
|
-
* ```
|
|
290
|
-
*/
|
|
291
|
-
components: Omit<AutoBeOpenApi.IComponents, "authorization">;
|
|
292
|
-
}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
-
import { v4 } from "uuid";
|
|
3
|
-
|
|
4
|
-
import { AutoBeState } from "../../context/AutoBeState";
|
|
5
|
-
|
|
6
|
-
export const transformInterfaceHistories = (
|
|
7
|
-
state: AutoBeState,
|
|
8
|
-
systemMessage: string,
|
|
9
|
-
): Array<
|
|
10
|
-
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
11
|
-
> => {
|
|
12
|
-
if (state.analyze === null)
|
|
13
|
-
return [
|
|
14
|
-
{
|
|
15
|
-
id: v4(),
|
|
16
|
-
created_at: new Date().toISOString(),
|
|
17
|
-
type: "systemMessage",
|
|
18
|
-
text: [
|
|
19
|
-
"Requirement analysis is not yet completed.",
|
|
20
|
-
"Don't call the any tool function,",
|
|
21
|
-
"but say to process the requirement analysis.",
|
|
22
|
-
].join(" "),
|
|
23
|
-
},
|
|
24
|
-
];
|
|
25
|
-
else if (state.prisma === null)
|
|
26
|
-
return [
|
|
27
|
-
{
|
|
28
|
-
id: v4(),
|
|
29
|
-
created_at: new Date().toISOString(),
|
|
30
|
-
type: "systemMessage",
|
|
31
|
-
text: [
|
|
32
|
-
"Prisma DB schema generation is not yet completed.",
|
|
33
|
-
"Don't call the any tool function,",
|
|
34
|
-
"but say to process the Prisma DB schema generation.",
|
|
35
|
-
].join(" "),
|
|
36
|
-
},
|
|
37
|
-
];
|
|
38
|
-
else if (state.analyze.step !== state.prisma.step)
|
|
39
|
-
return [
|
|
40
|
-
{
|
|
41
|
-
id: v4(),
|
|
42
|
-
created_at: new Date().toISOString(),
|
|
43
|
-
type: "systemMessage",
|
|
44
|
-
text: [
|
|
45
|
-
"Prisma DB schema generation has not been updated",
|
|
46
|
-
"for the latest requirement analysis.",
|
|
47
|
-
"Don't call the any tool function,",
|
|
48
|
-
"but say to re-process the Prisma DB schema generation.",
|
|
49
|
-
].join(" "),
|
|
50
|
-
},
|
|
51
|
-
];
|
|
52
|
-
else if (state.prisma.compiled.type !== "success")
|
|
53
|
-
return [
|
|
54
|
-
{
|
|
55
|
-
id: v4(),
|
|
56
|
-
created_at: new Date().toISOString(),
|
|
57
|
-
type: "systemMessage",
|
|
58
|
-
text: [
|
|
59
|
-
"Prisma DB schema generation has not been updated",
|
|
60
|
-
"for the latest requirement analysis.",
|
|
61
|
-
"Don't call the any tool function,",
|
|
62
|
-
"but say to re-process the Prisma DB schema generation.",
|
|
63
|
-
].join(" "),
|
|
64
|
-
},
|
|
65
|
-
];
|
|
66
|
-
return [
|
|
67
|
-
{
|
|
68
|
-
id: v4(),
|
|
69
|
-
created_at: new Date().toISOString(),
|
|
70
|
-
type: "systemMessage",
|
|
71
|
-
text: systemMessage,
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
id: v4(),
|
|
75
|
-
created_at: new Date().toISOString(),
|
|
76
|
-
type: "assistantMessage",
|
|
77
|
-
text: [
|
|
78
|
-
"Requirement analysis and Prisma DB schema generation are ready.",
|
|
79
|
-
"",
|
|
80
|
-
"Call the provided tool function to generate the OpenAPI document",
|
|
81
|
-
"referencing below requirement analysis and Prisma DB schema.",
|
|
82
|
-
"",
|
|
83
|
-
// User Request
|
|
84
|
-
`## User Request`,
|
|
85
|
-
"",
|
|
86
|
-
state.analyze.reason,
|
|
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
|
-
"",
|
|
113
|
-
// Requirement Analysis Report
|
|
114
|
-
`## Requirement Analysis Report`,
|
|
115
|
-
"",
|
|
116
|
-
"```json",
|
|
117
|
-
JSON.stringify(state.analyze.files),
|
|
118
|
-
"```",
|
|
119
|
-
].join("\n"),
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
id: v4(),
|
|
123
|
-
created_at: new Date().toISOString(),
|
|
124
|
-
type: "assistantMessage",
|
|
125
|
-
text: [
|
|
126
|
-
"Database schema and entity relationship diagrams are ready.",
|
|
127
|
-
"You should also look at this and consider logic including membership/login and token issuance.",
|
|
128
|
-
"You can use table's name to define role in operations.",
|
|
129
|
-
"",
|
|
130
|
-
"## Critical Schema Verification Instructions",
|
|
131
|
-
"",
|
|
132
|
-
"**IMPORTANT**: When generating API operations and descriptions:",
|
|
133
|
-
"1. ONLY reference fields that ACTUALLY EXIST in the Prisma schema below",
|
|
134
|
-
"2. NEVER assume common fields like `deleted_at`, `created_by`, `updated_by`, `is_deleted` exist",
|
|
135
|
-
"3. For DELETE operations:",
|
|
136
|
-
" - If schema HAS soft delete fields (e.g., `deleted_at`), describe soft delete behavior",
|
|
137
|
-
" - If schema LACKS soft delete fields, describe hard delete behavior",
|
|
138
|
-
"4. Verify EVERY field reference against the actual schema before including in descriptions",
|
|
139
|
-
"",
|
|
140
|
-
"## Prisma DB Schema",
|
|
141
|
-
"```json",
|
|
142
|
-
JSON.stringify(state.prisma.schemas),
|
|
143
|
-
"```",
|
|
144
|
-
"",
|
|
145
|
-
"## Entity Relationship Diagrams",
|
|
146
|
-
"```json",
|
|
147
|
-
JSON.stringify(state.prisma.compiled.diagrams),
|
|
148
|
-
"```",
|
|
149
|
-
].join("\n"),
|
|
150
|
-
},
|
|
151
|
-
];
|
|
152
|
-
};
|