@autobe/agent 0.3.17 → 0.3.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/lib/constants/AutoBeSystemPromptConstant.d.ts +3 -3
  2. package/lib/index.mjs +168 -152
  3. package/lib/index.mjs.map +1 -1
  4. package/lib/orchestrate/prisma/orchestratePrisma.js +2 -47
  5. package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  6. package/lib/orchestrate/prisma/orchestratePrismaCompiler.d.ts +1 -3
  7. package/lib/orchestrate/prisma/orchestratePrismaCompiler.js +112 -106
  8. package/lib/orchestrate/prisma/orchestratePrismaCompiler.js.map +1 -1
  9. package/lib/orchestrate/prisma/orchestratePrismaSchema.js +1 -1
  10. package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -1
  11. package/lib/orchestrate/prisma/transformPrismaCompilerHistories.d.ts +2 -2
  12. package/lib/orchestrate/prisma/transformPrismaCompilerHistories.js +22 -24
  13. package/lib/orchestrate/prisma/transformPrismaCompilerHistories.js.map +1 -1
  14. package/lib/orchestrate/prisma/transformPrismaHistories.js +1 -1
  15. package/lib/orchestrate/prisma/transformPrismaHistories.js.map +1 -1
  16. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.d.ts +6 -2
  17. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +20 -17
  18. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
  19. package/package.json +4 -4
  20. package/src/constants/AutoBeSystemPromptConstant.ts +3 -3
  21. package/src/orchestrate/prisma/orchestratePrisma.ts +3 -54
  22. package/src/orchestrate/prisma/orchestratePrismaCompiler.ts +174 -94
  23. package/src/orchestrate/prisma/orchestratePrismaSchema.ts +4 -2
  24. package/src/orchestrate/prisma/transformPrismaCompilerHistories.ts +22 -24
  25. package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +25 -17
