@autobe/agent 0.14.5 → 0.15.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/AutoBeMockAgent.js +1 -1
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +11 -9
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/index.mjs +3557 -2635
- 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 +252 -226
- 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/{realize/structures/IAutoBeRealizeDecoratorApplication.js → interface/structures/IAutoBeInterfaceGroupApplication.js} +1 -1
- 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 +17 -3
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +81 -88
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.d.ts +4 -0
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +513 -0
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js +3 -2
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -1
- package/lib/orchestrate/realize/structures/{IAutoBeRealizeDecoratorApplication.d.ts → IAutoBeRealizeAuthorizationApplication.d.ts} +9 -9
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.js +3 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.js.map +1 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +33 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.js +3 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.js.map +1 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +34 -13
- package/lib/orchestrate/realize/transformRealizeAuthorization.d.ts +4 -0
- package/lib/orchestrate/realize/transformRealizeAuthorization.js +43 -0
- package/lib/orchestrate/realize/transformRealizeAuthorization.js.map +1 -0
- package/lib/orchestrate/realize/transformRealizeAuthorizationCorrectHistories.d.ts +5 -0
- package/lib/orchestrate/realize/transformRealizeAuthorizationCorrectHistories.js +71 -0
- package/lib/orchestrate/realize/transformRealizeAuthorizationCorrectHistories.js.map +1 -0
- 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/orchestrateTestCorrect.js +2 -0
- package/lib/orchestrate/test/orchestrateTestCorrect.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/orchestrateTestWrite.js +2 -0
- package/lib/orchestrate/test/orchestrateTestWrite.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 +6 -5
- package/src/AutoBeMockAgent.ts +1 -1
- package/src/constants/AutoBeSystemPromptConstant.ts +11 -9
- 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 +83 -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 +25 -3
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +45 -54
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +179 -0
- package/src/orchestrate/realize/orchestrateRealizeCoder.ts +3 -6
- package/src/orchestrate/realize/structures/{IAutoBeRealizeDecoratorApplication.ts → IAutoBeRealizeAuthorizationApplication.ts} +11 -9
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +40 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts +42 -24
- package/src/orchestrate/realize/{transformRealizeDecorator.ts → transformRealizeAuthorization.ts} +13 -2
- package/src/orchestrate/realize/{transformRealizeDecoratorCorrectHistories.ts → transformRealizeAuthorizationCorrectHistories.ts} +15 -7
- 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/orchestrateTestCorrect.ts +3 -0
- package/src/orchestrate/test/orchestrateTestScenario.ts +4 -2
- package/src/orchestrate/test/orchestrateTestWrite.ts +8 -1
- 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/lib/orchestrate/realize/structures/IAutoBeRealizeDecoratorApplication.js.map +0 -1
- package/lib/orchestrate/realize/transformRealizeDecorator.d.ts +0 -4
- package/lib/orchestrate/realize/transformRealizeDecorator.js +0 -32
- package/lib/orchestrate/realize/transformRealizeDecorator.js.map +0 -1
- package/lib/orchestrate/realize/transformRealizeDecoratorCorrectHistories.d.ts +0 -5
- package/lib/orchestrate/realize/transformRealizeDecoratorCorrectHistories.js +0 -62
- package/lib/orchestrate/realize/transformRealizeDecoratorCorrectHistories.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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IAutoBeRealizeDecoratorApplication.js","sourceRoot":"","sources":["../../../../src/orchestrate/realize/structures/IAutoBeRealizeDecoratorApplication.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
3
|
-
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
4
|
-
export declare const transformRealizeDecoratorHistories: (ctx: AutoBeContext<ILlmSchema.Model>, role: string) => Array<IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformRealizeDecoratorHistories = void 0;
|
|
4
|
-
const uuid_1 = require("uuid");
|
|
5
|
-
const transformRealizeDecoratorHistories = (ctx, role) => {
|
|
6
|
-
var _a;
|
|
7
|
-
return [
|
|
8
|
-
{
|
|
9
|
-
id: (0, uuid_1.v4)(),
|
|
10
|
-
created_at: new Date().toISOString(),
|
|
11
|
-
type: "systemMessage",
|
|
12
|
-
text: "# NestJS Authentication Provider & Decorator Generation AI Agent \n\nYou are a world-class NestJS expert and TypeScript developer. Your role is to automatically generate Provider functions and Decorators for JWT authentication based on given Role information and Prisma Schema. \n\n## Core Mission \n\nGenerate authentication Provider and Decorator code specialized for specific Roles based on Role information provided by users. \n\n## Input Information \n\n- **Role Name**: The authentication role to generate (e.g., admin, user, manager, etc.) \n- **Prisma Schema**: Database table information.\n\n## Code Generation Rules \n\n### 1. Provider Function Generation Rules \n\n- Function name: `{role}Authorize` format (e.g., adminAuthorize, userAuthorize) \n- Must use the `jwtAuthorize` function for JWT token verification \n- Verify payload type and check if `payload.type` matches the correct role \n- Query database using `MyGlobal.prisma.{tableName}` format to fetch **only the authorization model itself** - do not include relations or business logic models (no `include` statements for profile, etc.) \n- Verify that the user actually exists in the database \n- Function return type should be `{Role}Payload` interface \n- Return the `payload` variable whenever feasible in provider functions. \n- **Always check the Prisma schema for validation columns (e.g., `deleted_at`, status fields) within the authorization model and include them in the `where` clause to ensure the user is valid and active.** \n\n### 2. Payload Interface Generation Rules \n\n- Interface name: `{Role}Payload` format (e.g., AdminPayload, UserPayload) \n- Required fields: \n - `id: string & tags.Format<\"uuid\">`: User ID (UUID format) \n - `type: \"{role}\"`: Discriminator for role identification \n- Additional fields should be generated according to Role characteristics and \"Prisma Schema\" \n\n### 3. Decorator Generation Rules \n\n- Decorator name: `{Role}Auth` format (e.g., AdminAuth, UserAuth) \n- Use SwaggerCustomizer to add bearer token security schema to API documentation \n- Use createParamDecorator to implement actual authentication logic \n- Use Singleton pattern to manage decorator instances \n\n### 4. Code Style and Structure\n\n- Comply with TypeScript strict mode \n- Utilize NestJS Exception classes (ForbiddenException, UnauthorizedException) \n- Ensure type safety using typia tags \n- Add appropriate JSDoc comments \n\n## Reference Functions and Examples \n\n### JWT Authentication Function \n\n```typescript\n// path - src/authentications/jwtAuthorize.ts\nimport { ForbiddenException, UnauthorizedException } from \"@nestjs/common\";\nimport jwt from \"jsonwebtoken\";\n\nimport { MyGlobal } from \"../MyGlobal\";\n\nexport function jwtAuthorize(props: {\n request: {\n headers: { authorization?: string };\n };\n}) {\n if (!props.request.headers.authorization)\n throw new ForbiddenException(\"No token value exists\");\n else if (\n props.request.headers.authorization.startsWith(BEARER_PREFIX) === false\n )\n throw new UnauthorizedException(\"Invalid token\");\n\n // PARSE TOKEN\n try {\n const token: string = props.request.headers.authorization.substring(\n BEARER_PREFIX.length,\n );\n\n const verified = jwt.verify(token, MyGlobal.env.JWT_SECRET_KEY);\n\n return verified;\n } catch {\n throw new UnauthorizedException(\"Invalid token\");\n }\n}\n\nconst BEARER_PREFIX = \"Bearer \";\n``` \n\n### Provider Function Example \n\n```typescript\nimport { ForbiddenException } from \"@nestjs/common\";\n\nimport { MyGlobal } from \"../MyGlobal\";\nimport { jwtAuthorize } from \"./jwtAuthorize\";\nimport { AdminPayload } from \"./types/AdminPayload\";\n\nexport async function adminAuthorize(request: {\n headers: {\n authorization?: string;\n };\n}): Promise<AdminPayload> {\n const payload: AdminPayload = jwtAuthorize({ request }) as AdminPayload;\n\n if (payload.type !== \"admin\") {\n throw new ForbiddenException(`You're not ${payload.type}`);\n }\n\n const admin = await MyGlobal.prisma.admins.findFirst({\n where: {\n id: payload.id,\n user: {\n deleted_at: null,\n is_banned: false,\n },\n },\n });\n\n if (admin === null) {\n throw new ForbiddenException(\"You're not enrolled\");\n }\n\n return payload;\n}\n``` \n\n### Decorator Example\n\n```typescript\nimport { SwaggerCustomizer } from \"@nestia/core\";\nimport { ExecutionContext, createParamDecorator } from \"@nestjs/common\";\nimport { Singleton } from \"tstl\";\n\nimport { adminAuthorize } from \"../authentications/adminAuthorize\";\n\nexport const AdminAuth =\n (): ParameterDecorator =>\n (\n target: object,\n propertyKey: string | symbol | undefined,\n parameterIndex: number,\n ): void => {\n SwaggerCustomizer((props) => {\n props.route.security ??= [];\n props.route.security.push({\n bearer: [],\n });\n })(target, propertyKey as string, undefined!);\n singleton.get()(target, propertyKey, parameterIndex);\n };\n\nconst singleton = new Singleton(() =>\n createParamDecorator(async (_0: unknown, ctx: ExecutionContext) => {\n const request = ctx.switchToHttp().getRequest();\n return adminAuthorize(request);\n })(),\n);\n``` \n\n### Decorator Type Example \n\nIn case of the columns related to Date type like `created_at`, `updated_at`, `deleted_at`, must use the `string & tags.Format<'date-time'>` Type instead of Date type. \n\n```typescript\nimport { tags } from \"typia\";\n\nexport interface AdminPayload {\n /**\n * Admin ID.\n */\n id: string & tags.Format<\"uuid\">;\n\n /**\n * Discriminator for the discriminated union type.\n */\n type: \"admin\";\n}\n``` \n\n## Output Format \n\nYou must provide your response in a structured JSON format containing the following nested structure: \n\n**provider**: An object containing the authentication Provider function configuration \n\n- **name**: The name of the authentication Provider function in `{role}Authorize` format (e.g., adminAuthorize, userAuthorize). This function verifies JWT tokens and returns user information for the specified role. \n- **code**: Complete TypeScript code for the authentication Provider function only. Must include JWT verification, role checking, database query logic, and proper import statements for the Payload interface.\n\n**decorator**: An object containing the authentication Decorator configuration \n\n- **name**: The name of the Decorator to be generated in `{Role}Auth` format (e.g., AdminAuth, UserAuth). The decorator name used in Controller method parameters. \n- **code**: Complete TypeScript code for the Decorator. Must include complete authentication decorator implementation using SwaggerCustomizer, createParamDecorator, and Singleton pattern.\n\n**decoratorType**: An object containing the Decorator Type configuration\n\n- **name**: The name of the Decorator Type in `{Role}Payload` format (e.g., AdminPayload, UserPayload). Used as the TypeScript type for the authenticated user data.\n- **code**: Complete TypeScript code for the Payload type interface. Must include proper field definitions with typia tags for type safety.\n\n## Work Process \n\n1. Analyze the input Role name \n2. Generate Provider function for the Role \n3. Define Payload interface \n4. Implement Decorator \n5. Verify that all code follows example patterns \n6. Generate response in specified format \n\n## Quality Standards \n\n- Ensure type safety \n- Follow NestJS conventions \n- Complete error handling \n- Code reusability \n- Complete documentation \n\nWhen users provide Role information, generate complete and practical authentication code according to the above rules." /* AutoBeSystemPromptConstant.REALIZE_DECORATOR */,
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
id: (0, uuid_1.v4)(),
|
|
16
|
-
created_at: new Date().toISOString(),
|
|
17
|
-
type: "systemMessage",
|
|
18
|
-
text: [
|
|
19
|
-
"## Role",
|
|
20
|
-
"",
|
|
21
|
-
role,
|
|
22
|
-
"",
|
|
23
|
-
"## Prisma Schema",
|
|
24
|
-
"",
|
|
25
|
-
JSON.stringify((_a = ctx.state().prisma) === null || _a === void 0 ? void 0 : _a.schemas, null, 2),
|
|
26
|
-
"",
|
|
27
|
-
].join("\n"),
|
|
28
|
-
},
|
|
29
|
-
];
|
|
30
|
-
};
|
|
31
|
-
exports.transformRealizeDecoratorHistories = transformRealizeDecoratorHistories;
|
|
32
|
-
//# sourceMappingURL=transformRealizeDecorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transformRealizeDecorator.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/transformRealizeDecorator.ts"],"names":[],"mappings":";;;AAEA,+BAA0B;AAKnB,MAAM,kCAAkC,GAAG,CAChD,GAAoC,EACpC,IAAY,EAGZ,EAAE;;IACF,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,kqPAA8C;SACnD;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE;gBACJ,SAAS;gBACT,EAAE;gBACF,IAAI;gBACJ,EAAE;gBACF,kBAAkB;gBAClB,EAAE;gBACF,IAAI,CAAC,SAAS,CAAC,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,MAAM,0CAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;gBACpD,EAAE;aACH,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;AACJ,CAAC,CAAC;AA7BW,QAAA,kCAAkC,sCA6B7C"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
-
import { AutoBeRealizeAuthorization, IAutoBeTypeScriptCompileResult } from "@autobe/interface";
|
|
3
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
4
|
-
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
5
|
-
export declare const transformRealizeDecoratorCorrectHistories: (ctx: AutoBeContext<ILlmSchema.Model>, auth: AutoBeRealizeAuthorization, templateFiles: Record<string, string>, diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[]) => Array<IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage>;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformRealizeDecoratorCorrectHistories = void 0;
|
|
4
|
-
const uuid_1 = require("uuid");
|
|
5
|
-
const transformRealizeDecoratorCorrectHistories = (ctx, auth, templateFiles, diagnostics) => {
|
|
6
|
-
var _a;
|
|
7
|
-
return [
|
|
8
|
-
{
|
|
9
|
-
id: (0, uuid_1.v4)(),
|
|
10
|
-
created_at: new Date().toISOString(),
|
|
11
|
-
type: "systemMessage",
|
|
12
|
-
text: "# TypeScript Compiler Feedback Correction System \n\nYou are an expert TypeScript developer specializing in fixing compilation errors in NestJS authentication systems. Your task is to analyze TypeScript compilation diagnostics and correct the generated code to ensure it compiles successfully. \n\n## Your Role \n\nYou will receive: \n\n1. **Generated TypeScript Code** - Authentication provider and decorator implementations \n2. **Prisma Schema** - Available database table \n3. **File Paths** - Project structure for import resolution \n4. **Compile Errors** - TypeScript diagnostic information \n\nYour goal is to fix all compilation errors while maintaining the original functionality and structure. \n\n## Analysis Process \n\nFollow this systematic approach to fix compilation errors: \n\n### Step 1: Error Analysis \n\n- Examine each diagnostic error carefully \n- Identify the error type (import issues, type mismatches, missing properties, etc.) \n- Note the file location and specific line/character positions \n- Categorize errors by severity and interdependency \n\n### Step 2: Context Understanding\n\n- Review the available Prisma client mappings to understand database schema \n- Check file paths to ensure correct import statements \n- Validate that all referenced types and interfaces exist \n- Understand the relationship between provider and decorator implementations \n\n### Step 3: Root Cause Identification\n\n- Determine if errors are due to: \n - Incorrect Prisma table names (use Prisma Schema mapping) \n - Wrong import paths (use provided file paths) \n - Missing type definitions \n - Incorrect function signatures \n - Incompatible TypeScript syntax \n\n### Step 4: Systematic Correction \n\n- Fix errors in dependency order (types before implementations) \n- Ensure consistency between provider and decorator implementations \n- Maintain original naming conventions and patterns \n- Preserve all required functionality \n\n## Common Error Types and Solutions \n\n### Database Table Access Errors\n\n- **Problem**: `Property 'tableName' does not exist on type 'PrismaClients'` \n- **Solution**: Check `Prisma Schema` mapping for correct table names \n- **Example**: If error shows `admins` but model of prisma Schema shows `admin`, use `admin` \n\n### Import Path Errors \n\n- **Problem**: Module resolution failures \n- **Solution**: Use provided file paths to construct correct relative imports \n- **Example**: Adjust `./` vs `../` based on actual file structure \n\n### Type Definition Errors \n\n- **Problem**: Missing or incorrect type references \n- **Solution**: Ensure all interfaces and types are properly defined and exported \n- **Example**: Add missing `export` keywords or correct type names \n\n### Function Signature Mismatches\n\n- **Problem**: Parameter types don't match expected signatures \n- **Solution**: Align function parameters with NestJS and custom type requirements \n- **Example**: Ensure JWT payload types match expected structure \n\n## Code Correction Guidelines \n\n### 1. Preserve Original Structure \n\n- Keep the same function names and export patterns \n- Maintain the provider-decorator relationship \n- Preserve all required imports and dependencies \n\n### 2. Database Integration \n\n- Use exact table names from `Prisma Schema` mapping \n- Ensure proper async/await patterns for database queries \n- Maintain proper error handling for database operations \n\n### 3. Type Safety\n\n- Ensure all types are properly imported and defined \n- Use typia tags correctly for validation \n- Maintain strict TypeScript compliance \n\n### 4. NestJS Integration \n\n- Preserve decorator patterns and parameter injection \n- Maintain proper exception handling (ForbiddenException, UnauthorizedException) \n- Ensure Swagger integration remains intact \n\n## Output Format \n\nProvide your corrected code in the following JSON format: \n\n```json\n{\n \"provider\": {\n \"name\": \"corrected_provider_name\",\n \"code\": \"corrected_provider_code\"\n },\n \"decorator\": {\n \"name\": \"corrected_decorator_name\", \n \"code\": \"corrected_decorator_code\"\n }\n \"decoratorType\": {\n \"name\": \"corrected_payload_type_name\",\n \"code\": \"corrected_payload_type_code\"\n }\n}\n``` \n\n## Validation Checklist \n\nBefore submitting your corrections, verify: \n\n- [ ] All compilation errors are addressed \n- [ ] Database table names match Prisma Schema mapping \n- [ ] Import paths are correct based on file structure \n- [ ] All types are properly defined and exported \n- [ ] Function signatures match expected patterns \n- [ ] Error handling is preserved \n- [ ] Original functionality is maintained \n- [ ] Code follows TypeScript best practices \n\n## Response Process \n\n1. **First**, analyze all errors and identify patterns \n2. **Then**, explain your understanding of the issues \n3. **Next**, describe your correction strategy \n4. **Finally**, provide the corrected code in the specified JSON format \n\nRemember: Focus on fixing compilation errors while preserving the original authentication logic and NestJS integration patterns." /* AutoBeSystemPromptConstant.REALIZE_DECORATOR_CORRECT */,
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
id: (0, uuid_1.v4)(),
|
|
16
|
-
created_at: new Date().toISOString(),
|
|
17
|
-
type: "assistantMessage",
|
|
18
|
-
text: [
|
|
19
|
-
"## Generated TypeScript Code",
|
|
20
|
-
"",
|
|
21
|
-
"```json",
|
|
22
|
-
`${JSON.stringify({
|
|
23
|
-
provider: {
|
|
24
|
-
name: auth.provider.name,
|
|
25
|
-
code: auth.provider.content,
|
|
26
|
-
},
|
|
27
|
-
decorator: {
|
|
28
|
-
name: auth.decorator.name,
|
|
29
|
-
code: auth.decorator.content,
|
|
30
|
-
},
|
|
31
|
-
payload: {
|
|
32
|
-
name: auth.payload.name,
|
|
33
|
-
code: auth.payload.content,
|
|
34
|
-
},
|
|
35
|
-
}, null, 2)}`,
|
|
36
|
-
"```",
|
|
37
|
-
"",
|
|
38
|
-
"## Prisma Schema",
|
|
39
|
-
"",
|
|
40
|
-
"```json",
|
|
41
|
-
`${JSON.stringify((_a = ctx.state().prisma) === null || _a === void 0 ? void 0 : _a.schemas, null, 2)}`,
|
|
42
|
-
"```",
|
|
43
|
-
"",
|
|
44
|
-
"## File Paths",
|
|
45
|
-
"",
|
|
46
|
-
Object.keys(templateFiles)
|
|
47
|
-
.map((path) => `- ${path}`)
|
|
48
|
-
.join("\n"),
|
|
49
|
-
"",
|
|
50
|
-
"## Compile Errors",
|
|
51
|
-
"",
|
|
52
|
-
"Fix the compilation error in the provided code.",
|
|
53
|
-
"",
|
|
54
|
-
"```json",
|
|
55
|
-
JSON.stringify(diagnostics, null, 2),
|
|
56
|
-
"```",
|
|
57
|
-
].join("\n"),
|
|
58
|
-
},
|
|
59
|
-
];
|
|
60
|
-
};
|
|
61
|
-
exports.transformRealizeDecoratorCorrectHistories = transformRealizeDecoratorCorrectHistories;
|
|
62
|
-
//# sourceMappingURL=transformRealizeDecoratorCorrectHistories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transformRealizeDecoratorCorrectHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/transformRealizeDecoratorCorrectHistories.ts"],"names":[],"mappings":";;;AAMA,+BAA0B;AAMnB,MAAM,yCAAyC,GAAG,CACvD,GAAoC,EACpC,IAAgC,EAChC,aAAqC,EACrC,WAAyD,EAGzD,EAAE;;IACF,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,8pKAAsD;SAC3D;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE;gBACJ,8BAA8B;gBAC9B,EAAE;gBACF,SAAS;gBACT,GAAG,IAAI,CAAC,SAAS,CACf;oBACE,QAAQ,EAAE;wBACR,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI;wBACxB,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO;qBAC5B;oBACD,SAAS,EAAE;wBACT,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI;wBACzB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO;qBAC7B;oBACD,OAAO,EAAE;wBACP,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;wBACvB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;qBAC3B;iBACkD,EACrD,IAAI,EACJ,CAAC,CACF,EAAE;gBACH,KAAK;gBACL,EAAE;gBACF,kBAAkB;gBAClB,EAAE;gBACF,SAAS;gBACT,GAAG,IAAI,CAAC,SAAS,CAAC,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,MAAM,0CAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;gBACzD,KAAK;gBACL,EAAE;gBACF,eAAe;gBACf,EAAE;gBACF,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;qBACvB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;qBAC1B,IAAI,CAAC,IAAI,CAAC;gBACb,EAAE;gBACF,mBAAmB;gBACnB,EAAE;gBACF,iDAAiD;gBACjD,EAAE;gBACF,SAAS;gBACT,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;gBACpC,KAAK;aACN,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;AACJ,CAAC,CAAC;AAjEW,QAAA,yCAAyC,6CAiEpD"}
|
|
@@ -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
|
-
}
|