@autobe/agent 0.3.24 → 0.4.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.d.ts +0 -7
- package/lib/AutoBeAgent.js +5 -5
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +4 -4
- package/lib/factory/createAgenticaHistory.js +1 -1
- package/lib/factory/createAgenticaHistory.js.map +1 -1
- package/lib/factory/createAutoBeApplication.js +9 -9
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/index.d.ts +0 -4
- package/lib/index.mjs +3508 -504
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/interface/transformInterfaceHistories.js +3 -3
- package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +13 -8
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +67 -26
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.d.ts +4 -0
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +2010 -0
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -0
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js +1649 -80
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +1 -1
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaCorrectHistories.d.ts +3 -0
- package/lib/orchestrate/prisma/{transformPrismaCompilerHistories.js → transformPrismaCorrectHistories.js} +11 -10
- package/lib/orchestrate/prisma/transformPrismaCorrectHistories.js.map +1 -0
- package/lib/orchestrate/prisma/transformPrismaHistories.js +1 -1
- package/lib/orchestrate/prisma/transformPrismaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +1 -1
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
- package/package.json +4 -4
- package/src/AutoBeAgent.ts +5 -5
- package/src/constants/AutoBeSystemPromptConstant.ts +4 -4
- package/src/factory/createAgenticaHistory.ts +1 -1
- package/src/factory/createAutoBeApplication.ts +9 -9
- package/src/orchestrate/interface/transformInterfaceHistories.ts +3 -3
- package/src/orchestrate/prisma/orchestratePrisma.ts +20 -12
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +6 -3
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +258 -0
- package/src/orchestrate/prisma/orchestratePrismaSchema.ts +16 -53
- package/src/orchestrate/prisma/{transformPrismaCompilerHistories.ts → transformPrismaCorrectHistories.ts} +10 -10
- package/lib/orchestrate/prisma/orchestratePrismaCompiler.d.ts +0 -4
- package/lib/orchestrate/prisma/orchestratePrismaCompiler.js +0 -443
- package/lib/orchestrate/prisma/orchestratePrismaCompiler.js.map +0 -1
- package/lib/orchestrate/prisma/transformPrismaCompilerHistories.d.ts +0 -3
- package/lib/orchestrate/prisma/transformPrismaCompilerHistories.js.map +0 -1
- package/src/orchestrate/prisma/orchestratePrismaCompiler.ts +0 -276
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { IAgenticaController, MicroAgentica } from "@agentica/core";
|
|
2
|
+
import { AutoBePrisma, IAutoBePrismaValidation } from "@autobe/interface";
|
|
3
|
+
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
4
|
+
import { IPointer } from "tstl";
|
|
5
|
+
import typia from "typia";
|
|
6
|
+
|
|
7
|
+
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
8
|
+
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
9
|
+
import { transformPrismaCorrectHistories } from "./transformPrismaCorrectHistories";
|
|
10
|
+
|
|
11
|
+
export function orchestratePrismaCorrect<Model extends ILlmSchema.Model>(
|
|
12
|
+
ctx: AutoBeContext<Model>,
|
|
13
|
+
application: AutoBePrisma.IApplication,
|
|
14
|
+
retry: number = 8,
|
|
15
|
+
): Promise<IAutoBePrismaValidation> {
|
|
16
|
+
return step(ctx, application, retry);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function step<Model extends ILlmSchema.Model>(
|
|
20
|
+
ctx: AutoBeContext<Model>,
|
|
21
|
+
application: AutoBePrisma.IApplication,
|
|
22
|
+
life: number,
|
|
23
|
+
): Promise<IAutoBePrismaValidation> {
|
|
24
|
+
const result: IAutoBePrismaValidation =
|
|
25
|
+
await ctx.compiler.prisma.validate(application);
|
|
26
|
+
if (result.success) return result; // SUCCESS
|
|
27
|
+
|
|
28
|
+
// VALIDATION FAILED
|
|
29
|
+
const schemas: Record<string, string> =
|
|
30
|
+
await ctx.compiler.prisma.write(application);
|
|
31
|
+
ctx.dispatch({
|
|
32
|
+
type: "prismaValidate",
|
|
33
|
+
result,
|
|
34
|
+
schemas,
|
|
35
|
+
compiled: await ctx.compiler.prisma.compile({
|
|
36
|
+
files: schemas,
|
|
37
|
+
}),
|
|
38
|
+
step: ctx.state().analyze?.step ?? 0,
|
|
39
|
+
created_at: new Date().toISOString(),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const pointer: IPointer<IModifyPrismaSchemaFilesProps | null> = {
|
|
43
|
+
value: null,
|
|
44
|
+
};
|
|
45
|
+
const agentica: MicroAgentica<Model> = new MicroAgentica({
|
|
46
|
+
model: ctx.model,
|
|
47
|
+
vendor: ctx.vendor,
|
|
48
|
+
config: {
|
|
49
|
+
...(ctx.config ?? {}),
|
|
50
|
+
},
|
|
51
|
+
histories: transformPrismaCorrectHistories(result),
|
|
52
|
+
tokenUsage: ctx.usage(),
|
|
53
|
+
controllers: [
|
|
54
|
+
createApplication({
|
|
55
|
+
model: ctx.model,
|
|
56
|
+
build: (next) => {
|
|
57
|
+
pointer.value = next;
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
],
|
|
61
|
+
});
|
|
62
|
+
agentica.on("request", (event) => {
|
|
63
|
+
if (event.body.tools) {
|
|
64
|
+
event.body.tool_choice = "required";
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// REQUEST CORRECTION
|
|
69
|
+
await agentica.conversate(
|
|
70
|
+
"Resolve the compilation errors in the provided Prisma schema files.",
|
|
71
|
+
);
|
|
72
|
+
if (pointer.value === null) {
|
|
73
|
+
console.error(
|
|
74
|
+
"Unreachable error: PrismaCompilerAgent.pointer.value is null",
|
|
75
|
+
);
|
|
76
|
+
return result; // unreachable
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
ctx.dispatch({
|
|
80
|
+
type: "prismaCorrect",
|
|
81
|
+
failure: result,
|
|
82
|
+
correction: {
|
|
83
|
+
files: pointer.value.files,
|
|
84
|
+
},
|
|
85
|
+
planning: pointer.value.planning,
|
|
86
|
+
step: ctx.state().analyze?.step ?? 0,
|
|
87
|
+
created_at: new Date().toISOString(),
|
|
88
|
+
});
|
|
89
|
+
return step(
|
|
90
|
+
ctx,
|
|
91
|
+
{
|
|
92
|
+
files: pointer.value.files,
|
|
93
|
+
},
|
|
94
|
+
life - 1,
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function createApplication<Model extends ILlmSchema.Model>(props: {
|
|
99
|
+
model: Model;
|
|
100
|
+
build: (next: IModifyPrismaSchemaFilesProps) => void;
|
|
101
|
+
}): IAgenticaController.IClass<Model> {
|
|
102
|
+
assertSchemaModel(props.model);
|
|
103
|
+
const application: ILlmApplication<Model> = collection[
|
|
104
|
+
props.model
|
|
105
|
+
] as unknown as ILlmApplication<Model>;
|
|
106
|
+
return {
|
|
107
|
+
protocol: "class",
|
|
108
|
+
name: "Prisma Compiler",
|
|
109
|
+
application,
|
|
110
|
+
execute: {
|
|
111
|
+
correctPrismaSchemaFiles: (next) => {
|
|
112
|
+
props.build(next);
|
|
113
|
+
},
|
|
114
|
+
} satisfies IApplication,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const claude = typia.llm.application<
|
|
119
|
+
IApplication,
|
|
120
|
+
"claude",
|
|
121
|
+
{ reference: true }
|
|
122
|
+
>();
|
|
123
|
+
const collection = {
|
|
124
|
+
chatgpt: typia.llm.application<
|
|
125
|
+
IApplication,
|
|
126
|
+
"chatgpt",
|
|
127
|
+
{ reference: true }
|
|
128
|
+
>(),
|
|
129
|
+
claude,
|
|
130
|
+
llama: claude,
|
|
131
|
+
deepseek: claude,
|
|
132
|
+
"3.1": claude,
|
|
133
|
+
"3.0": typia.llm.application<IApplication, "3.0">(),
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
interface IApplication {
|
|
137
|
+
/**
|
|
138
|
+
* Fixes validation errors in AutoBePrisma.IApplication structure while
|
|
139
|
+
* preserving ALL existing business logic and model descriptions.
|
|
140
|
+
*
|
|
141
|
+
* ## Core Rules
|
|
142
|
+
*
|
|
143
|
+
* 1. Fix ONLY validation errors - never remove business descriptions
|
|
144
|
+
* 2. Apply minimal changes - preserve original design intent
|
|
145
|
+
* 3. Return COMPLETE corrected structure - no data loss allowed
|
|
146
|
+
* 4. Maintain referential integrity across all models
|
|
147
|
+
*
|
|
148
|
+
* ## Preservation Requirements
|
|
149
|
+
*
|
|
150
|
+
* - Keep ALL model and field descriptions
|
|
151
|
+
* - Keep business logic and architectural patterns
|
|
152
|
+
* - Maintain relationship semantics and cardinality
|
|
153
|
+
* - Remove descriptions only when removing duplicate elements
|
|
154
|
+
*
|
|
155
|
+
* ## Fix Strategy
|
|
156
|
+
*
|
|
157
|
+
* - Resolve structural validation errors without changing business intent
|
|
158
|
+
* - Remove duplicate fields/relations while preserving most appropriate ones
|
|
159
|
+
* - Fix invalid references and type mismatches
|
|
160
|
+
* - Ensure naming conventions and index rules compliance
|
|
161
|
+
*/
|
|
162
|
+
correctPrismaSchemaFiles(props: IModifyPrismaSchemaFilesProps): void;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
interface IModifyPrismaSchemaFilesProps {
|
|
166
|
+
/**
|
|
167
|
+
* Detailed execution plan for fixing AutoBePrisma validation errors.
|
|
168
|
+
*
|
|
169
|
+
* 🎯 Purpose: Enable systematic reasoning and step-by-step error resolution
|
|
170
|
+
* approach for structured schema validation issues
|
|
171
|
+
*
|
|
172
|
+
* 📋 Required Planning Content:
|
|
173
|
+
*
|
|
174
|
+
* 1. **Error Analysis Summary**
|
|
175
|
+
*
|
|
176
|
+
* - List all validation errors from IAutoBePrismaValidation.IError[] array
|
|
177
|
+
* - Categorize errors by type (duplications, references, types, indexes)
|
|
178
|
+
* - Identify root causes and error interdependencies
|
|
179
|
+
* 2. **Fix Strategy Overview**
|
|
180
|
+
*
|
|
181
|
+
* - Prioritize fixes based on dependencies (fix duplications first)
|
|
182
|
+
* - Outline minimal changes needed for each validation error
|
|
183
|
+
* - Identify potential impact on other models/relationships
|
|
184
|
+
* 3. **Step-by-Step Fix Plan**
|
|
185
|
+
*
|
|
186
|
+
* - Model-by-model modification plan with specific changes
|
|
187
|
+
* - Exact field additions, removals, or renames required
|
|
188
|
+
* - Reference updates needed for renamed elements
|
|
189
|
+
* - Index corrections to comply with validation rules
|
|
190
|
+
* 4. **Preservation Checklist**
|
|
191
|
+
*
|
|
192
|
+
* - Confirm which descriptions and business logic must be preserved
|
|
193
|
+
* - List relationships and constraints to maintain unchanged
|
|
194
|
+
* - Identify cross-model dependencies that must remain intact
|
|
195
|
+
* 5. **Risk Assessment**
|
|
196
|
+
*
|
|
197
|
+
* - Potential side effects of each planned fix
|
|
198
|
+
* - Validation points to check after applying corrections
|
|
199
|
+
* - Ensure no new validation errors are introduced
|
|
200
|
+
*
|
|
201
|
+
* 💡 Example Planning Structure:
|
|
202
|
+
*
|
|
203
|
+
* ## Error Analysis
|
|
204
|
+
* - Error 1: Duplicate field 'name' in shopping_customers model
|
|
205
|
+
* - Error 2: Invalid targetModel 'shopping_customer' should be 'shopping_customers'
|
|
206
|
+
*
|
|
207
|
+
* ## Fix Strategy
|
|
208
|
+
* 1. Remove duplicate 'name' field (keep the more detailed one)
|
|
209
|
+
* 2. Update foreign key references to use correct plural model name
|
|
210
|
+
*
|
|
211
|
+
* ## Detailed Steps
|
|
212
|
+
* 1. shopping_customers model: Remove second 'name' field from plainFields
|
|
213
|
+
* 2. shopping_orders model: Update targetModel from 'shopping_customer' to 'shopping_customers'
|
|
214
|
+
*
|
|
215
|
+
* ## Preservation Notes
|
|
216
|
+
* - Keep business descriptions for remaining 'name' field
|
|
217
|
+
* - Maintain all relationship semantics
|
|
218
|
+
* - Preserve all indexes and constraints
|
|
219
|
+
*/
|
|
220
|
+
planning: string;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Original AutoBePrisma.IApplication structure that contains validation
|
|
224
|
+
* errors and needs correction.
|
|
225
|
+
*
|
|
226
|
+
* 📥 Input Structure:
|
|
227
|
+
*
|
|
228
|
+
* - Complete IApplication with files array containing validation errors
|
|
229
|
+
* - Each file contains models with potential structural issues
|
|
230
|
+
* - Errors may include duplications, invalid references, or constraint
|
|
231
|
+
* violations
|
|
232
|
+
*
|
|
233
|
+
* 🔍 Expected Validation Issues:
|
|
234
|
+
*
|
|
235
|
+
* - Duplicate model names across files
|
|
236
|
+
* - Duplicate field/relation names within models
|
|
237
|
+
* - Invalid foreign key references to non-existent models
|
|
238
|
+
* - Single foreign key fields in index arrays
|
|
239
|
+
* - Non-plural model names or invalid naming conventions
|
|
240
|
+
*
|
|
241
|
+
* 📝 Application Content Analysis:
|
|
242
|
+
*
|
|
243
|
+
* - All models with their complete field definitions
|
|
244
|
+
* - All relationships with targetModel and targetfield configurations
|
|
245
|
+
* - All indexes (unique, plain, GIN) with field references
|
|
246
|
+
* - All business descriptions and requirement mappings
|
|
247
|
+
* - Cross-file model references and dependencies
|
|
248
|
+
*
|
|
249
|
+
* ⚠️ Processing Notes:
|
|
250
|
+
*
|
|
251
|
+
* - Structure may contain validation errors that prevent code generation
|
|
252
|
+
* - Some models might reference non-existent targets
|
|
253
|
+
* - Field names might violate naming conventions
|
|
254
|
+
* - Index configurations might include forbidden single foreign keys
|
|
255
|
+
* - Business logic and descriptions must be preserved during fixes
|
|
256
|
+
*/
|
|
257
|
+
files: AutoBePrisma.IFile[];
|
|
258
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IAgenticaController, MicroAgentica } from "@agentica/core";
|
|
2
|
+
import { AutoBePrisma } from "@autobe/interface";
|
|
2
3
|
import { AutoBePrismaSchemasEvent } from "@autobe/interface/src/events/AutoBePrismaSchemasEvent";
|
|
3
4
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
4
5
|
import { IPointer } from "tstl";
|
|
@@ -19,10 +20,9 @@ export async function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(
|
|
|
19
20
|
|
|
20
21
|
const total: number = components.reduce((acc, c) => acc + c.tables.length, 0);
|
|
21
22
|
let i: number = 0;
|
|
22
|
-
|
|
23
23
|
return await Promise.all(
|
|
24
24
|
components.map(async (c) => {
|
|
25
|
-
const result:
|
|
25
|
+
const result: IMakePrismaSchemaFileProps = await process(ctx, {
|
|
26
26
|
filename: c.filename,
|
|
27
27
|
tables: c.tables,
|
|
28
28
|
entireTables,
|
|
@@ -30,8 +30,7 @@ export async function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(
|
|
|
30
30
|
const event: AutoBePrismaSchemasEvent = {
|
|
31
31
|
type: "prismaSchemas",
|
|
32
32
|
created_at: start.toISOString(),
|
|
33
|
-
|
|
34
|
-
content: result.content,
|
|
33
|
+
file: result.file,
|
|
35
34
|
completed: (i += c.tables.length),
|
|
36
35
|
total,
|
|
37
36
|
step: ctx.state().analyze?.step ?? 0,
|
|
@@ -49,8 +48,8 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
49
48
|
tables: string[];
|
|
50
49
|
entireTables: string[];
|
|
51
50
|
},
|
|
52
|
-
): Promise<
|
|
53
|
-
const pointer: IPointer<
|
|
51
|
+
): Promise<IMakePrismaSchemaFileProps> {
|
|
52
|
+
const pointer: IPointer<IMakePrismaSchemaFileProps | null> = {
|
|
54
53
|
value: null,
|
|
55
54
|
};
|
|
56
55
|
const agentica: MicroAgentica<Model> = new MicroAgentica({
|
|
@@ -66,6 +65,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
66
65
|
model: ctx.model,
|
|
67
66
|
build: (next) => {
|
|
68
67
|
pointer.value = next;
|
|
68
|
+
pointer.value.file.filename = component.filename;
|
|
69
69
|
},
|
|
70
70
|
}),
|
|
71
71
|
],
|
|
@@ -75,42 +75,15 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
75
75
|
event.body.tool_choice = "required";
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
|
-
|
|
79
|
-
await agentica.conversate(
|
|
80
|
-
[
|
|
81
|
-
"Please generate Prisma schema files based on the previous requirement analysis report.",
|
|
82
|
-
"",
|
|
83
|
-
"**Context:**",
|
|
84
|
-
`- Target filename: \`${component.filename}\``,
|
|
85
|
-
`- Tables to implement in this file: \`${component.tables.join("`, `")}\``,
|
|
86
|
-
`- All available tables in the system: \`${component.entireTables.join("`, `")}\``,
|
|
87
|
-
"",
|
|
88
|
-
"**Instructions:**",
|
|
89
|
-
"1. Create comprehensive Prisma schema content for the specified tables",
|
|
90
|
-
"2. Reference the previous requirement analysis to understand business logic and data structures",
|
|
91
|
-
"3. Establish appropriate relationships between tables using the entireTables list as reference",
|
|
92
|
-
"4. Include proper field types, constraints, indexes, and documentation",
|
|
93
|
-
"5. Follow enterprise-level schema design patterns and best practices",
|
|
94
|
-
"6. Ensure cross-table relationships are accurately modeled based on business requirements",
|
|
95
|
-
"",
|
|
96
|
-
"**Key Requirements:**",
|
|
97
|
-
"- Implement only the tables specified for this file",
|
|
98
|
-
"- Create foreign key relationships to tables from entireTables when business logic requires it",
|
|
99
|
-
"- Add comprehensive field documentation and model descriptions",
|
|
100
|
-
"- Include appropriate indexes for performance optimization",
|
|
101
|
-
"- Follow consistent naming conventions and data types",
|
|
102
|
-
].join("\n"),
|
|
103
|
-
);
|
|
104
|
-
|
|
78
|
+
await agentica.conversate("Make prisma schema file please");
|
|
105
79
|
if (pointer.value === null)
|
|
106
80
|
throw new Error("Unreachable code: Prisma Schema not generated");
|
|
107
|
-
|
|
108
81
|
return pointer.value;
|
|
109
82
|
}
|
|
110
83
|
|
|
111
84
|
function createApplication<Model extends ILlmSchema.Model>(props: {
|
|
112
85
|
model: Model;
|
|
113
|
-
build: (next:
|
|
86
|
+
build: (next: IMakePrismaSchemaFileProps) => void;
|
|
114
87
|
}): IAgenticaController.IClass<Model> {
|
|
115
88
|
assertSchemaModel(props.model);
|
|
116
89
|
const application: ILlmApplication<Model> = collection[
|
|
@@ -121,7 +94,7 @@ function createApplication<Model extends ILlmSchema.Model>(props: {
|
|
|
121
94
|
name: "Prisma Generator",
|
|
122
95
|
application,
|
|
123
96
|
execute: {
|
|
124
|
-
|
|
97
|
+
makePrismaSchemaFile: (next) => {
|
|
125
98
|
props.build(next);
|
|
126
99
|
},
|
|
127
100
|
} satisfies IApplication,
|
|
@@ -157,27 +130,17 @@ interface IApplication {
|
|
|
157
130
|
* The generated schemas implement best practices for scalability,
|
|
158
131
|
* maintainability, and data integrity.
|
|
159
132
|
*
|
|
160
|
-
* @param props Properties containing the
|
|
133
|
+
* @param props Properties containing the file
|
|
161
134
|
*/
|
|
162
|
-
|
|
135
|
+
makePrismaSchemaFile(props: IMakePrismaSchemaFileProps): void;
|
|
163
136
|
}
|
|
164
137
|
|
|
165
|
-
interface
|
|
138
|
+
interface IMakePrismaSchemaFileProps {
|
|
166
139
|
/**
|
|
167
|
-
* Complete
|
|
168
|
-
*
|
|
169
|
-
* Contains all schema files organized by domain/functionality with clear file
|
|
170
|
-
* separators. Each file section includes models, relationships, indexes, and
|
|
171
|
-
* comprehensive documentation following enterprise patterns.
|
|
140
|
+
* Complete definition of a single Prisma schema file.
|
|
172
141
|
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* - Main.prisma: Configuration, datasource, and generators
|
|
176
|
-
* - Schema-XX-domain.prisma: Domain-specific entity definitions
|
|
177
|
-
* - Proper cross-file relationships and dependencies
|
|
142
|
+
* Represents one business domain containing related models, organized for
|
|
143
|
+
* modular schema management and following domain-driven design principles.
|
|
178
144
|
*/
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
/** Summary description of the application requirements and business context. */
|
|
182
|
-
description: string;
|
|
145
|
+
file: AutoBePrisma.IFile;
|
|
183
146
|
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
-
import {
|
|
2
|
+
import { IAutoBePrismaValidation } from "@autobe/interface";
|
|
3
3
|
|
|
4
4
|
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
5
5
|
|
|
6
|
-
export const
|
|
7
|
-
|
|
8
|
-
result: IAutoBePrismaCompilerResult.IFailure,
|
|
6
|
+
export const transformPrismaCorrectHistories = (
|
|
7
|
+
result: IAutoBePrismaValidation.IFailure,
|
|
9
8
|
): Array<
|
|
10
9
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
11
10
|
> => {
|
|
12
11
|
return [
|
|
13
12
|
{
|
|
14
13
|
type: "systemMessage",
|
|
15
|
-
text: AutoBeSystemPromptConstant.
|
|
14
|
+
text: AutoBeSystemPromptConstant.PRISMA_CORRECT,
|
|
16
15
|
},
|
|
17
16
|
{
|
|
18
17
|
type: "assistantMessage",
|
|
19
18
|
text: [
|
|
20
|
-
"
|
|
19
|
+
"Here is the Prisma application data what you made:",
|
|
21
20
|
"",
|
|
22
21
|
"```json",
|
|
23
|
-
JSON.stringify(
|
|
22
|
+
JSON.stringify(result.data),
|
|
24
23
|
"```",
|
|
25
24
|
].join("\n"),
|
|
26
25
|
},
|
|
27
26
|
{
|
|
28
27
|
type: "assistantMessage",
|
|
29
28
|
text: [
|
|
30
|
-
|
|
31
|
-
`referencing the error message.`,
|
|
29
|
+
"Below are the list of errors what you have to fix:",
|
|
32
30
|
"",
|
|
33
|
-
|
|
31
|
+
"```json",
|
|
32
|
+
JSON.stringify(result.errors),
|
|
33
|
+
"```",
|
|
34
34
|
].join("\n"),
|
|
35
35
|
},
|
|
36
36
|
{
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { IAutoBePrismaCompilerResult } from "@autobe/interface";
|
|
2
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
3
|
-
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
4
|
-
export declare function orchestratePrismaCompiler<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, files: Record<string, string>, retry?: number): Promise<IAutoBePrismaCompilerResult>;
|