@@ -51,18 +51,37 @@ const __typia_transform__validateReport = __importStar(require("typia/lib/intern
51
51
  const core_1 = require("@agentica/core");
52
52
  const typia_1 = __importDefault(require("typia"));
53
53
  const assertSchemaModel_1 = require("../../context/assertSchemaModel");
54
+ const StringUtil_1 = require("../../utils/StringUtil");
54
55
  const transformPrismaCompilerHistories_1 = require("./transformPrismaCompilerHistories");
55
- function orchestratePrismaCompiler(ctx_1, files_1) {
56
- return __awaiter(this, arguments, void 0, function* (ctx, files, retry = 10) {
57
- var _a, _b, _c, _d, _e, _f, _g;
56
+ function orchestratePrismaCompiler(ctx, files, retry = 5) {
57
+ files["main.prisma"] = MAIN_PRISMA_FILE;
58
+ return step(ctx, files, retry);
59
+ }
60
+ function step(ctx, files, life) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ var _a, _b, _c, _d, _e;
63
+ // TRY COMPILATION
64
+ const result = yield ctx.compiler.prisma({
65
+ files,
66
+ });
67
+ if (result.type !== "failure" || life <= 0)
68
+ return result;
69
+ // VALIDATION FAILED
70
+ ctx.dispatch({
71
+ type: "prismaValidate",
72
+ schemas: files,
73
+ result,
74
+ step: (_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : 0,
75
+ created_at: new Date().toISOString(),
76
+ });
58
77
  const pointer = {
59
- value: { files, description: "" },
78
+ value: null,
60
79
  };
61
80
  const agentica = new core_1.MicroAgentica({
62
81
  model: ctx.model,
63
82
  vendor: ctx.vendor,
64
- config: Object.assign({}, ((_a = ctx.config) !== null && _a !== void 0 ? _a : {})),
65
- histories: (0, transformPrismaCompilerHistories_1.transformPrismaCompilerHistories)(ctx.state(), files),
83
+ config: Object.assign({}, ((_c = ctx.config) !== null && _c !== void 0 ? _c : {})),
84
+ histories: (0, transformPrismaCompilerHistories_1.transformPrismaCompilerHistories)(files, result),
66
85
  tokenUsage: ctx.usage(),
67
86
  controllers: [
68
87
  createApplication({
@@ -78,62 +97,28 @@ function orchestratePrismaCompiler(ctx_1, files_1) {
78
97
  event.body.tool_choice = "required";
79
98
  }
80
99
  });
81
- let result;
82
- for (let i = 0; i < retry; ++i) {
83
- result = yield ctx.compiler.prisma({
84
- files: (_c = (_b = pointer.value) === null || _b === void 0 ? void 0 : _b.files) !== null && _c !== void 0 ? _c : files,
85
- });
86
- if (result.type !== "failure")
87
- break;
88
- ctx.dispatch({
89
- type: "prismaValidate",
90
- schemas: files,
91
- result,
92
- step: (_e = (_d = ctx.state().analyze) === null || _d === void 0 ? void 0 : _d.step) !== null && _e !== void 0 ? _e : 0,
93
- created_at: new Date().toISOString(),
94
- });
95
- yield agentica.conversate([
96
- "The Prisma schema files have compilation errors that must be fixed. You MUST provide complete, corrected files.",
97
- "",
98
- "============================================== CURRENT FILES ==============================================",
99
- "",
100
- ...Object.entries((_g = (_f = pointer.value) === null || _f === void 0 ? void 0 : _f.files) !== null && _g !== void 0 ? _g : files).flatMap(([filename, content]) => [`### ${filename} ###`, content, ""]),
101
- "",
102
- "============================================== COMPILATION ERRORS ==============================================",
103
- "",
104
- result.reason,
105
- "",
106
- "============================================== REQUIREMENTS ==============================================",
107
- "",
108
- "CRITICAL: You must call the modifyPrismaSchemaFiles function with:",
109
- "",
110
- "1. **COMPLETE file contents** - Do NOT truncate or abbreviate any content",
111
- "2. **ALL files** - Every file from the input must be included in the output",
112
- "3. **Fixed errors** - Resolve all compilation errors shown above",
113
- "4. **Preserved structure** - Keep all models, fields, relationships, and comments",
114
- "5. **Proper syntax** - Ensure valid Prisma schema syntax",
115
- "",
116
- "IMPORTANT NOTES:",
117
- "- Include the ENTIRE content of each file, not summaries or truncated versions",
118
- "- Maintain all existing relationships between models",
119
- "- Keep all field definitions, attributes, and indexes",
120
- "- Preserve all comments and documentation",
121
- "- Fix ONLY the compilation errors, don't make unnecessary changes",
122
- "",
123
- "Example of what NOT to do:",
124
- "```",
125
- "// ... (truncated for brevity)",
126
- "// ... other fields and relationships",
127
- "// ... unchanged ...",
128
- "```",
129
- "",
130
- "You must provide the COMPLETE file content for each file.",
131
- ].join("\n"));
132
- if (i === retry - 1) {
133
- throw new Error("Prisma schema compiler failed");
134
- }
100
+ // REQUEST CORRECTION
101
+ yield agentica.conversate(StringUtil_1.StringUtil.trim `
102
+ Resolve the compilation errors in the provided Prisma schema files.
103
+
104
+ Don't remake every schema files. Fix only some of the files that have
105
+ compilation errors. You MUST provide complete, corrected files.
106
+ `);
107
+ if (pointer.value === null) {
108
+ console.error("Unreachable error: PrismaCompilerAgent.pointer.value is null");
109
+ return result; // unreachable
135
110
  }
136
- return Object.assign(Object.assign({}, result), { description: pointer.value.description });
111
+ ctx.dispatch({
112
+ type: "prismaCorrect",
113
+ input: files,
114
+ failure: result,
115
+ correction: pointer.value.files,
116
+ planning: pointer.value.planning,
117
+ step: (_e = (_d = ctx.state().analyze) === null || _d === void 0 ? void 0 : _d.step) !== null && _e !== void 0 ? _e : 0,
118
+ created_at: new Date().toISOString(),
119
+ });
120
+ const newFiles = Object.assign(Object.assign({}, files), pointer.value.files);
121
+ return step(ctx, newFiles, life - 1);
137
122
  });
138
123
  }
139
124
  function createApplication(props) {
@@ -160,37 +145,42 @@ const claude = {
160
145
  {
161
146
  name: "modifyPrismaSchemaFiles",
162
147
  parameters: {
163
- description: " Contains files to fix and requires complete file contents in\nresponse\n\n------------------------------\n\nCurrent Type: {@link IModifyPrismaSchemaFilesProps}",
148
+ description: "Current Type: {@link IModifyPrismaSchemaFilesProps}",
164
149
  type: "object",
165
150
  properties: {
151
+ planning: {
152
+ title: "Detailed execution plan for fixing Prisma compilation errors",
153
+ description: "Detailed execution plan for fixing Prisma compilation errors.\n\n\uD83C\uDFAF Purpose: Enable systematic reasoning and step-by-step error resolution\napproach\n\n\uD83D\uDCCB Required Planning Content:\n\n1. **Error Analysis Summary**\n\n - List all identified compilation errors with their locations\n - Categorize errors by type (syntax, relationships, types, constraints)\n - Identify root causes and error interdependencies\n2. **Fix Strategy Overview**\n\n - Prioritize fixes based on dependencies (fix foundational errors first)\n - Outline minimal changes needed for each error\n - Identify potential impact on other schema parts\n3. **Step-by-Step Fix Plan**\n\n - File-by-file modification plan with specific changes\n - Exact line numbers or sections to be modified\n - New code additions or corrections to be applied\n - Verification steps to ensure fixes don't break other parts\n4. **Preservation Checklist**\n\n - Confirm which comments/documentation must be preserved\n - List relationships and business logic to maintain unchanged\n - Identify cross-file dependencies that must remain intact\n5. **Risk Assessment**\n\n - Potential side effects of each planned fix\n - Validation points to check after applying fixes\n - Rollback considerations if fixes introduce new issues\n\n\uD83D\uDCA1 Example Planning Structure:\n\n ## Error Analysis\n - Error 1: Missing foreign key field 'userId' in Post model (schema-02-posts.prisma:15)\n - Error 2: Invalid",
154
+ type: "string"
155
+ },
166
156
  files: {
167
- description: "COMPLETE Prisma schema files with ALL content included.\n\nCRITICAL REQUIREMENTS:\n\n- Each file must contain the ENTIRE schema content\n- Do NOT truncate, abbreviate, or use placeholders like \"... unchanged ...\"\n- Include ALL models, fields, relationships, indexes, and comments\n- Maintain exact same file organization and naming\n\nFile organization patterns:\n\n- Main.prisma: Configuration, datasource, generators\n- Schema-XX-domain.prisma: Complete domain-specific models with ALL fields\n\nKey = filename (e.g., \"main.prisma\", \"schema-01-core.prisma\") Value =\nCOMPLETE file content (no truncation allowed)\n\n------------------------------\n\nDescription of the current {@link Recordstringstring} type:\n\n> Construct a type with a set of properties K of type T",
157
+ description: "Original Prisma schema files that contain compilation errors and need\ncorrection.\n\n\uD83D\uDCE5 Input Structure:\n\n- Key: filename (e.g., \"schema-01-users.prisma\")\n- Value: COMPLETE original file content with compilation errors\n\n\uD83D\uDD0D Expected Input File Types:\n\n- Domain-specific schema files: \"schema-XX-domain.prisma\" \u2192 Contains complete\n model definitions for specific business domains\n\n\uD83D\uDCDD Input File Content Analysis:\n\n- All models with their complete field definitions\n- All relationships (@relation directives with field mappings)\n- All indexes, constraints, and unique identifiers\n- All enums and their complete value sets\n- All comments and documentation\n- Cross-file model references and dependencies\n\n\u26A0\uFE0F Input Processing Notes:\n\n- Files may contain syntax errors, type mismatches, or missing references\n- Some models might reference non-existent fields or models\n- Relationship mappings might be incorrect or incomplete\n- Foreign key fields might be missing or incorrectly defined\n- Cross-file dependencies might be broken or circular\n\n------------------------------\n\nDescription of the current {@link Recordstringstring} type:\n\n> Construct a type with a set of properties K of type T",
168
158
  type: "object",
169
159
  properties: {},
170
160
  required: [],
171
161
  additionalProperties: {
172
162
  type: "string"
173
163
  }
174
- },
175
- description: {
176
- description: "Brief description of what was fixed or modified in the schema files. Should\nsummarize the changes made to resolve compilation errors.",
177
- type: "string"
178
164
  }
179
165
  },
180
166
  required: [
181
- "files",
182
- "description"
167
+ "planning",
168
+ "files"
183
169
  ],
184
170
  additionalProperties: false,
185
171
  $defs: {}
186
172
  },
187
- description: "Fixes compilation errors in Prisma schema files.\n\nCRITICAL: This function must return COMPLETE file contents, not truncated\nversions.\n\nResponsibilities:\n\n1. Analyze compilation errors in the provided schema files\n2. Fix all syntax and structural issues\n3. Return COMPLETE corrected files (no truncation or abbreviation)\n4. Preserve all existing models, relationships, and business logic\n5. Maintain proper cross-file references and dependencies",
188
- validate: (() => { const _io0 = input => "object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) && _io1(input.files) && "string" === typeof input.description; const _io1 = input => Object.keys(input).every(key => {
173
+ description: "Fixes Prisma compilation errors while preserving ALL existing comments,\ndocumentation, and schema structure.\n\n## Core Rules\n\n1. Fix ONLY compilation errors - never remove comments/documentation\n2. Apply minimal changes - preserve original design and relationships\n3. Return COMPLETE files - no truncation allowed\n4. NEVER use mapping names in",
174
+ validate: (() => { const _io0 = input => "string" === typeof input.planning && ("object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) && _io1(input.files)); const _io1 = input => Object.keys(input).every(key => {
189
175
  const value = input[key];
190
176
  if (undefined === value)
191
177
  return true;
192
178
  return "string" === typeof value;
193
- }); const _vo0 = (input, _path, _exceptionable = true) => [("object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) || _report(_exceptionable, {
179
+ }); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.planning || _report(_exceptionable, {
180
+ path: _path + ".planning",
181
+ expected: "string",
182
+ value: input.planning
183
+ }), ("object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) || _report(_exceptionable, {
194
184
  path: _path + ".files",
195
185
  expected: "Record<string, string>",
196
186
  value: input.files
@@ -198,10 +188,6 @@ const claude = {
198
188
  path: _path + ".files",
199
189
  expected: "Record<string, string>",
200
190
  value: input.files
201
- }), "string" === typeof input.description || _report(_exceptionable, {
202
- path: _path + ".description",
203
- expected: "string",
204
- value: input.description
205
191
  })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
206
192
  const value = input[key];
207
193
  if (undefined === value)
@@ -254,37 +240,42 @@ const collection = {
254
240
  {
255
241
  name: "modifyPrismaSchemaFiles",
256
242
  parameters: {
257
- description: " Contains files to fix and requires complete file contents in\nresponse\n\n------------------------------\n\nCurrent Type: {@link IModifyPrismaSchemaFilesProps}",
243
+ description: "Current Type: {@link IModifyPrismaSchemaFilesProps}",
258
244
  type: "object",
259
245
  properties: {
246
+ planning: {
247
+ title: "Detailed execution plan for fixing Prisma compilation errors",
248
+ description: "Detailed execution plan for fixing Prisma compilation errors.\n\n\uD83C\uDFAF Purpose: Enable systematic reasoning and step-by-step error resolution\napproach\n\n\uD83D\uDCCB Required Planning Content:\n\n1. **Error Analysis Summary**\n\n - List all identified compilation errors with their locations\n - Categorize errors by type (syntax, relationships, types, constraints)\n - Identify root causes and error interdependencies\n2. **Fix Strategy Overview**\n\n - Prioritize fixes based on dependencies (fix foundational errors first)\n - Outline minimal changes needed for each error\n - Identify potential impact on other schema parts\n3. **Step-by-Step Fix Plan**\n\n - File-by-file modification plan with specific changes\n - Exact line numbers or sections to be modified\n - New code additions or corrections to be applied\n - Verification steps to ensure fixes don't break other parts\n4. **Preservation Checklist**\n\n - Confirm which comments/documentation must be preserved\n - List relationships and business logic to maintain unchanged\n - Identify cross-file dependencies that must remain intact\n5. **Risk Assessment**\n\n - Potential side effects of each planned fix\n - Validation points to check after applying fixes\n - Rollback considerations if fixes introduce new issues\n\n\uD83D\uDCA1 Example Planning Structure:\n\n ## Error Analysis\n - Error 1: Missing foreign key field 'userId' in Post model (schema-02-posts.prisma:15)\n - Error 2: Invalid",
249
+ type: "string"
250
+ },
260
251
  files: {
261
- description: "COMPLETE Prisma schema files with ALL content included.\n\nCRITICAL REQUIREMENTS:\n\n- Each file must contain the ENTIRE schema content\n- Do NOT truncate, abbreviate, or use placeholders like \"... unchanged ...\"\n- Include ALL models, fields, relationships, indexes, and comments\n- Maintain exact same file organization and naming\n\nFile organization patterns:\n\n- Main.prisma: Configuration, datasource, generators\n- Schema-XX-domain.prisma: Complete domain-specific models with ALL fields\n\nKey = filename (e.g., \"main.prisma\", \"schema-01-core.prisma\") Value =\nCOMPLETE file content (no truncation allowed)\n\n------------------------------\n\nDescription of the current {@link Recordstringstring} type:\n\n> Construct a type with a set of properties K of type T",
252
+ description: "Original Prisma schema files that contain compilation errors and need\ncorrection.\n\n\uD83D\uDCE5 Input Structure:\n\n- Key: filename (e.g., \"schema-01-users.prisma\")\n- Value: COMPLETE original file content with compilation errors\n\n\uD83D\uDD0D Expected Input File Types:\n\n- Domain-specific schema files: \"schema-XX-domain.prisma\" \u2192 Contains complete\n model definitions for specific business domains\n\n\uD83D\uDCDD Input File Content Analysis:\n\n- All models with their complete field definitions\n- All relationships (@relation directives with field mappings)\n- All indexes, constraints, and unique identifiers\n- All enums and their complete value sets\n- All comments and documentation\n- Cross-file model references and dependencies\n\n\u26A0\uFE0F Input Processing Notes:\n\n- Files may contain syntax errors, type mismatches, or missing references\n- Some models might reference non-existent fields or models\n- Relationship mappings might be incorrect or incomplete\n- Foreign key fields might be missing or incorrectly defined\n- Cross-file dependencies might be broken or circular\n\n------------------------------\n\nDescription of the current {@link Recordstringstring} type:\n\n> Construct a type with a set of properties K of type T",
262
253
  type: "object",
263
254
  properties: {},
264
255
  required: [],
265
256
  additionalProperties: {
266
257
  type: "string"
267
258
  }
268
- },
269
- description: {
270
- description: "Brief description of what was fixed or modified in the schema files. Should\nsummarize the changes made to resolve compilation errors.",
271
- type: "string"
272
259
  }
273
260
  },
274
261
  required: [
275
- "files",
276
- "description"
262
+ "planning",
263
+ "files"
277
264
  ],
278
265
  additionalProperties: false,
279
266
  $defs: {}
280
267
  },
281
- description: "Fixes compilation errors in Prisma schema files.\n\nCRITICAL: This function must return COMPLETE file contents, not truncated\nversions.\n\nResponsibilities:\n\n1. Analyze compilation errors in the provided schema files\n2. Fix all syntax and structural issues\n3. Return COMPLETE corrected files (no truncation or abbreviation)\n4. Preserve all existing models, relationships, and business logic\n5. Maintain proper cross-file references and dependencies",
282
- validate: (() => { const _io0 = input => "object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) && _io1(input.files) && "string" === typeof input.description; const _io1 = input => Object.keys(input).every(key => {
268
+ description: "Fixes Prisma compilation errors while preserving ALL existing comments,\ndocumentation, and schema structure.\n\n## Core Rules\n\n1. Fix ONLY compilation errors - never remove comments/documentation\n2. Apply minimal changes - preserve original design and relationships\n3. Return COMPLETE files - no truncation allowed\n4. NEVER use mapping names in",
269
+ validate: (() => { const _io0 = input => "string" === typeof input.planning && ("object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) && _io1(input.files)); const _io1 = input => Object.keys(input).every(key => {
283
270
  const value = input[key];
284
271
  if (undefined === value)
285
272
  return true;
286
273
  return "string" === typeof value;
287
- }); const _vo0 = (input, _path, _exceptionable = true) => [("object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) || _report(_exceptionable, {
274
+ }); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.planning || _report(_exceptionable, {
275
+ path: _path + ".planning",
276
+ expected: "string",
277
+ value: input.planning
278
+ }), ("object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) || _report(_exceptionable, {
288
279
  path: _path + ".files",
289
280
  expected: "Record<string, string>",
290
281
  value: input.files
@@ -292,10 +283,6 @@ const collection = {
292
283
  path: _path + ".files",
293
284
  expected: "Record<string, string>",
294
285
  value: input.files
295
- }), "string" === typeof input.description || _report(_exceptionable, {
296
- path: _path + ".description",
297
- expected: "string",
298
- value: input.description
299
286
  })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
300
287
  const value = input[key];
301
288
  if (undefined === value)
@@ -353,34 +340,39 @@ const collection = {
353
340
  parameters: {
354
341
  type: "object",
355
342
  properties: {
343
+ planning: {
344
+ type: "string",
345
+ title: "Detailed execution plan for fixing Prisma compilation errors",
346
+ description: "Detailed execution plan for fixing Prisma compilation errors.\n\n\uD83C\uDFAF Purpose: Enable systematic reasoning and step-by-step error resolution\napproach\n\n\uD83D\uDCCB Required Planning Content:\n\n1. **Error Analysis Summary**\n\n - List all identified compilation errors with their locations\n - Categorize errors by type (syntax, relationships, types, constraints)\n - Identify root causes and error interdependencies\n2. **Fix Strategy Overview**\n\n - Prioritize fixes based on dependencies (fix foundational errors first)\n - Outline minimal changes needed for each error\n - Identify potential impact on other schema parts\n3. **Step-by-Step Fix Plan**\n\n - File-by-file modification plan with specific changes\n - Exact line numbers or sections to be modified\n - New code additions or corrections to be applied\n - Verification steps to ensure fixes don't break other parts\n4. **Preservation Checklist**\n\n - Confirm which comments/documentation must be preserved\n - List relationships and business logic to maintain unchanged\n - Identify cross-file dependencies that must remain intact\n5. **Risk Assessment**\n\n - Potential side effects of each planned fix\n - Validation points to check after applying fixes\n - Rollback considerations if fixes introduce new issues\n\n\uD83D\uDCA1 Example Planning Structure:\n\n ## Error Analysis\n - Error 1: Missing foreign key field 'userId' in Post model (schema-02-posts.prisma:15)\n - Error 2: Invalid"
347
+ },
356
348
  files: {
357
349
  type: "object",
358
350
  properties: {},
359
351
  required: [],
360
- description: "COMPLETE Prisma schema files with ALL content included.\n\nCRITICAL REQUIREMENTS:\n\n- Each file must contain the ENTIRE schema content\n- Do NOT truncate, abbreviate, or use placeholders like \"... unchanged ...\"\n- Include ALL models, fields, relationships, indexes, and comments\n- Maintain exact same file organization and naming\n\nFile organization patterns:\n\n- Main.prisma: Configuration, datasource, generators\n- Schema-XX-domain.prisma: Complete domain-specific models with ALL fields\n\nKey = filename (e.g., \"main.prisma\", \"schema-01-core.prisma\") Value =\nCOMPLETE file content (no truncation allowed)\n\n------------------------------\n\nDescription of the current {@link Recordstringstring} type:\n\n> Construct a type with a set of properties K of type T",
352
+ description: "Original Prisma schema files that contain compilation errors and need\ncorrection.\n\n\uD83D\uDCE5 Input Structure:\n\n- Key: filename (e.g., \"schema-01-users.prisma\")\n- Value: COMPLETE original file content with compilation errors\n\n\uD83D\uDD0D Expected Input File Types:\n\n- Domain-specific schema files: \"schema-XX-domain.prisma\" \u2192 Contains complete\n model definitions for specific business domains\n\n\uD83D\uDCDD Input File Content Analysis:\n\n- All models with their complete field definitions\n- All relationships (@relation directives with field mappings)\n- All indexes, constraints, and unique identifiers\n- All enums and their complete value sets\n- All comments and documentation\n- Cross-file model references and dependencies\n\n\u26A0\uFE0F Input Processing Notes:\n\n- Files may contain syntax errors, type mismatches, or missing references\n- Some models might reference non-existent fields or models\n- Relationship mappings might be incorrect or incomplete\n- Foreign key fields might be missing or incorrectly defined\n- Cross-file dependencies might be broken or circular\n\n------------------------------\n\nDescription of the current {@link Recordstringstring} type:\n\n> Construct a type with a set of properties K of type T",
361
353
  additionalProperties: {
362
354
  type: "string"
363
355
  }
364
- },
365
- description: {
366
- type: "string",
367
- description: "Brief description of what was fixed or modified in the schema files. Should\nsummarize the changes made to resolve compilation errors."
368
356
  }
369
357
  },
370
358
  required: [
371
- "files",
372
- "description"
359
+ "planning",
360
+ "files"
373
361
  ],
374
- description: " Contains files to fix and requires complete file contents in\nresponse\n\n------------------------------\n\nCurrent Type: {@link IModifyPrismaSchemaFilesProps}",
362
+ description: "Current Type: {@link IModifyPrismaSchemaFilesProps}",
375
363
  additionalProperties: false
376
364
  },
377
- description: "Fixes compilation errors in Prisma schema files.\n\nCRITICAL: This function must return COMPLETE file contents, not truncated\nversions.\n\nResponsibilities:\n\n1. Analyze compilation errors in the provided schema files\n2. Fix all syntax and structural issues\n3. Return COMPLETE corrected files (no truncation or abbreviation)\n4. Preserve all existing models, relationships, and business logic\n5. Maintain proper cross-file references and dependencies",
378
- validate: (() => { const _io0 = input => "object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) && _io1(input.files) && "string" === typeof input.description; const _io1 = input => Object.keys(input).every(key => {
365
+ description: "Fixes Prisma compilation errors while preserving ALL existing comments,\ndocumentation, and schema structure.\n\n## Core Rules\n\n1. Fix ONLY compilation errors - never remove comments/documentation\n2. Apply minimal changes - preserve original design and relationships\n3. Return COMPLETE files - no truncation allowed\n4. NEVER use mapping names in",
366
+ validate: (() => { const _io0 = input => "string" === typeof input.planning && ("object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) && _io1(input.files)); const _io1 = input => Object.keys(input).every(key => {
379
367
  const value = input[key];
380
368
  if (undefined === value)
381
369
  return true;
382
370
  return "string" === typeof value;
383
- }); const _vo0 = (input, _path, _exceptionable = true) => [("object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) || _report(_exceptionable, {
371
+ }); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.planning || _report(_exceptionable, {
372
+ path: _path + ".planning",
373
+ expected: "string",
374
+ value: input.planning
375
+ }), ("object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) || _report(_exceptionable, {
384
376
  path: _path + ".files",
385
377
  expected: "Record<string, string>",
386
378
  value: input.files
@@ -388,10 +380,6 @@ const collection = {
388
380
  path: _path + ".files",
389
381
  expected: "Record<string, string>",
390
382
  value: input.files
391
- }), "string" === typeof input.description || _report(_exceptionable, {
392
- path: _path + ".description",
393
- expected: "string",
394
- value: input.description
395
383
  })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
396
384
  const value = input[key];
397
385
  if (undefined === value)
@@ -433,4 +421,22 @@ const collection = {
433
421
  ]
434
422
  },
435
423
  };
424
+ const MAIN_PRISMA_FILE = StringUtil_1.StringUtil.trim `
425
+ generator client {
426
+ provider = "prisma-client-js"
427
+ previewFeatures = ["postgresqlExtensions", "views"]
428
+ binaryTargets = ["native", "linux-musl-arm64-openssl-3.0.x"]
429
+ }
430
+
431
+ datasource db {
432
+ provider = "postgresql"
433
+ url = env("DATABASE_URL")
434
+ extensions = []
435
+ }
436
+
437
+ generator markdown {
438
+ provider = "prisma-markdown"
439
+ output = "../docs/ERD.md"
440
+ }
441
+ `;
436
442
  //# sourceMappingURL=orchestratePrismaCompiler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"orchestratePrismaCompiler.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,8DAgGC;;;AA1GD,yCAAoE;AAIpE,kDAA0B;AAG1B,uEAAoE;AACpE,yFAAsF;AAEtF,SAAsB,yBAAyB;yDAC7C,GAAyB,EACzB,KAA6B,EAC7B,QAAgB,EAAE;;QAElB,MAAM,OAAO,GAA4C;YACvD,KAAK,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE;SAClC,CAAC;QACF,MAAM,QAAQ,GAAyB,IAAI,oBAAa,CAAC;YACvD,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,MAAM,oBACD,CAAC,MAAA,GAAG,CAAC,MAAM,mCAAI,EAAE,CAAC,CACtB;YACD,SAAS,EAAE,IAAA,mEAAgC,EAAC,GAAG,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC;YAC/D,UAAU,EAAE,GAAG,CAAC,KAAK,EAAE;YACvB,WAAW,EAAE;gBACX,iBAAiB,CAAC;oBAChB,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;wBACd,OAAO,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;IACjB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIJ;IACH,MAAM;IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;IACb,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA8C;CACpD,CAAC"}
1
+ {"version":3,"file":"orchestratePrismaCompiler.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,8DAOC;;;AAlBD,yCAAoE;AAIpE,kDAA0B;AAG1B,uEAAoE;AACpE,uDAAoD;AACpD,yFAAsF;AAEtF,SAAgB,yBAAyB,CACvC,GAAyB,EACzB,KAA6B,EAC7B,QAAgB,CAAC;IAEjB,KAAK,CAAC,aAAa,CAAC,GAAG,gBAAgB,CAAC;IACxC,OAAO,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AACjC,CAAC;AAED,SAAe,IAAI,CACjB,GAAyB,EACzB,KAA6B,EAC7B,IAAY;;;QAEZ,kBAAkB;QAClB,MAAM,MAAM,GAAgC,MAAM,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;YACpE,KAAK;SACN,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,IAAI,CAAC;YAAE,OAAO,MAAM,CAAC;QAE1D,oBAAoB;QACpB,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,KAAK;YACd,MAAM;YACN,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,OAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA8C;CACpD,CAAC;AAyHF,MAAM,gBAAgB,GAAG,uBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;CAiBvC,CAAC"}
@@ -88,7 +88,7 @@ function process(ctx, component) {
88
88
  model: ctx.model,
89
89
  vendor: ctx.vendor,
90
90
  config: Object.assign({}, ((_a = ctx.config) !== null && _a !== void 0 ? _a : {})),
91
- histories: (0, transformPrismaSchemaHistories_1.transformPrismaSchemaHistories)(ctx.state()),
91
+ histories: (0, transformPrismaSchemaHistories_1.transformPrismaSchemaHistories)(ctx.state().analyze, component),
92
92
  tokenUsage: ctx.usage(),
93
93
  controllers: [
94
94
  createApplication({
@@ -1 +1 @@
1
- {"version":3,"file":"orchestratePrismaSchema.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,4DAgCC;;AA1CD,yCAAoE;AAIpE,kDAA0B;AAG1B,uEAAoE;AACpE,qFAAkF;AAElF,SAAsB,wBAAwB,CAC5C,GAAyB,EACzB,UAAoD;;QAEpD,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,YAAY,GAAa,KAAK,CAAC,IAAI,CACvC,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAC7C,CAAC;QAEF,MAAM,KAAK,GAAW,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC9E,IAAI,CAAC,GAAW,CAAC,CAAC;QAElB,OAAO,MAAM,OAAO,CAAC,GAAG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B,IAAI,EAAE,kBAAkB;QACxB,WAAW;QACX,OAAO,EAAE;YACP,qBAAqB,EAAE,CAAC,IAAI,EAAE,EAAE;gBAC9B,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;SACqB;KACzB,CAAC;AACJ,CAAC;AAED,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIT,CAAC;AACJ,MAAM,UAAU,GAAG;IACjB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIJ;IACH,MAAM;IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;IACb,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA8C;CACpD,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
- import { AutoBeState } from "../../context/AutoBeState";
3
- export declare const transformPrismaCompilerHistories: (state: AutoBeState, files: Record<string, string>) => Array<IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage>;
2
+ import { IAutoBePrismaCompilerResult } from "@autobe/interface";
3
+ export declare const transformPrismaCompilerHistories: (files: Record<string, string>, result: IAutoBePrismaCompilerResult.IFailure) => Array<IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage>;
@@ -1,41 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformPrismaCompilerHistories = void 0;
4
- const transformPrismaCompilerHistories = (state, files) => {
5
- if (state.analyze === null)
6
- return [
7
- {
8
- type: "systemMessage",
9
- text: [
10
- "Requirement analysis is not yet completed.",
11
- "Don't call any tool function,",
12
- "but say to process the requirement analysis.",
13
- ].join(" "),
14
- },
15
- ];
4
+ const transformPrismaCompilerHistories = (files, result) => {
16
5
  return [
17
6
  {
18
7
  type: "systemMessage",
19
- text: "You are a world-class Prisma schema validation and error resolution specialist. You excel at analyzing Prisma compilation errors and providing precise fixes while maintaining schema integrity and design principles.\n\n### Core Principles\n\n- **Never ask for clarification** - Analyze errors and provide direct solutions\n- **Output only corrected schema** - Return Record<string, string> format with fixes applied\n- **Preserve original intent** - Fix errors while maintaining the original design and relationships\n- **Maintain consistency** - Ensure fixes don't break other parts of the schema\n\n### Default Working Language: English\n\n- Use the language specified by user in messages as the working language when explicitly provided\n- All analysis and responses must be in the working language\n- All model/field names must remain in English regardless of working language\n\n### Input Format\n\nYou will receive:\n1. **Original schema files** - Record<string, string> format from Schema Agent\n2. **Compilation errors** - Detailed error messages from Prisma compiler\n3. **Original requirements** - User requirements for context (optional)\n\n### Task: Fix Prisma Compilation Errors\n\nAnalyze compilation errors and provide corrected schema files that resolve all issues while maintaining the original design intent.\n\n### Error Analysis Process\n\n1. **Error Classification**: Categorize each error by type and severity\n2. **Root Cause Analysis**: Identify the underlying cause of each error\n3. **Impact Assessment**: Determine how fixes might affect other parts of the schema\n4. **Solution Design**: Plan fixes that resolve errors while preserving functionality\n5. **Validation**: Ensure fixes don't introduce new errors\n\n### Common Error Types and Solutions\n\n#### Relationship Errors\n- **Missing models**: Create referenced models or update references\n- **Invalid field mappings**: Correct field names and types in @relation\n- **Circular dependencies**: Restructure relationships to avoid cycles\n- **Missing foreign keys**: Add required foreign key fields\n\n#### Type and Constraint Errors\n- **Invalid data types**: Correct to supported Prisma types\n- **Missing constraints**: Add required @id, @unique, or other constraints\n- **Invalid attribute usage**: Fix attribute syntax and placement\n\n#### Naming and Syntax Errors\n- **Reserved keywords**: Rename fields that conflict with Prisma/DB keywords\n- **Invalid identifiers**: Fix naming to follow Prisma conventions\n- **Syntax errors**: Correct Prisma schema syntax\n\n#### Cross-File Reference Errors\n- **Model not found**: Ensure referenced models exist in the correct files\n- **Circular imports**: Restructure file dependencies\n- **Invalid field references**: Update references to match actual field names\n\n### Fix Strategy Guidelines\n\n#### Minimal Changes Principle\n- Make the smallest changes necessary to fix errors\n- Preserve original model structure and relationships\n- Maintain field names and types where possible\n\n#### Consistency Maintenance\n- Ensure naming conventions remain consistent\n- Preserve comment structure and quality\n- Maintain architectural patterns (snapshot-based, etc.)\n\n#### Relationship Integrity\n- Ensure all relationships remain bidirectional where intended\n- Preserve cascade behaviors and constraints\n- Maintain foreign key relationships\n\n### Expected Output Format\n\n```json\n{\n \"main.prisma\": \"// Fixed version with corrected generator/datasource\\ngenerator client {\\n provider = \\\"prisma-client-js\\\"\\n}\\n\\ndatasource db {\\n provider = \\\"postgresql\\\"\\n url = env(\\\"DATABASE_URL\\\")\\n}\",\n \"schema-01-core.prisma\": \"// Fixed version with corrected relationships\\nmodel users {\\n // ... corrected model with fixes applied\\n}\",\n \"schema-02-articles.prisma\": \"// Fixed version with resolved dependencies\\nmodel articles {\\n // ... corrected model with fixes applied\\n}\"\n}\n```\n\n### Validation Checklist\n\nAfter applying fixes, ensure:\n- [ ] All compilation errors are resolved\n- [ ] No new errors are introduced\n- [ ] Relationships remain properly mapped\n- [ ] Foreign keys are correctly defined\n- [ ] Model and field names follow conventions\n- [ ] Comments and documentation are preserved\n- [ ] Cross-file references are valid\n- [ ] Original design intent is maintained\n\n### Error Reporting\n\nIf errors cannot be resolved without significant design changes:\n- Identify the specific errors that require design decisions\n- Suggest alternative approaches\n- Explain the trade-offs of different solutions\n- Provide the best possible fix with clear documentation of changes made" /* AutoBeSystemPromptConstant.PRISMA_COMPILER */,
8
+ text: "# Prisma Schema Error Fixing Agent\n\nYou are a world-class Prisma schema validation and error resolution specialist. Your primary mission is to analyze Prisma compilation errors and provide precise fixes while maintaining complete schema integrity and preserving ALL existing documentation.\n\n## Core Operating Principles\n\n### \uD83D\uDEAB ABSOLUTE PROHIBITIONS\n- **NEVER remove or modify existing comments** (`//` or `///`)\n- **NEVER delete field documentation or descriptions**\n- **NEVER remove model-level documentation**\n- **NEVER truncate or abbreviate file contents**\n- **NEVER use placeholders** like \"... existing content preserved ...\"\n- **NEVER ask for clarification** - analyze and fix directly\n- **NEVER use mapping names in @relation directives** - This causes compilation errors\n\nOf course, if you're planning to erase some property or relationship from a model, it is okay to remove its description comments.\n\n### \u2705 MANDATORY REQUIREMENTS\n- **Preserve ALL comments and documentation** exactly as they appear\n- **Apply minimal changes** - fix ONLY compilation errors\n- **Return COMPLETE file contents** without any truncation\n- **Maintain original design intent** and architectural patterns\n- **Preserve ALL existing relationships, indexes, and constraints**\n- **Use ONLY `@relation(fields: [...], references: [...])` format WITHOUT mapping names**\n\n## Error Resolution Strategy\n\n### 1. Error Analysis Process\n1. **Identify compilation errors** from the provided error history\n2. **Categorize error types**: syntax, relationships, types, constraints\n3. **Locate exact error sources** in the schema files\n4. **Plan minimal fixes** that resolve errors without affecting other parts\n\n### 2. Common Error Types & Solutions\n\n#### Relationship Errors\n- **Missing models**: Create referenced models or update references\n- **Invalid @relation mappings**: Fix field names and references WITHOUT using mapping names\n- **Mapping name conflicts**: Remove ALL mapping names from @relation directives\n- **Missing foreign keys**: Add required foreign key fields\n- **Circular dependencies**: Restructure relationships carefully\n- **Forbidden**: \n - `article bbs_articles @relation(\"article\", fields: [bbs_article_id], references: [id], onDelete: Cascade)`\n - `to_files bbs_articles_snapshot_files @relation(\"to_files\")`\n - `mv_last mv_bbs_article_last_snapshots? @relation(\"mv_last\")`\n- **Correct**:\n - `article bbs_articles @relation(fields: [bbs_article_id], references: [id], onDelete: Cascade)`\n - `to_files bbs_article_snapshot_files[]`\n - `mv_last mv_bbs_article_last_snapshots?`\n\n#### Type & Constraint Errors\n- **Invalid data types**: Correct to supported Prisma types\n- **Missing @id/@unique**: Add required constraints\n- **Invalid attributes**: Fix attribute syntax and placement\n\n#### Syntax & Naming Errors\n- **Reserved keywords**: Rename conflicting fields\n- **Invalid identifiers**: Fix naming conventions\n- **Syntax errors**: Correct Prisma schema syntax\n\n#### Cross-File Reference Errors\n- **Model not found**: Ensure referenced models exist\n- **Invalid field references**: Update to match actual field names\n\n### 3. Fix Implementation Rules\n\n#### Minimal Changes Principle\n- Change **only what causes compilation errors**\n- Preserve **all original field names, types, and structures**\n- Maintain **all existing comments and documentation**\n- Keep **all business logic intact**\n\n#### Relationship Fixing Rules\n- **Remove ALL mapping names** from @relation directives if present\n- **Keep only field mapping**: `@relation(fields: [...], references: [...])`\n- **Ensure bidirectional relationships** work without mapping names\n- **Add onDelete/onUpdate behaviors** as needed for data integrity\n\n#### Documentation Preservation\n- **Keep ALL comments** (`//` and `///`)\n- **Keep ALL field descriptions** and explanations\n- **Keep ALL model documentation** and annotations\n- **Keep ALL enum value descriptions**\n\n#### Quality Assurance\n- Ensure **all compilation errors are resolved**\n- Verify **no new errors are introduced**\n- Confirm **all relationships remain properly mapped**\n- Validate **cross-file references work correctly**\n- Verify **no mapping names are used anywhere**\n\n## Input/Output Format\n\n### Input Expectation\nYou will receive a `files` object containing:\n```typescript\n{\n \"main.prisma\": \"// Complete original file with potential errors\",\n \"schema-01-users.prisma\": \"// Complete domain file with potential errors\",\n \"schema-02-posts.prisma\": \"// Complete domain file with potential errors\"\n}\n```\n\n### Output Requirement\nReturn the exact same file structure with ALL errors fixed:\n```typescript\n{\n \"schema-01-users.prisma\": \"// COMPLETE corrected file - ALL comments preserved\", \n \"schema-02-posts.prisma\": \"// COMPLETE corrected file - ALL documentation preserved\"\n}\n```\n\n## Critical Success Criteria\n\n### \u2705 Must Achieve\n- [ ] All compilation errors resolved\n- [ ] All original comments preserved exactly\n- [ ] All field documentation maintained\n- [ ] All model descriptions kept intact\n- [ ] Complete file contents returned (no truncation)\n- [ ] Original business logic preserved\n- [ ] Relationships remain properly mapped\n- [ ] No new errors introduced\n- [ ] **NO mapping names used in any @relation directive**\n\n### \uD83D\uDEAB Must Avoid\n- [ ] Removing any comments or documentation\n- [ ] Truncating or abbreviating content\n- [ ] Using placeholder text or shortcuts\n- [ ] Making unnecessary changes beyond error fixes\n- [ ] Breaking existing functionality\n- [ ] Altering business logic or design patterns\n- [ ] **Using mapping names in @relation directives**\n\n## Error Resolution Workflow\n\n1. **Parse Input**: Analyze provided schema files and identify structure\n2. **Error Detection**: Review compilation errors and locate problem areas\n3. **Mapping Name Removal**: Remove ALL mapping names from @relation directives if present\n4. **Impact Assessment**: Determine minimal changes needed for each error\n5. **Apply Fixes**: Make targeted corrections while preserving everything else\n6. **Validation**: Ensure fixes resolve errors without breaking other parts\n7. **Complete Output**: Return all files with complete content preserved\n\n## Response Format\n\nAlways return your response as a properly formatted object containing the corrected schema files. Each file must be complete and contain all original content with only the necessary error fixes applied.\n\nRemember: Your goal is to be a surgical error-fixer, not a schema rewriter. Preserve everything, fix only what's broken, and NEVER use mapping names in @relation directives." /* AutoBeSystemPromptConstant.PRISMA_COMPILER */,
20
9
  },
21
10
  {
22
11
  type: "assistantMessage",
23
12
  text: [
24
13
  "Below are the current schema files that failed compilation:",
25
14
  "",
26
- "============================================== CURRENT SCHEMA FILES ==============================================",
15
+ "```json",
16
+ JSON.stringify(files),
17
+ "```",
18
+ ].join("\n"),
19
+ },
20
+ {
21
+ type: "assistantMessage",
22
+ text: [
23
+ `Here is the compiler error message. Please fix the schema files`,
24
+ `referencing the error message.`,
27
25
  "",
28
- Object.entries(files)
29
- .map(([filename, content]) => {
30
- return [
31
- `// =============================================================================`,
32
- `// FILE: ${filename}`,
33
- `// =============================================================================`,
34
- content,
35
- ].join("\n");
36
- })
37
- .join("\n\n"),
26
+ result.reason,
27
+ ].join("\n"),
28
+ },
29
+ {
30
+ type: "systemMessage",
31
+ text: [
32
+ "Before fixing the schema files,",
33
+ "study about Prisma schema language",
34
+ "from the best practices and examples",
38
35
  "",
36
+ "Study the following comprehensive BBS (bullet-in board system) project schema as a reference for implementing all the patterns and best practices outlined above. \n\nThis enterprise-level implementation demonstrates proper domain organization, relationship modeling, documentation standards, and advanced patterns like snapshots, inheritance, and materialized views.\n\n## Input (Requirement Analysis)\n\n```json\n{% EXAMPLE_BBS_REQUIREMENT_ANALYSIS %}\n```\n\nWhen such requirement analysis report comes\n\n## Output (Prisma Schema Files)\n\n```json\n{\"main.prisma\":\"datasource db {\\n provider = \\\"postgresql\\\"\\n url = env(\\\"BBS_POSTGRES_URL\\\")\\n}\\n\\ngenerator client {\\n provider = \\\"prisma-client-js\\\"\\n previewFeatures = [\\\"views\\\"]\\n binaryTargets = [\\\"native\\\"]\\n}\\n\\ngenerator markdown {\\n provider = \\\"prisma-markdown\\\"\\n title = \\\"Bullet-in Board System\\\"\\n output = \\\"../../docs/ERD.md\\\"\\n}\\n\\n//-----------------------------------------------------------\\n// ARTICLES\\n//-----------------------------------------------------------\\n/// Attachment File.\\n///\\n/// Every attachment files that are managed in current system.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel attachment_files {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// File name, except extension.\\n name String @db.VarChar\\n\\n /// Extension.\\n ///\\n /// Possible to omit like `README` case.\\n extension String? @db.VarChar\\n\\n /// URL path of the real file.\\n url String @db.VarChar\\n\\n /// Creation time of file.\\n created_at DateTime @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n bbs_article_snapshot_files bbs_article_snapshot_files[]\\n bbs_article_comment_snapshots_files bbs_article_comment_snapshot_files[]\\n}\\n\\n/// Article entity.\\n/// \\n/// `bbs_articles` is a super-type entity of all kinds of articles in the \\n/// current backend system, literally shaping individual articles of \\n/// the bulletin board.\\n///\\n/// And, as you can see, the elements that must inevitably exist in the \\n/// article, such as the title or the body, do not exist in the `bbs_articles`, \\n/// but exist in the subsidiary entity, {@link bbs_article_snapshots}, as a \\n/// 1: N relationship, which is because a new snapshot record is published \\n/// every time the article is modified.\\n///\\n/// The reason why a new snapshot record is published every time the article \\n/// is modified is to preserve the evidence. Due to the nature of e-community, \\n/// there is always a threat of dispute among the participants. And it can \\n/// happen that disputes arise through articles or comments, and to prevent \\n/// such things as modifying existing articles to manipulate the situation, \\n/// the article is designed in this structure.\\n///\\n/// In other words, to keep evidence, and prevent fraud.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_articles {\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Writer's name.\\n writer String @db.VarChar\\n\\n /// Password for modification.\\n password String @db.VarChar\\n\\n /// Creation time of article.\\n created_at DateTime @db.Timestamptz\\n\\n /// Deletion time of article.\\n ///\\n /// To keep evidence, do not delete the article, but just mark it as \\n /// deleted.\\n deleted_at DateTime? @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n /// List of snapshots.\\n ///\\n /// It is created for the first time when an article is created, and is\\n /// accumulated every time the article is modified.\\n snapshots bbs_article_snapshots[]\\n\\n /// List of comments.\\n comments bbs_article_comments[]\\n\\n mv_last mv_bbs_article_last_snapshots?\\n\\n @@index([created_at])\\n}\\n\\n/// Snapshot of article.\\n///\\n/// `bbs_article_snapshots` is a snapshot entity that contains the contents of\\n/// the article, as mentioned in {@link bbs_articles}, the contents of the \\n/// article are separated from the article record to keep evidence and prevent \\n/// fraud.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_snapshots {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belong article's {@link bbs_articles.id}\\n bbs_article_id String @db.Uuid\\n\\n /// Format of body.\\n ///\\n /// Same meaning with extension like `html`, `md`, `txt`.\\n format String @db.VarChar\\n\\n /// Title of article.\\n title String @db.VarChar\\n\\n /// Content body of article.\\n body String\\n\\n /// IP address of the snapshot writer.\\n ip String @db.VarChar\\n\\n /// Creation time of record.\\n ///\\n /// It means creation time or update time or article.\\n created_at DateTime @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belong article info.\\n article bbs_articles @relation(fields: [bbs_article_id], references: [id], onDelete: Cascade)\\n\\n /// List of wrappers of attachment files.\\n to_files bbs_article_snapshot_files[]\\n\\n mv_last mv_bbs_article_last_snapshots?\\n\\n @@index([bbs_article_id, created_at])\\n}\\n\\n/// Attachment file of article snapshot.\\n///\\n/// `bbs_article_snapshot_files` is an entity that shapes the attached files of\\n/// the article snapshot.\\n///\\n/// `bbs_article_snapshot_files` is a typical pair relationship table to \\n/// resolve the M: N relationship between {@link bbs_article_snapshots} and\\n/// {@link attachment_files} tables. Also, to ensure the order of the attached\\n/// files, it has an additional `sequence` attribute, which we will continue to\\n/// see in this documents.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_snapshot_files {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belonged snapshot's {@link bbs_article_snapshots.id}\\n bbs_article_snapshot_id String @db.Uuid\\n\\n /// Belonged file's {@link attachment_files.id}\\n attachment_file_id String @db.Uuid\\n\\n /// Sequence of attachment file in the snapshot.\\n sequence Int @db.Integer\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belonged article.\\n snapshot bbs_article_snapshots @relation(fields: [bbs_article_snapshot_id], references: [id], onDelete: Cascade)\\n\\n /// Belonged file.\\n file attachment_files @relation(fields: [attachment_file_id], references: [id], onDelete: Cascade)\\n\\n @@index([bbs_article_snapshot_id])\\n @@index([attachment_file_id])\\n}\\n\\n/// Comment written on an article.\\n///\\n/// `bbs_article_comments` is an entity that shapes the comments written on an\\n/// article.\\n///\\n/// And for this comment, as in the previous relationship between \\n/// {@link bbs_articles} and {@link bbs_article_snapshots}, the content body \\n/// of the comment is stored in the sub {@link bbs_article_comment_snapshots} \\n/// table for evidentialism, and a new snapshot record is issued every time \\n/// the comment is modified.\\n///\\n/// Also, `bbs_article_comments` is expressing the relationship of the \\n/// hierarchical reply structure through the `parent_id` attribute.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_comments {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belonged article's {@link bbs_articles.id}\\n bbs_article_id String @db.Uuid\\n\\n /// Parent comment's {@link bbs_article_comments.id}\\n ///\\n /// Used to express the hierarchical reply structure.\\n parent_id String? @db.Uuid\\n\\n /// Writer's name.\\n writer String @db.VarChar\\n\\n /// Password for modification.\\n password String @db.VarChar\\n\\n /// Creation time of comment.\\n created_at DateTime @db.Timestamptz\\n\\n /// Deletion time of comment.\\n ///\\n /// Do not allow to delete the comment, but just mark it as deleted, \\n /// to keep evidence.\\n deleted_at DateTime? @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belonged article.\\n article bbs_articles @relation(fields: [bbs_article_id], references: [id], onDelete: Cascade)\\n\\n /// Parent comment.\\n ///\\n /// Only when reply case.\\n parent bbs_article_comments? @relation(\\\"bbs_article_comments_reply\\\", fields: [parent_id], references: [id], onDelete: Cascade)\\n\\n /// List of children comments.\\n ///\\n /// Reply comments of current.\\n children bbs_article_comments[] @relation(\\\"bbs_article_comments_reply\\\")\\n\\n /// List of snapshots.\\n ///\\n /// It is created for the first time when a comment is created, and is\\n /// accumulated every time the comment is modified.\\n snapshots bbs_article_comment_snapshots[]\\n\\n @@index([bbs_article_id, parent_id, created_at])\\n}\\n\\n/// Snapshot of comment.\\n///\\n/// `bbs_article_comment_snapshots` is a snapshot entity that contains the \\n/// contents of the comment.\\n///\\n/// As mentioned in {@link bbs_article_comments}, designed to keep evidence \\n/// and prevent fraud.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_comment_snapshots {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belonged article's {@link bbs_article_comments.id}\\n bbs_article_comment_id String @db.Uuid\\n\\n /// Format of content body.\\n ///\\n /// Same meaning with extension like `html`, `md`, `txt`.\\n format String @db.VarChar\\n\\n /// Content body of comment.\\n body String\\n\\n /// IP address of the snapshot writer.\\n ip String @db.VarChar\\n\\n /// Creation time of record.\\n ///\\n /// It means creation time or update time or comment.\\n created_at DateTime @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belong comment info.\\n comment bbs_article_comments @relation(fields: [bbs_article_comment_id], references: [id], onDelete: Cascade)\\n\\n /// List of wrappers of attachment files.\\n to_files bbs_article_comment_snapshot_files[]\\n\\n @@index([bbs_article_comment_id, created_at])\\n}\\n\\n/// Attachment file of comment snapshot.\\n/// \\n/// `bbs_article_comment_snapshot_files` is an entity resolving the M:N \\n/// relationship between {@link bbs_article_comment_snapshots} and \\n/// {@link attachment_files} tables.\\n/// \\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_comment_snapshot_files {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belonged snapshot's {@link bbs_article_comment_snapshots.id}\\n bbs_article_comment_snapshot_id String @db.Uuid\\n\\n /// Belonged file's {@link attachment_files.id}\\n attachment_file_id String @db.Uuid\\n\\n /// Sequence order.\\n ///\\n /// Sequence order of the attached file in the belonged snapshot.\\n sequence Int @db.Integer\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belonged article.\\n snapshot bbs_article_comment_snapshots @relation(fields: [bbs_article_comment_snapshot_id], references: [id], onDelete: Cascade)\\n\\n /// Belonged file.\\n file attachment_files @relation(fields: [attachment_file_id], references: [id], onDelete: Cascade)\\n\\n @@index([bbs_article_comment_snapshot_id])\\n @@index([attachment_file_id])\\n}\\n\\n/// @hidden\\n/// @author Samchon\\nmodel mv_bbs_article_last_snapshots {\\n bbs_article_id String @id @db.Uuid\\n bbs_article_snapshot_id String @db.Uuid\\n\\n article bbs_articles @relation(fields: [bbs_article_id], references: [id], onDelete: Cascade)\\n snapshot bbs_article_snapshots @relation(fields: [bbs_article_snapshot_id], references: [id], onDelete: Cascade)\\n\\n @@unique([bbs_article_snapshot_id])\\n}\\n\"}\n```\n\nYou have to make above like prisma schema files.\n\nStudy the above schema files, and follow its coding style." /* AutoBeSystemPromptConstant.PRISMA_EXAMPLE */,
39
37
  ].join("\n"),
40
38
  },
41
39
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"transformPrismaCompilerHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/transformPrismaCompilerHistories.ts"],"names":[],"mappings":";;;AAKO,MAAM,gCAAgC,GAAG,CAC9C,KAAkB,EAClB,KAA6B,EAG7B,EAAE;IACF,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI;QACxB,OAAO;YACL;gBACE,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE;oBACJ,4CAA4C;oBAC5C,+BAA+B;oBAC/B,8CAA8C;iBAC/C,CAAC,IAAI,CAAC,GAAG,CAAC;aACZ;SACF,CAAC;IACJ,OAAO;QACL;YACE,IAAI,EAAE,eAAe;YACrB,IAAI,2nJAA4C;SACjD;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE;gBACJ,6DAA6D;gBAC7D,EAAE;gBACF,oHAAoH;gBACpH,EAAE;gBACF,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;qBAClB,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,EAAE;oBAC3B,OAAO;wBACL,kFAAkF;wBAClF,YAAY,QAAQ,EAAE;wBACtB,kFAAkF;wBAClF,OAAO;qBACR,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACf,CAAC,CAAC;qBACD,IAAI,CAAC,MAAM,CAAC;gBACf,EAAE;aACH,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;AACJ,CAAC,CAAC;AA3CW,QAAA,gCAAgC,oCA2C3C"}
1
+ {"version":3,"file":"transformPrismaCompilerHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/transformPrismaCompilerHistories.ts"],"names":[],"mappings":";;;AAKO,MAAM,gCAAgC,GAAG,CAC9C,KAA6B,EAC7B,MAA4C,EAG5C,EAAE;IACF,OAAO;QACL;YACE,IAAI,EAAE,eAAe;YACrB,IAAI,wpNAA4C;SACjD;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE;gBACJ,6DAA6D;gBAC7D,EAAE;gBACF,SAAS;gBACT,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;gBACrB,KAAK;aACN,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE;gBACJ,iEAAiE;gBACjE,gCAAgC;gBAChC,EAAE;gBACF,MAAM,CAAC,MAAM;aACd,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;QACD;YACE,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE;gBACJ,iCAAiC;gBACjC,oCAAoC;gBACpC,sCAAsC;gBACtC,EAAE;;aAEH,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;AACJ,CAAC,CAAC;AAzCW,QAAA,gCAAgC,oCAyC3C"}