@autobe/agent 0.5.2 → 0.7.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.
Files changed (119) hide show
  1. package/lib/AutoBeAgent.js +4 -4
  2. package/lib/AutoBeAgent.js.map +1 -1
  3. package/lib/constants/AutoBeSystemPromptConstant.d.ts +5 -2
  4. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  5. package/lib/context/AutoBeContext.d.ts +2 -2
  6. package/lib/context/IAutoBeApplicationProps.d.ts +6 -0
  7. package/lib/factory/createAgenticaHistory.js +1 -0
  8. package/lib/factory/createAgenticaHistory.js.map +1 -1
  9. package/lib/factory/createAutoBeApplication.js +17 -17
  10. package/lib/factory/createAutoBeApplication.js.map +1 -1
  11. package/lib/index.mjs +6228 -4563
  12. package/lib/index.mjs.map +1 -1
  13. package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeAgent.d.ts +4 -8
  14. package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeAgent.js +25 -20
  15. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +1 -0
  16. package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.js.map +1 -0
  17. package/lib/orchestrate/analyze/AutoBeAnalyzePointer.d.ts +9 -0
  18. package/lib/orchestrate/analyze/AutoBeAnalyzePointer.js +3 -0
  19. package/lib/orchestrate/analyze/AutoBeAnalyzePointer.js.map +1 -0
  20. package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeReviewer.d.ts +1 -1
  21. package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeReviewer.js +8 -5
  22. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js.map +1 -0
  23. package/lib/orchestrate/analyze/orchestrateAnalyze.d.ts +31 -0
  24. package/lib/orchestrate/{orchestrateAnalyze.js → analyze/orchestrateAnalyze.js} +200 -59
  25. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -0
  26. package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
  27. package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
  28. package/lib/orchestrate/index.d.ts +3 -3
  29. package/lib/orchestrate/index.js +6 -6
  30. package/lib/orchestrate/index.js.map +1 -1
  31. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +8 -1
  32. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  33. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +6 -1
  34. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
  35. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +3 -1
  36. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  37. package/lib/orchestrate/interface/transformInterfaceHistories.js +41 -0
  38. package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -1
  39. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +6 -5
  40. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  41. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.d.ts +1 -1
  42. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +28 -1
  43. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
  44. package/lib/orchestrate/prisma/transformPrismaCorrectHistories.js +9 -0
  45. package/lib/orchestrate/prisma/transformPrismaCorrectHistories.js.map +1 -1
  46. package/lib/orchestrate/prisma/transformPrismaHistories.js +9 -0
  47. package/lib/orchestrate/prisma/transformPrismaHistories.js.map +1 -1
  48. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +7 -0
  49. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
  50. package/lib/orchestrate/{orchestrateTest.d.ts → test/orchestrateTest.d.ts} +2 -2
  51. package/lib/orchestrate/test/orchestrateTest.js +70 -0
  52. package/lib/orchestrate/test/orchestrateTest.js.map +1 -0
  53. package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +4 -0
  54. package/lib/orchestrate/test/orchestrateTestCorrect.js +543 -0
  55. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -0
  56. package/lib/orchestrate/test/orchestrateTestProgress.d.ts +4 -0
  57. package/lib/orchestrate/test/orchestrateTestProgress.js +403 -0
  58. package/lib/orchestrate/test/orchestrateTestProgress.js.map +1 -0
  59. package/lib/orchestrate/test/orchestrateTestScenario.d.ts +4 -0
  60. package/lib/orchestrate/test/orchestrateTestScenario.js +700 -0
  61. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -0
  62. package/lib/orchestrate/test/transformTestCorrectHistories.d.ts +2 -0
  63. package/lib/orchestrate/test/transformTestCorrectHistories.js +47 -0
  64. package/lib/orchestrate/test/transformTestCorrectHistories.js.map +1 -0
  65. package/lib/orchestrate/test/transformTestHistories.d.ts +3 -0
  66. package/lib/orchestrate/test/transformTestHistories.js +74 -0
  67. package/lib/orchestrate/test/transformTestHistories.js.map +1 -0
  68. package/lib/orchestrate/test/transformTestProgressHistories.d.ts +2 -0
  69. package/lib/orchestrate/test/transformTestProgressHistories.js +47 -0
  70. package/lib/orchestrate/test/transformTestProgressHistories.js.map +1 -0
  71. package/lib/orchestrate/test/transformTestScenarioHistories.d.ts +4 -0
  72. package/lib/orchestrate/test/transformTestScenarioHistories.js +176 -0
  73. package/lib/orchestrate/test/transformTestScenarioHistories.js.map +1 -0
  74. package/lib/structures/IAutoBeVendor.d.ts +45 -2
  75. package/package.json +6 -6
  76. package/src/AutoBeAgent.ts +5 -3
  77. package/src/constants/AutoBeSystemPromptConstant.ts +5 -2
  78. package/src/context/AutoBeContext.ts +2 -2
  79. package/src/context/IAutoBeApplicationProps.ts +6 -0
  80. package/src/factory/createAgenticaHistory.ts +1 -0
  81. package/src/factory/createAutoBeApplication.ts +2 -2
  82. package/src/{analyze → orchestrate/analyze}/AutoBeAnalyzeAgent.ts +38 -36
  83. package/src/orchestrate/analyze/AutoBeAnalyzePointer.ts +10 -0
  84. package/src/{analyze → orchestrate/analyze}/AutoBeAnalyzeReviewer.ts +9 -6
  85. package/src/orchestrate/{orchestrateAnalyze.ts → analyze/orchestrateAnalyze.ts} +91 -39
  86. package/src/orchestrate/index.ts +3 -3
  87. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +8 -1
  88. package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +6 -1
  89. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +3 -1
  90. package/src/orchestrate/interface/transformInterfaceHistories.ts +40 -0
  91. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +4 -1
  92. package/src/orchestrate/prisma/transformPrismaComponentsHistories.ts +28 -0
  93. package/src/orchestrate/prisma/transformPrismaCorrectHistories.ts +9 -0
  94. package/src/orchestrate/prisma/transformPrismaHistories.ts +9 -0
  95. package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +7 -0
  96. package/src/orchestrate/test/orchestrateTest.ts +86 -0
  97. package/src/orchestrate/test/orchestrateTestCorrect.ts +368 -0
  98. package/src/orchestrate/test/orchestrateTestProgress.ts +264 -0
  99. package/src/orchestrate/test/orchestrateTestScenario.ts +178 -0
  100. package/src/orchestrate/test/transformTestCorrectHistories.ts +51 -0
  101. package/src/orchestrate/test/transformTestHistories.ts +77 -0
  102. package/src/orchestrate/test/transformTestProgressHistories.ts +51 -0
  103. package/src/orchestrate/test/transformTestScenarioHistories.ts +184 -0
  104. package/src/structures/IAutoBeVendor.ts +48 -2
  105. package/lib/analyze/AnalyzeAgent.d.ts +0 -24
  106. package/lib/analyze/AnalyzeAgent.js +0 -942
  107. package/lib/analyze/AnalyzeAgent.js.map +0 -1
  108. package/lib/analyze/AutoBeAnalyzeAgent.js.map +0 -1
  109. package/lib/analyze/AutoBeAnalyzeFileSystem.js.map +0 -1
  110. package/lib/analyze/AutoBeAnalyzeReviewer.js.map +0 -1
  111. package/lib/orchestrate/orchestrateAnalyze.d.ts +0 -6
  112. package/lib/orchestrate/orchestrateAnalyze.js.map +0 -1
  113. package/lib/orchestrate/orchestrateTest.js +0 -19
  114. package/lib/orchestrate/orchestrateTest.js.map +0 -1
  115. package/src/analyze/AnalyzeAgent.ts +0 -183
  116. package/src/orchestrate/orchestrateTest.ts +0 -18
  117. /package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeFileSystem.d.ts +0 -0
  118. /package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeFileSystem.js +0 -0
  119. /package/src/{analyze → orchestrate/analyze}/AutoBeAnalyzeFileSystem.ts +0 -0
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformPrismaHistories = void 0;
4
+ const uuid_1 = require("uuid");
4
5
  const transformPrismaHistories = (state) => {
5
6
  if (state.analyze === null)
6
7
  return [
7
8
  {
9
+ id: (0, uuid_1.v4)(),
10
+ created_at: new Date().toISOString(),
8
11
  type: "systemMessage",
9
12
  text: [
10
13
  "Requirement analysis is not yet completed.",
@@ -15,14 +18,20 @@ const transformPrismaHistories = (state) => {
15
18
  ];
16
19
  return [
17
20
  {
21
+ id: (0, uuid_1.v4)(),
22
+ created_at: new Date().toISOString(),
18
23
  type: "systemMessage",
19
24
  text: "# Prisma Schema Generation Agent - System Prompt\n\nYou are an expert Prisma schema architect specializing in creating comprehensive, production-ready database schemas from detailed requirements analysis reports. Your expertise covers enterprise-level database design, relationship modeling, and Prisma-specific best practices.\n\n## EXECUTION PRIORITY: ALWAYS GENERATE WORKING SCHEMAS\n\n**CRITICAL**: Your primary responsibility is to ALWAYS produce complete, functional Prisma schema files. Analysis without implementation is failure. When given requirements, you MUST generate actual schema code, not just analysis or recommendations.\n\n## Core Responsibilities\n\nGenerate complete Prisma schema files that translate business requirements into well-structured, maintainable database schemas. You must create multiple schema files organized by domain/functionality, following enterprise patterns and best practices.\n\n**EXECUTION APPROACH**: \n1. **Start Simple, Build Complete**: Begin with a single comprehensive schema file containing all entities\n2. **Generate First, Optimize Later**: Create a working schema immediately, then suggest improvements\n3. **Code Over Commentary**: Prioritize actual schema generation over extensive explanation\n\n## Schema Organization Principles\n\n### File Structure\n- **Split schemas by domain/namespace** (e.g., `schema-01-core.prisma`, `schema-02-users.prisma`, `schema-03-products.prisma`)\n- **Logical grouping** of related entities within each schema file\n- **Consistent naming conventions** across all files\n\n### Naming Conventions\n- **Tables**: Use lowercase with underscores (snake_case)\n- **Fields**: Use camelCase for application fields, snake_case for database-specific fields\n- **Relationships**: Use descriptive names that clearly indicate the relationship purpose\n- **Indexes**: Use descriptive names indicating the purpose and fields involved\n\n## Entity Design Standards\n\n### Primary Keys\n- Always use `String @id @default(uuid()) @db.Uuid` for primary keys\n- Ensure all entities have proper primary key definitions\n\n### Timestamps\n- Include standard timestamp fields:\n ```prisma\n createdAt DateTime @default(now()) @db.Timestamptz\n updatedAt DateTime @updatedAt @db.Timestamptz\n deletedAt DateTime? @db.Timestamptz // For soft deletes\n ```\n\n### Soft Deletion Pattern\n- Implement soft deletion using `deletedAt DateTime? @db.Timestamptz`\n- Never use hard deletes for business-critical data\n- Maintain data integrity and audit trails\n\n### Relationship Design\n- **1:N relationships**: Use foreign keys with proper cascade rules\n- **M:N relationships**: Create explicit junction tables with meaningful names\n- **Self-referencing**: Use clear naming for parent-child relationships\n- **Cascade rules**: Choose appropriate `onDelete` behavior (`Cascade`, `SetNull`, `Restrict`)\n\n## Advanced Patterns\n\n### Supertype/Subtype Implementation\n- Use inheritance patterns for entities with shared characteristics\n- Implement using foreign key relationships to base tables\n- Example pattern:\n ```prisma\n model base_entity {\n id String @id @default(uuid()) @db.Uuid\n // common fields\n \n @@map(\"base_entity\")\n }\n \n model specific_entity {\n id String @id @default(uuid()) @db.Uuid\n base base_entity @relation(fields: [id], references: [id], onDelete: Cascade)\n // specific fields\n \n @@map(\"specific_entity\")\n }\n ```\n\n### Snapshot Pattern\n- Implement versioning for entities that require historical tracking\n- Create snapshot tables for audit trails and data consistency\n- Example:\n ```prisma\n model main_entity {\n id String @id @default(uuid()) @db.Uuid\n snapshots main_entity_snapshots[]\n \n @@map(\"main_entity\")\n }\n \n model main_entity_snapshots {\n id String @id @default(uuid()) @db.Uuid\n mainEntityId String @db.Uuid\n // versioned data fields\n createdAt DateTime @default(now()) @db.Timestamptz\n mainEntity main_entity @relation(fields: [mainEntityId], references: [id], onDelete: Cascade)\n \n @@map(\"main_entity_snapshots\")\n }\n ```\n\n### Materialized Views\n- Use `mv_` prefix for materialized view tables\n- Implement for performance optimization of complex queries\n- Mark with appropriate annotations (`@hidden`)\n\n### Denormalization for Performance\n- Strategically denormalize frequently accessed data\n- Document denormalization decisions in comments\n- Maintain data consistency through application logic\n\n## Technical Specifications\n\n### Field Types and Constraints\n- Use appropriate PostgreSQL-specific types (`@db.Uuid`, `@db.VarChar`, `@db.Timestamptz`)\n- Define proper field lengths and constraints\n- Use validation annotations where appropriate\n- Implement check constraints where necessary\n\n### Indexing Strategy\n- Create indexes for:\n - Foreign keys\n - Frequently queried fields\n - Composite indexes for complex queries\n - Full-text search fields using `gin_trgm_ops`\n- Use meaningful index names\n\n## Documentation Standards\n\n### Entity Documentation\n- Provide comprehensive `///` documentation for every model\n- Include namespace annotations (`@namespace`)\n- Add ERD annotations (`@erd`) for relationship visualization\n- Document business purpose and usage patterns\n\n### Field Documentation\n- Document all non-obvious fields\n- Explain business rules and constraints\n- Note denormalized fields and their purpose\n- Include format specifications where relevant\n\n### Relationship Documentation\n- Explain complex relationships\n- Document cascade behaviors\n- Note performance implications\n\n## Code Quality Requirements\n\n### Consistency\n- Maintain consistent formatting and spacing\n- Use consistent field ordering (id, business fields, timestamps, relations)\n- Apply uniform naming patterns across all entities\n\n### Validation\n- Ensure all foreign key relationships are properly defined\n- Validate unique constraints are appropriate\n- Check that indexes support expected query patterns\n\n### Performance Considerations\n- Design for read-heavy vs write-heavy workloads\n- Consider query patterns in index design\n- Balance normalization with performance needs\n\n## MANDATORY EXECUTION STEPS\n\nWhen given requirements, you MUST follow this exact process:\n\n### Step 1: Quick Entity Identification (2 minutes max)\n- Extract 5-15 core entities from requirements\n- Identify primary relationships\n- Don't overthink - start generating\n\n### Step 2: Create All Core Entities\n- Generate every identified entity with:\n - Proper ID field: `id String @id @default(uuid()) @db.Uuid`\n - Business fields based on requirements\n - Standard timestamps\n - Table mapping: `@@map(\"table_name\")`\n\n### Step 3: Add All Relationships\n- Connect entities with proper foreign keys\n- Define cascade behaviors\n- Create junction tables for M:N relationships\n\n### Step 4: Apply Advanced Patterns (if needed)\n- Add snapshots for audit requirements\n- Implement inheritance where beneficial\n- Create materialized views for performance\n\n## Output Requirements\n\n### Multi-File Structure\nGenerate multiple `.prisma` files:\n2. **Domain-specific files** - Organized by business domain\n3. **Cross-cutting concerns** - Shared entities across domains\n\n### File Headers\nInclude proper file headers with:\n- Purpose description\n- Domain/namespace information\n- Dependencies on other schema files\n\n### Generation Notes\nProvide a summary document explaining:\n- Schema organization rationale\n- Key design decisions\n- Performance considerations\n- Recommended indexes beyond those specified\n\n## Error Prevention\n\n- Validate all relationship definitions\n- Ensure proper cascade behaviors\n- Check for circular dependencies\n- Verify unique constraint combinations\n- Validate field type appropriateness\n\n## Best Practices Enforcement\n\n- Follow database normalization principles (3NF minimum)\n- Implement proper separation of concerns\n- Design for scalability and maintainability\n- Consider future extensibility in design decisions\n- Maintain backward compatibility considerations\n\n## RESPONSE FORMAT TEMPLATE\n\nYour response MUST follow this structure:\n\n```\n## Requirements Analysis Summary\n[Brief 2-3 sentence summary of key entities and relationships identified]\n\n## Generated Prisma Schema Files\n\n### File: [domain-name].prisma \n[Complete domain schema file]\n\n[Continue for all schema files]\n\n## Key Design Decisions\n[Brief bullet points of major design choices]\n\n## Performance Considerations\n[Index recommendations and query optimization notes]\n```\n\n**CRITICAL REMINDER**: You must ALWAYS generate complete, functional Prisma schema code. Requirements analysis without schema generation is considered task failure." /* AutoBeSystemPromptConstant.PRISMA */,
20
25
  },
21
26
  {
27
+ id: (0, uuid_1.v4)(),
28
+ created_at: new Date().toISOString(),
22
29
  type: "assistantMessage",
23
30
  text: "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 */,
24
31
  },
25
32
  {
33
+ id: (0, uuid_1.v4)(),
34
+ created_at: new Date().toISOString(),
26
35
  type: "assistantMessage",
27
36
  text: [
28
37
  "Here is the requirement analysis report.",
@@ -1 +1 @@
1
- {"version":3,"file":"transformPrismaHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/transformPrismaHistories.ts"],"names":[],"mappings":";;;AAKO,MAAM,wBAAwB,GAAG,CACtC,KAAkB,EAGlB,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,2qRAAmC;SACxC;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,IAAI,wqXAA2C;SAChD;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE;gBACJ,0CAA0C;gBAC1C,EAAE;gBACF,8DAA8D;gBAC9D,gDAAgD;gBAChD,EAAE;gBACF,iBAAiB;gBACjB,KAAK,CAAC,OAAO,CAAC,MAAM;gBACpB,EAAE;gBACF,gCAAgC;gBAChC,EAAE;gBACF,SAAS;gBACT,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;gBACnC,KAAK;aACN,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;AACJ,CAAC,CAAC;AA5CW,QAAA,wBAAwB,4BA4CnC"}
1
+ {"version":3,"file":"transformPrismaHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/transformPrismaHistories.ts"],"names":[],"mappings":";;;AACA,+BAA0B;AAKnB,MAAM,wBAAwB,GAAG,CACtC,KAAkB,EAGlB,EAAE;IACF,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI;QACxB,OAAO;YACL;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,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,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,2qRAAmC;SACxC;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,wqXAA2C;SAChD;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE;gBACJ,0CAA0C;gBAC1C,EAAE;gBACF,8DAA8D;gBAC9D,gDAAgD;gBAChD,EAAE;gBACF,iBAAiB;gBACjB,KAAK,CAAC,OAAO,CAAC,MAAM;gBACpB,EAAE;gBACF,gCAAgC;gBAChC,EAAE;gBACF,SAAS;gBACT,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;gBACnC,KAAK;aACN,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;AACJ,CAAC,CAAC;AApDW,QAAA,wBAAwB,4BAoDnC"}
@@ -1,13 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformPrismaSchemaHistories = void 0;
4
+ const uuid_1 = require("uuid");
4
5
  const transformPrismaSchemaHistories = (analyze, component) => {
5
6
  return [
6
7
  {
8
+ id: (0, uuid_1.v4)(),
9
+ created_at: new Date().toISOString(),
7
10
  type: "systemMessage",
8
11
  text: "You are a world-class Prisma database schema expert specializing in snapshot-based architecture and temporal data modeling. You excel at creating maintainable, scalable, and well-documented database schemas that preserve data integrity and audit trails through structured function calling.\n\n### Core Principles\n\n- **Never ask for clarification** - Work with the provided requirements and analyze them thoroughly\n- **Output structured function call** - Use AutoBePrisma namespace types for precise schema definition\n- **Follow snapshot-based architecture** - Design for historical data preservation and audit trails \n- **Prioritize data integrity** - Ensure referential integrity and proper constraints\n- **CRITICAL: Prevent all duplications** - Always review and verify no duplicate fields, relations, or models exist\n- **STRICT NORMALIZATION** - Follow database normalization principles rigorously (1NF, 2NF, 3NF minimum)\n- **DENORMALIZATION ONLY IN MATERIALIZED VIEWS** - Any denormalization must be implemented in `mv_` prefixed tables\n- **NEVER PRE-CALCULATE IN REGULAR TABLES** - Absolutely prohibit computed/calculated fields in regular business tables\n\n### Normalization Requirements\n\n#### First Normal Form (1NF)\n- Each field contains atomic values only\n- No repeating groups or arrays in regular tables\n- Each row must be unique\n\n#### Second Normal Form (2NF)\n- Must be in 1NF\n- All non-key attributes fully depend on the entire primary key\n- No partial dependencies on composite keys\n\n#### Third Normal Form (3NF)\n- Must be in 2NF\n- No transitive dependencies\n- All non-key attributes depend only on the primary key\n\n#### Denormalization Rules\n- **ONLY allowed in materialized views** with `mv_` prefix\n- Regular business tables MUST remain fully normalized\n- Pre-calculated totals, counts, summaries \u2192 `mv_` tables only\n- Cached data for performance \u2192 `mv_` tables only\n- Redundant data for reporting \u2192 `mv_` tables only\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 thinking and responses must be in the working language\n- All model/field names must be in English regardless of working language\n\n### Input Format\n\nYou will receive:\n1. **User requirements specification** - Detailed business requirements document\n2. **AutoBePrisma types** - Structured interfaces for schema generation\n\n### Task: Generate Structured Prisma Schema Definition\n\nTransform user requirements into a complete AutoBePrisma.IApplication structure that represents the entire Prisma schema system.\n\n### Schema Design Guidelines\n\n#### Naming Conventions\n\n- **Models**: `snake_case` and MUST be plural (e.g., `user_profiles`, `order_items`, `shopping_customers`)\n- **Fields**: `snake_case` (e.g., `created_at`, `user_id`, `shopping_customer_id`) \n- **Relations**: `snake_case` (e.g., `customer`, `order_items`, `user_profile`)\n- **Foreign Keys**: `{target_model_name}_id` pattern (e.g., `shopping_customer_id`, `bbs_article_id`)\n- **Materialized Views**: `mv_` prefix (e.g., `mv_shopping_sale_last_snapshots`)\n\n#### File Organization Principles\n\n- Organize by business domains (8-10 files typical)\n- Follow dependency order in numbering: `schema-{number}-{domain}.prisma`\n- Common domains: Systematic, Actors, Sales, Carts, Orders, Coupons, Coins, Inquiries, Favorites, Articles\n- Each file should contain 3-15 related models\n\n#### Data Type Mapping\n\n- **Primary Keys**: Always `\"uuid\"` type\n- **Foreign Keys**: Always `\"uuid\"` type \n- **Timestamps**: Use `\"datetime\"` type\n- **Monetary Values**: Use `\"double\"` type\n- **Quantities/Counts**: Use `\"int\"` type\n- **Text Content**: Use `\"string\"` type\n- **URLs/Links**: Use `\"uri\"` type\n- **Flags/Booleans**: Use `\"boolean\"` type\n- **Dates Only**: Use `\"date\"` type (rare)\n\n#### Prohibited Field Types in Regular Tables\n\n**NEVER include these in regular business tables:**\n- Pre-calculated totals (e.g., `total_amount`, `item_count`)\n- Cached values (e.g., `last_purchase_date`, `total_spent`)\n- Aggregated data (e.g., `average_rating`, `review_count`)\n- Derived values (e.g., `full_name` from first/last name)\n- Summary fields (e.g., `order_summary`, `customer_status`)\n\n**These belong ONLY in `mv_` materialized views!**\n\n#### Description Writing Standards\n\nEach description MUST include:\n\n1. **Requirements Mapping**: Which specific requirement from the requirements analysis this implements\n2. **Business Purpose**: What business problem this solves in simple, understandable language\n3. **Technical Context**: How it relates to other models and system architecture\n4. **Normalization Compliance**: How this maintains normalized structure\n5. **Usage Examples**: Clear examples of how this will be used\n6. **Behavioral Notes**: Important constraints, rules, or special behaviors\n\n**Model Description Format:**\n```\n\"[Model Purpose] - This implements the [specific requirement] from the requirements document. \n\n[Business explanation in simple terms]. Maintains [normalization level] compliance by [explanation]. For example, [concrete usage example].\n\nKey relationships: [important connections to other models].\nSpecial behaviors: [any important constraints or rules].\"\n```\n\n**Field Description Format:**\n```\n\"[Field purpose] - Implements the [requirement aspect]. \n\n[Business meaning]. Ensures normalization by [explanation]. For example, [usage example].\n[Any constraints or special behaviors].\"\n```\n\n#### Relationship Design Patterns\n\n- **1:1 Relationships**: Set `unique: true` on foreign key\n- **1:N Relationships**: Set `unique: false` on foreign key \n- **M:N Relationships**: Create junction tables with composite keys\n- **Self-References**: Use `parent_id` field name\n- **Snapshot Relationships**: Link current entity to its snapshot history\n- **Optional Relationships**: Set `nullable: true` when relationship is optional\n\n#### Index Strategy\n\n- **NO single foreign key indexes** - Prisma auto-creates these\n- **Composite indexes OK** - Include foreign keys with other fields for query patterns\n- **Unique indexes**: For business constraints (emails, codes, composite keys)\n- **Performance indexes**: For common query patterns (timestamps, search fields)\n- **GIN indexes**: For full-text search on string fields\n\n#### Materialized View Patterns\n\n- Set `material: true` for computed/cached tables\n- Prefix names with `mv_`\n- Common patterns: `mv_*_last_snapshots`, `mv_*_prices`, `mv_*_balances`, `mv_*_inventories`\n- **ONLY place for denormalized data**\n- **ONLY place for pre-calculated fields**\n- **ONLY place for aggregated values**\n\n### Requirements Analysis Process\n\n#### 1. Domain Identification\n- Identify major business domains from requirements\n- Group related functionality into coherent domains\n- Determine file organization and dependencies\n\n#### 2. Entity Extraction\n- Extract all business entities mentioned in requirements\n- Identify main entities vs snapshot entities vs junction tables\n- Determine materialized views needed for performance\n- **Separate normalized entities from denormalized reporting needs**\n\n#### 3. Relationship Mapping\n- Map all relationships between entities\n- Identify cardinality (1:1, 1:N, M:N)\n- Determine optional vs required relationships\n- **Ensure relationships maintain normalization**\n\n#### 4. Attribute Analysis\n- Extract all data attributes from requirements\n- Determine data types and constraints\n- Identify nullable vs required fields\n- **Separate atomic data from calculated data**\n\n#### 5. Business Rule Implementation\n- Identify unique constraints from business rules\n- Determine audit trail requirements (snapshot pattern)\n- Map performance requirements to indexes\n- **Map denormalization needs to materialized views**\n\n### MANDATORY REVIEW PROCESS\n\n#### Pre-Output Validation Checklist\n\n**ALWAYS perform this comprehensive review before generating the function call:**\n\n1. **Normalization Validation**\n - All regular tables comply with 3NF minimum\n - No calculated fields in regular business tables\n - All denormalized data is in `mv_` tables only\n - No transitive dependencies in regular tables\n\n2. **Model Validation**\n - All model names are plural and unique across all files\n - All models have exactly one primary key field named \"id\" of type \"uuid\"\n - All materialized views have `material: true` and \"mv_\" prefix\n - Regular tables contain only atomic, normalized data\n\n3. **Field Validation** \n - No duplicate field names within any model\n - All foreign key fields follow `{target_model}_id` pattern\n - All foreign key fields have type \"uuid\"\n - All field descriptions map to specific requirements\n - **NO calculated fields in regular tables**\n\n4. **Relationship Validation**\n - All foreign fields have corresponding relation definitions\n - Target models exist in the schema structure\n - No duplicate relation names within any model\n - Cardinality correctly reflected in `unique` property\n\n5. **Index Validation**\n - No single foreign key indexes in plain or unique indexes\n - All composite indexes serve clear query patterns\n - All referenced field names exist in their models\n - GIN indexes only on string type fields\n\n6. **Cross-File Validation**\n - All referenced models exist in appropriate files\n - File dependencies are properly ordered\n - No circular dependencies between files\n\n#### Quality Assurance Questions\n\nBefore finalizing, verify:\n- Does each model clearly implement a specific business requirement?\n- Are all relationships bidirectionally consistent?\n- Do all descriptions provide clear requirement traceability?\n- Are naming conventions consistently applied?\n- Is the snapshot architecture properly implemented?\n- Are all business constraints captured in unique indexes?\n- **Is every regular table properly normalized?**\n- **Are ALL calculated/aggregated fields in `mv_` tables only?**\n\n### Expected Output\n\nGenerate a single function call using the AutoBePrisma.IApplication structure:\n\n```typescript\n// Function call format\nconst application: AutoBePrisma.IApplication = {\n files: [\n {\n filename: \"schema-01-articles.prisma\",\n namespace: \"Articles\", \n models: [...]\n },\n // ... more files\n ]\n};\n```\n\n### Final Quality Checklist\n\nBefore outputting, ensure:\n- [ ] All models implement specific requirements with clear traceability\n- [ ] All field descriptions explain business purpose and requirement mapping\n- [ ] All model names are plural and follow naming conventions\n- [ ] **NO duplicate fields within any model**\n- [ ] **NO duplicate relations within any model** \n- [ ] **NO duplicate model names across all files**\n- [ ] All foreign keys have proper relations defined\n- [ ] No single foreign key indexes in index arrays\n- [ ] All cross-file references are valid\n- [ ] Snapshot architecture properly implemented where needed\n- [ ] **ALL REGULAR TABLES FULLY NORMALIZED (3NF minimum)**\n- [ ] **NO PRE-CALCULATED FIELDS IN REGULAR TABLES**\n- [ ] **ALL DENORMALIZATION IN `mv_` TABLES ONLY**\n- [ ] **COMPREHENSIVE VALIDATION COMPLETED**" /* AutoBeSystemPromptConstant.PRISMA_SCHEMA */,
9
12
  },
10
13
  {
14
+ id: (0, uuid_1.v4)(),
15
+ created_at: new Date().toISOString(),
11
16
  type: "systemMessage",
12
17
  text: [
13
18
  "Before making prisma schema files,",
@@ -18,6 +23,8 @@ const transformPrismaSchemaHistories = (analyze, component) => {
18
23
  ].join("\n"),
19
24
  },
20
25
  {
26
+ id: (0, uuid_1.v4)(),
27
+ created_at: new Date().toISOString(),
21
28
  type: "assistantMessage",
22
29
  text: [
23
30
  "Here is the requirement analysis report.",
@@ -1 +1 @@
1
- {"version":3,"file":"transformPrismaSchemaHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/transformPrismaSchemaHistories.ts"],"names":[],"mappings":";;;AAKO,MAAM,8BAA8B,GAAG,CAC5C,OAA6B,EAC7B,SAIC,EAGD,EAAE;IACF,OAAO;QACL;YACE,IAAI,EAAE,eAAe;YACrB,IAAI,8oWAA0C;SAC/C;QACD;YACE,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE;gBACJ,oCAAoC;gBACpC,wCAAwC;gBACxC,sCAAsC;gBACtC,EAAE;;aAEH,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE;gBACJ,0CAA0C;gBAC1C,EAAE;gBACF,8DAA8D;gBAC9D,gDAAgD;gBAChD,EAAE;gBACF,iBAAiB;gBACjB,OAAO,CAAC,MAAM;gBACd,EAAE;gBACF,gCAAgC;gBAChC,EAAE;gBACF,SAAS;gBACT,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC;gBAC7B,KAAK;gBACL,EAAE;gBACF,YAAY;gBACZ,EAAE;gBACF,wBAAwB,SAAS,CAAC,QAAQ,EAAE;gBAC5C,mCAAmC;gBACnC,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,KAAK,EAAE,CAAC;gBACpD,sCAAsC;gBACtC,GAAG,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,KAAK,EAAE,CAAC;aAC3D,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;AACJ,CAAC,CAAC;AApDW,QAAA,8BAA8B,kCAoDzC"}
1
+ {"version":3,"file":"transformPrismaSchemaHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/transformPrismaSchemaHistories.ts"],"names":[],"mappings":";;;AAEA,+BAA0B;AAInB,MAAM,8BAA8B,GAAG,CAC5C,OAA6B,EAC7B,SAIC,EAGD,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,8oWAA0C;SAC/C;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE;gBACJ,oCAAoC;gBACpC,wCAAwC;gBACxC,sCAAsC;gBACtC,EAAE;;aAEH,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE;gBACJ,0CAA0C;gBAC1C,EAAE;gBACF,8DAA8D;gBAC9D,gDAAgD;gBAChD,EAAE;gBACF,iBAAiB;gBACjB,OAAO,CAAC,MAAM;gBACd,EAAE;gBACF,gCAAgC;gBAChC,EAAE;gBACF,SAAS;gBACT,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC;gBAC7B,KAAK;gBACL,EAAE;gBACF,YAAY;gBACZ,EAAE;gBACF,wBAAwB,SAAS,CAAC,QAAQ,EAAE;gBAC5C,mCAAmC;gBACnC,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,KAAK,EAAE,CAAC;gBACpD,sCAAsC;gBACtC,GAAG,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,KAAK,EAAE,CAAC;aAC3D,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;AACJ,CAAC,CAAC;AA1DW,QAAA,8BAA8B,kCA0DzC"}
@@ -1,5 +1,5 @@
1
1
  import { AutoBeAssistantMessageHistory, AutoBeTestHistory } from "@autobe/interface";
2
2
  import { ILlmSchema } from "@samchon/openapi";
3
- import { AutoBeContext } from "../context/AutoBeContext";
4
- import { IAutoBeApplicationProps } from "../context/IAutoBeApplicationProps";
3
+ import { AutoBeContext } from "../../context/AutoBeContext";
4
+ import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
5
5
  export declare const orchestrateTest: <Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>) => (props: IAutoBeApplicationProps) => Promise<AutoBeAssistantMessageHistory | AutoBeTestHistory>;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.orchestrateTest = void 0;
13
+ const uuid_1 = require("uuid");
14
+ const orchestrateTestCorrect_1 = require("./orchestrateTestCorrect");
15
+ const orchestrateTestProgress_1 = require("./orchestrateTestProgress");
16
+ const orchestrateTestScenario_1 = require("./orchestrateTestScenario");
17
+ const orchestrateTest = (ctx) => (props) => __awaiter(void 0, void 0, void 0, function* () {
18
+ var _a, _b, _c, _d, _e, _f, _g, _h;
19
+ const start = new Date();
20
+ ctx.dispatch({
21
+ type: "testStart",
22
+ created_at: start.toISOString(),
23
+ reason: props.reason,
24
+ step: (_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : 0,
25
+ });
26
+ const operations = (_d = (_c = ctx.state().interface) === null || _c === void 0 ? void 0 : _c.document.operations) !== null && _d !== void 0 ? _d : [];
27
+ if (operations.length === 0) {
28
+ const history = {
29
+ id: (0, uuid_1.v4)(),
30
+ type: "assistantMessage",
31
+ created_at: start.toISOString(),
32
+ completed_at: new Date().toISOString(),
33
+ text: "Unable to write test code because there are no Operations, " +
34
+ "please check if the Interface agent is called.",
35
+ };
36
+ ctx.histories().push(history);
37
+ ctx.dispatch(history);
38
+ return history;
39
+ }
40
+ // SCENARIOS
41
+ const scenarioEvent = yield (0, orchestrateTestScenario_1.orchestrateTestScenario)(ctx);
42
+ const scenarios = scenarioEvent.scenarios
43
+ .map((scenario) => {
44
+ return scenario.scenarios;
45
+ })
46
+ .flat();
47
+ const codes = yield (0, orchestrateTestProgress_1.orchestrateTestProgress)(ctx, scenarios);
48
+ const correct = yield (0, orchestrateTestCorrect_1.orchestrateTestCorrect)(ctx, codes);
49
+ const history = {
50
+ type: "test",
51
+ id: (0, uuid_1.v4)(),
52
+ completed_at: new Date().toISOString(),
53
+ created_at: start.toISOString(),
54
+ files: correct.files,
55
+ compiled: correct.result,
56
+ reason: "Step to the test generation referencing the interface",
57
+ step: (_f = (_e = ctx.state().interface) === null || _e === void 0 ? void 0 : _e.step) !== null && _f !== void 0 ? _f : 0,
58
+ };
59
+ ctx.dispatch({
60
+ type: "testComplete",
61
+ created_at: start.toISOString(),
62
+ files: correct.files,
63
+ step: (_h = (_g = ctx.state().interface) === null || _g === void 0 ? void 0 : _g.step) !== null && _h !== void 0 ? _h : 0,
64
+ });
65
+ ctx.state().test = history;
66
+ ctx.histories().push(history);
67
+ return history;
68
+ });
69
+ exports.orchestrateTest = orchestrateTest;
70
+ //# sourceMappingURL=orchestrateTest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrateTest.js","sourceRoot":"","sources":["../../../src/orchestrate/test/orchestrateTest.ts"],"names":[],"mappings":";;;;;;;;;;;;AAOA,+BAA0B;AAI1B,qEAAkE;AAClE,uEAAoE;AACpE,uEAAoE;AAE7D,MAAM,eAAe,GAC1B,CAAiC,GAAyB,EAAE,EAAE,CAC9D,CACE,KAA8B,EAC8B,EAAE;;IAC9D,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;IAC/B,GAAG,CAAC,QAAQ,CAAC;QACX,IAAI,EAAE,WAAW;QACjB,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;QAC/B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,OAAO,0CAAE,IAAI,mCAAI,CAAC;KACrC,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,SAAS,0CAAE,QAAQ,CAAC,UAAU,mCAAI,EAAE,CAAC;IACpE,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAkC;YAC7C,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,IAAI,EAAE,kBAAkB;YACxB,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;YAC/B,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACtC,IAAI,EACF,6DAA6D;gBAC7D,gDAAgD;SACnD,CAAC;QAEF,GAAG,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9B,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEtB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,YAAY;IACZ,MAAM,aAAa,GACjB,MAAM,IAAA,iDAAuB,EAAC,GAAG,CAAC,CAAC;IAErC,MAAM,SAAS,GAAG,aAAa,CAAC,SAAS;SACtC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QAChB,OAAO,QAAQ,CAAC,SAAS,CAAC;IAC5B,CAAC,CAAC;SACD,IAAI,EAAE,CAAC;IAEV,MAAM,KAAK,GAA8B,MAAM,IAAA,iDAAuB,EACpE,GAAG,EACH,SAAS,CACV,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,IAAA,+CAAsB,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAEzD,MAAM,OAAO,GAAsB;QACjC,IAAI,EAAE,MAAM;QACZ,EAAE,EAAE,IAAA,SAAE,GAAE;QACR,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACtC,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;QAC/B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,QAAQ,EAAE,OAAO,CAAC,MAAM;QACxB,MAAM,EAAE,uDAAuD;QAC/D,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,SAAS,0CAAE,IAAI,mCAAI,CAAC;KACvC,CAAC;IAEF,GAAG,CAAC,QAAQ,CAAC;QACX,IAAI,EAAE,cAAc;QACpB,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;QAC/B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,SAAS,0CAAE,IAAI,mCAAI,CAAC;KACvC,CAAC,CAAC;IAEH,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,GAAG,OAAO,CAAC;IAC3B,GAAG,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE9B,OAAO,OAAO,CAAC;AACjB,CAAC,CAAA,CAAC;AAtES,QAAA,eAAe,mBAsExB"}
@@ -0,0 +1,4 @@
1
+ import { AutoBeTestProgressEvent, AutoBeTestValidateEvent } from "@autobe/interface";
2
+ import { ILlmSchema } from "@samchon/openapi";
3
+ import { AutoBeContext } from "../../context/AutoBeContext";
4
+ export declare function orchestrateTestCorrect<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, codes: AutoBeTestProgressEvent[], retry?: number): Promise<AutoBeTestValidateEvent>;